Can custom information be used to query an external collection. For example the API needs a users address in order to return the right information.
Yes! You can add custom query parameters to the request so that data is used to query the API. And the values for those can come from form inputs, or other contextual information within the app.
Hey @jeremy!
Do you have a tutorial for this? I am trying to figure something like this out for using the Unsplash image API.
Right now, if you are setting up an external collection and that API requires a Query to return results, you have to add a query param in the setup of the external collection to get through the authentication in Adalo. That means that you canāt change the custom query param in a list filter based on any input on the screen. So you are stuck with a static request for an API like this.
In an ideal world, the param in the setup could be a default or fallback value, and then replaced with the custom query filter in the list or whatever you have setup with the same query key. Something similar to how the custom action use of magic text works.
Itās very related to this, though the query params youāll use are different, based on which API youāre using: Filtering Airtable Lists - Adalo Resources
Hey Jeremy,
Thank you for this! It looks like this may work if I am reading this right.
If I am understanding this correctly. I would set up an external collection via API with the āquery paramā placed in there. Letās call that āqā. Then when creating the list, I can create a filter with the parameter of āfilterByFormulaā. In the filter, I would write something like ({q} = ā(MAGIC TEXT)ā). And that would take the place of the original āqā param used when setting up the external collection?
Is that correct?
No, I donāt think so. If I am correct, the filterbyformula option works only for Airtable external collections. Iād like tu use other api / external collections, but they require a dynamic parameter as a path parameter, aka as part of the endpoint url, and thatās not possible today in terms of external collections setup.
Hey Christophe,
Yeah. I have been unsuccessful in getting this to work. However, reading through this topic External Collection query parameter - #4 by kcan
It does seem that this should be possible using magic text and filterByFormula on non Airtable External Collections as well. Even with using an intermediate load screen to bring the input text over, no luck.
I am facing the same issue using an airtable external collection and the need of an intermediate load screen. I have still some adjustments to do but if I succeed in getting the result I expect, I will let you know.
The indication about the filterbyformula is not clear enough. In the help docs, itās stated that filterbyformula accept as value any airtable formula. So Iām not really convinced this query parameter can be used for any other external collection type⦠Deep dive needed here!
Did you have any luck with this? I am trying to pass in a dynamic query parameter for an external collection via a property in my user collection and it works fine with I hard code in a test parameter but does not work when using Magic Text for that property.
Hi @zakakatz. Iām trying to pass in a dynamic query parameter for an external collection via a property in my user collection. It is working, but Iām not able to make a list with the response using the custom action. Any ideas?
You basically have to save the response in an Adalo collection. See tutorial video in Custom Action Outputs are Live!
thanks @karimoo. It works for a response of a single item. What I have been trying to archive is to show on a list of items the response of several items.
An input has a value and then the value is taken as a param on the Api Call, the response comes with several items and not just a single one. I need to display all those items on a list.
So, Iām not able to save all the items at once in a local collection. And with an external collection Iām not able to change the param that I initially added.
Basically, Iām talking about the getAll of a response which is different every time depending on the input value.
What should I do ?
@billedevs What API are you using? I would need to see the endpoints, parameters and JSON response to find out if there is another workaround.
@karimoo I have set up the query parameter and loaded the user information prior to the screen where I am filtering the list. However I am trying to pass in multiple parameter filters, and the query parameter only seems to be working for the first parameter. I have tested the request URL below and it returns the desired records list in Postman, but does not seem to function in Adalo. Is this a known issue?
Basically, What I mean is what he is doing here. Right in that second 4:09.
But He is just adding one item, because the response comes only with one item. What I need is to save on the collection all the items on the response. And those items belong to the card, the card is the value inserted by the user in the input field. So If I need to call another card, it would have to save all the items belonging to that card too on the collection, with the record of the card as a value to filter the records for the current card.
This is is a private API, very simple, just a normal endpoint where you add the param card.
The response looks like this.
{
"code": 200,
"card": "4227004914796423",
"items": [
{
"FECHA": "01-04-2020",
"COMERCIO": "RAPPIPAY , 11001Bogot",
"MONEDA": "PESOS",
"MONTO": "301.28",
"STATUS": "OK"
},
{
"FECHA": "02-04-2020",
"COMERCIO": "PAYPAL *PATREON MEMBER , CIUDAD DE MEX",
"MONEDA": "PESOS",
"MONTO": "256.24",
"STATUS": "OK"
},
{
"FECHA": "02-04-2020",
"COMERCIO": "NAME-CHEAP.COM , WWW.NAMECHEAP",
"MONEDA": "PESOS",
"MONTO": "245.91",
"STATUS": "OK"
},
{
"FECHA": "03-04-2020",
"COMERCIO": "RAPPIPAY , 11001Bogot",
"MONEDA": "PESOS",
"MONTO": "309.77",
"STATUS": "OK"
},
{
"FECHA": "06-04-2020",
"COMERCIO": "RAPPIPAY , 11001Bogot",
"MONEDA": "PESOS",
"MONTO": "628.47",
"STATUS": "OK"
},
{
"FECHA": "07-04-2020",
"COMERCIO": "RAPPIPAY , 11001Bogot",
"MONEDA": "PESOS",
"MONTO": "6,284.77",
"STATUS": "OK"
},
{
"FECHA": "08-04-2020",
"COMERCIO": "RAPPIPAY , 11001Bogot",
"MONEDA": "PESOS",
"MONTO": "632.26",
"STATUS": "OK"
},
{
"FECHA": "09-04-2020",
"COMERCIO": "WWW.OVH.COM , ROUBAIX",
"MONEDA": "PESOS",
"MONTO": "498.37",
"STATUS": "OK"
},
{
"FECHA": "10-04-2020",
"COMERCIO": "RAPPI PMZ , 1100100 BOGOT",
"MONEDA": "PESOS",
"MONTO": "225.86",
"STATUS": "OK"
},
{
"FECHA": "12-04-2020",
"COMERCIO": "RAPPIPAY , 11001Bogot",
"MONEDA": "PESOS",
"MONTO": "623.08",
"STATUS": "OK"
},
{
"FECHA": "14-04-2020",
"COMERCIO": "RAPPIPAY , 1100100 BOGOT",
"MONEDA": "PESOS",
"MONTO": "318.77",
"STATUS": "OK"
},
{
"FECHA": "15-04-2020",
"COMERCIO": "MERCADOPAGO COLOMBIA , 11001BOGOTA",
"MONEDA": "PESOS",
"MONTO": "597.07",
"STATUS": "OK"
},
{
"FECHA": "19-03-2020",
"COMERCIO": "MERCADOPAGO COLOMBIA , 11001BOGOTA",
"MONEDA": "PESOS",
"MONTO": "1,154.51",
"STATUS": "OK"
},
{
"FECHA": "19-03-2020",
"COMERCIO": "DEPOSITO,",
"MONEDA": "PESOS",
"MONTO": "18,050.00",
"STATUS": "OK"
},
{
"FECHA": "22-03-2020",
"COMERCIO": "RAPPIPAY , 11001Bogot",
"MONEDA": "PESOS",
"MONTO": "1,253.92",
"STATUS": "OK"
},
{
"FECHA": "26-03-2020",
"COMERCIO": "RAPPIPAY , 11001Bogot",
"MONEDA": "PESOS",
"MONTO": "360.11",
"STATUS": "OK"
},
{
"FECHA": "26-03-2020",
"COMERCIO": "RAPPI PMZ , 11001Bogot",
"MONEDA": "PESOS",
"MONTO": "624.20",
"STATUS": "OK"
},
{
"FECHA": "28-03-2020",
"COMERCIO": "RAPPIPAY , 11001Bogot",
"MONEDA": "PESOS",
"MONTO": "919.08",
"STATUS": "OK"
},
{
"FECHA": "28-03-2020",
"COMERCIO": "RAPPIPAY , 11001Bogot",
"MONEDA": "PESOS",
"MONTO": "300.09",
"STATUS": "OK"
},
{
"FECHA": "28-03-2020",
"COMERCIO": "RAPPIPAY , 11001Bogot",
"MONEDA": "PESOS",
"MONTO": "300.09",
"STATUS": "OK"
},
{
"FECHA": "30-03-2020",
"COMERCIO": "NAME-CHEAP COM PHO, ENIX AZ",
"MONEDA": "PESOS",
"MONTO": "0.00",
"STATUS": "OK"
},
{
"FECHA": "30-03-2020",
"COMERCIO": "NAME-CHEAP COM PHO, ENIX AZ",
"MONEDA": "PESOS",
"MONTO": "0.00",
"STATUS": "OK"
},
{
"FECHA": "30-03-2020",
"COMERCIO": "RAPPIPAY , 11001Bogot",
"MONEDA": "PESOS",
"MONTO": "294.66",
"STATUS": "OK"
},
{
"FECHA": "31-03-2020",
"COMERCIO": "NAME-CHEAP.COM , WWW.NAMECHEAP",
"MONEDA": "PESOS",
"MONTO": "239.55",
"STATUS": "OK"
},
{
"FECHA": "31-03-2020",
"COMERCIO": "MERCADOPAGO COLOMBIA , 11001BOGOTA",
"MONEDA": "PESOS",
"MONTO": "119.91",
"STATUS": "OK"
}
]
}
@billedevs
I just tried it with the Airtable API:
If you use Custom Actions to get multiple items and add an action to save the result to a collection, Adalo can only handle ONE record.
So it looks like it is currently designed to handel single records only.
To fetch multiple records you need to use External Collections.
In your case:
The API must have the ability to pass a query parameter that you can filter for a certain card.
Unfortunately we donāt have Magic Text available to have flexible Endpoints for External Collections.
@zakakatz You need to spilt the endpoint URL and the query parameters.
Try to setup it up like this:
Hey @karimoo, yes sorry I should have clarified that I was splitting off the query parameters for filtering a list component (displaying external connection records). The URL I included in my last post was the corresponding matching criteria from Postman that returns the desired result.
The strange thing is that I have a very similar list elsewhere in my app that filters the list as expected. I have tried copying and pasting that list and just updating the parameter values but no matter what I do, this particular list never filters as expected. Are you seeing anything different/wrong I am doing between these two? I am completely dumbfounded.
This is probably the same problem I have with Airtable. There is a problem with the sequence of requesting data. See @jeremy ās response Filtering for Airtable not working with Magic Text - #15 by jeremy