Understanding query parameters with an external API

I’ve connected an external API to my Adalo app successfully, but I’m having trouble understanding how the query parameters communicate with the API. There isn’t much documentation on the subject so I thought I’d throw it out here.

These are the settings, and getting all records works great. However, I can’t figure out how to sort by individual patients. In a browser I can retrieve it like this:
https://qa.myholisticoffice.com/api/api2/PatientPortal/52
that brings back the records for patient ID 52. What query parameter do I need to achieve the same in Adalo?

Any help is greatly appreciated. Thanks!

Hi @mshultzman,

I’m not sure you can add this API as an external collection. When I do a request to https://qa.myholisticoffice.com/api/api2/PatientPortal/, I don’t see any field with a unique ID for the record. This might prevent Adalo from working with it correctly.

Best,
Victor.

1 Like

Thanks so much for offering help! We’ve changed the API so that it returns a unique id for each record, though it still won’t work with the query parameter filter. Is there something simple I’m missing?

Hi @mshultzman,

Just to clarify: “Query parameter” filter is an interface to create the parameters in the HTTP URL query.
E.g. if you have an API with base URL like:
https://api.example.com/v1/,
then adding query parameter like yours will result in something like
https://api.example.com/v1?id=115

If your API doesn’t have query parameters, it makes no sense using this filter.

Important note: if your API returns records with unique IDs, then if you create a List, you can access a record in this list in a similar way you do with built-in collections. You just need to set up the Get One request URL correctly. Usually it is set up as
https://api.example.com/v1/id, where id is the unique ID of the record.

Best,
Victor.

Hi @Victor!

First let me say thank you so much for responding and helping me along the way, I’m steadily understanding more and more. I now understand query parameters and how the API needs to be set up. With Postman I have this query for patientID working beautifully:

however, in Adalo when I attempt the same query parameter to filter a list, it only ever will return the Get All with no filter, and seemingly no parameter properly communicated. Here are some screen shots to show you what I’m doing:




So the base url is https://qa.myholisticoffice.com/api/api2/PatientPortal
Seems like with the query parameter it should be calling https://qa.myholisticoffice.com/api/api2/PatientPortal?patientID=52
which again works in Postman no problem and returns two records that match patientID 52

Any ideas are greatly appreciated, and thanks again for taking time to help!!

Much love,
Mike

Hey @mshultzman,

I suspect the issue is related to your API’s base URL.

Your Base URL is not https://qa.myholisticoffice.com/api/api2/PatientPortal as you’re saying. Here is what I get as a return:

However when I add a “/” at the end it works:

But this setup don’t correctly work with the query params. When you add a query param to external collection, it is interpreted as “?param=value”.

So, if I add a param like on your screenshot (patientID = 52), the final string will be:
https://qa.myholisticoffice.com/api/api2/PatientPortal/?patientID=52

And this query returns ALL records:

It works correctly only if I remove “/” from the URL. So I would recommend to correct your API so that Base URL doesn’t end with “/”.

As a side note - your API still doesn’t return correct results for a single record, queries like this don’t work:

I’d suggest modifying it so that it correctly returns single record as well.

Best regards, Victor.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.