How to retrieve the results of the integration test of an external API to place it in a collection

Hi I hope you’re fine !
I integrated an API inking a new action I would like to retrieve a value in the response of the API and add it as a table in a collection, what should I do?

Hi @Jos,

Could you please elaborate, what would you like to achieve?

To start with - you can’t add a “table in a collection”; Collections in Adalo do not contain tables. I’d say, “Collection” and “Table” could be used as synonims.
If you’d like to add a new Collection using the API, then unfortunately this is not possible as of now.
If you’d like to add a new record to the collection, then you can use POST request to create it.

Best regards, Victor.

Hi Victor, I am in the process of integrating an online payment portal which contains 2 APIs the first is for the payment request and the second for the validation of the transaction
I integrated the first API via a custom action, it retrieves the results of the first API to create a collection with the second API. this is where I am stuck

So how do you return the data from a custom action to a collection?

Hi @Jos,

" it retrieves the results of the first API to create a collection with the second API." - sorry, I don’t quite get why the Payment API needs to create a collection.
Do you have separate database tables (=collections) for each payment? I don’t believe it works like that, otherwise the size of the DB will be HUGE.

If the API you’re using returns some data in JSON, then you can see this data as an action “result” (when you add the custom action, it is Step 3). On that step, you can make the data from the “result” to be returned by custom action.
Then, you can use this resulting data on the next action on your screen.

Imagine a button where you make a payment, 1st action will be the custom action calling some API. You send email and amount (for example). The API returns some “payment ID”. Then, you can have this “Payment ID” to be stored in Users collection (for example, it could be other collection), by adding the 2nd action to this button: the “payment ID” will be available when you configure the 2nd action.

Best regards, Victor.

Can i have an illustrative sketch?

also my API request data comes from the collections via magic text so they are dynamic, how to get them?

Hi @Jos,

Please have a look at this official help page (updated and enhanced): Accessing your Record ID - Adalo Resources. Using the results of custom action is described at steps 19 and 20.

Best,
Victor

Hi Victor, I would like to retrieve the data from the response from the API (which I have circled in black) to use them as dynamic data by replacing it with magic text

Is it possible to put this data in a collection or the components of a screen?

Dear @Jos,

After you save this custom action, you can use it in your app. When you add this custom action as an action to a screen element (say, button), you can add another action after it. With this action you can update the properties of the record with the results of this previous custom action.

Please have a look at the help document from my previous reply. In the point 20 of the document there is an exact answer to your question.
Adapt this answer to your needs - use the collection and properties from your app.

Best regards, Victor.

Thank you very much dear Victor

1 Like