Add Endpoint with no "all" test

Hi,

I got an endpoint where “all” would receive millions of results. What I need is to add this endpoint so I can query for a single result ad hock. Is this possible?

Cheers,

Mike

Can you provide more information on your request? What is the endpoint, what are you querying, is this an external collection or custom action?

Provide as much detail as possible. I would even recommend recording your screen showing the details of how you have the screens set up and actions/lists/visibility settings also.

You can use Loom to record your screen for free.

I used the chat template as I am new on adalo and just want to test some things, added a playerid field to user db and (edit) profile screen. The goal is to show information from the api for the specific user at the profile page. The api has no all endpoint. It needs a playerid ( …/players/{playerid} ) to give a result so my plan was to use the playerid field from user profile to do the request to the api.

Another endpoint from the same api works fine because I can fetch all results for this endpoint. Does adalo need to fetch all and populates this in some internal db?

Are you using an external database or just the internal adalo database? If you’re only using the internal adalo database, you don’t need to use the API, you can just send information from a list to a new screen.

For example, I just cloned the chat template and added a chip list of current conversation users:

This then links to the “Profile” page where you can see “Current User” data is sent to the profile screen.

You can see that I can now use “Current User” data on the profile screen.

Thanks for you answer but I want to enrich the userprofile page with information the external api has. For this the user should add his playerid (abc123) to the profile page and adalo should then do a request to the external api /players/abc123.

This would work for an endpoint with a “get all” uri but not for this one where “get all” is not possible.

The Adalo API requires the record ID in order to do a single item query. This is an internal record ID that is not visible in the database. You must do a query to get the record ID first and then you can use the API’s “fetch a single record” API call.

The way that I had mentioned in my other reply contains ALL of the same information the API call does, without having to make an API call.

So let me ask you this… What information are you referring to that the external API call has that the internal database does not have?

The external api (not adalo!!) has information about player metrics and is not under my control. It’s a mobile game with millions of players so I guess this is the reason they don’t offer an “all” query. You have to do a external-api.com/players/{playerid} query.

I thought I will ad a “playerid” field in the “edit profile” screen in adalo and on the “profile” screen I will ad a component that will be filled with the results of the external-api.com/players/{playerid} query.

Oh I see.

Yes, you can do that. Depending on the API you are using, you should be able to do a query parameter with a filter to grab that player ID. This would entirely depend on the API you’re using and if they have the ability to filter results.

Since you’re using a single record fetch from the external API, it may be worth adding the fields to the user collection that you want to store from the external API. Then, you can just use a custom action to perform the API call, then update the logged-in user with the information obtained from the API call.

1 Like