Xano Datasource strange Endpoint call

Hi there,

In Xano I have two endpoints

GET /organizations - Fetch all organizations
GET /organizations/{organization_id} - Fetch details of organisation (by row click, navigate to details page with organization_id as url parameter) /organization-details/342

I was inspecting network traffic, because I find Weweb+Xano rather slow rendering data at some points, which should not be the case.

I noticed that when I go to a organization details page the following endpoint is triggered.

xanohostname/api:code/organizations/342?organization_id=342

You can see a duplicate reference Why is Weweb adding ?organization_id=342. How can I solve this I want to have xanohostname/api:code/organizations/342 (preferably) or xanohostname/api:code/organizations?organization_id=342

@FHEXL it looks like you might be using static collection pages and additionally pass the parameter as URL variable. I double checked mine endpoints and everything looks fine. I’m not using dynamic collection pages and pass variables in URLs.

Thanks, I will check this out. Maybe for some clarification:

  • Weweb URL /organizations/342
  • Xano URL api/organizations/{organization_id} input=organization_id (integer)

Looking at the network inspector in the Weweb preview app on page /organization/342 the xano endpoint is called as api/organizations/342?organization_id=342

@FHEXL you have to delete {organization_id} form XANO api. After that it works as you like. I’m not using this and that is why mine are OK.

Ok thanks, but how would you make a distinction between a GET endpoint to fetch all organizations and to fetch only one.

Options I am thinking about:

  • GET Organizations (* all organizations)
  • GET Organization (single organizations)

Or should you only use 1 one endpoint

  • GET Organizations (In Xano function stack I add a conditional. When input param organization_id is empty I query all organizations, when organization_id is not empty I fetch only 1 record.
  • In Weweb I add two collections All organizations where I leave the input param empty and a collection for Single organization where I bind the input param.

Looking forward to see your proposed approach.

I give them distinct names: single_organization, single_company_contact etc… For me such way is much more readable… And I’m not using GET Single record in XANO at all. I always use select multiple records even when I know there will be only one. Since I’m developing multitenant app this is the only resonable way to use more filters in SELECT without the need of filtering afterwards. Since this is PostgreSQL the backend SQL is the same - so there is no negative impact on performance.
I’m using different endpoints for different purposes, so GET one record is one endpoint and get multiple records is second one. When you have a lot of them it is much easier to maintain.