Forum Academy Marketplace Showcase Pricing Features

Searching for data in an API Array response

Hi everyone,

I’m calling an API from a backend workflow which returns an Array (Array structure below).

I’m looking to:

  • Search for “SKL”
  • Return the id associated with SKL
  • Return the balance associated with SKL

I’d then use this data (id and balance) in the workflow mentioned earlier.

Is there a way to search for and return data in an Array response in a workflow?

Array structure:
[
{
“id”: “vnwob-boruvbw”,
“name”: “SKL Wallet”,
“balance”: “0.00000000”,
“currency”: “SKL”,
“type”: “wallet”,
“primary”: false,
“active”: true,
“available_on_consumer”: true,
“hold_balance”: “0.00”,
“hold_currency”: “USD”
},
{
“id”: “vbrov-vnb83nr”,
“name”: “NMR Wallet”,
“balance”: “0.00000000”,
“currency”: “NMR”,
“type”: “wallet”,
“primary”: false,
“active”: true,
“available_on_consumer”: true,
“hold_balance”: “0.00”,
“hold_currency”: “USD”
},
{


.
}

Hi @andrewmccalister :wave:

You can read this information in any step of your workflow using the parameter “Request Data” (I think this is the name). You will see all the response given in your API return.

Hey @rpetribu ,

Thanks for your input. I had never actually seen this feature before.

Could you point me to where I can actually choose it - the initial post on the topic is a little unclear ([New Feature] Smart detection of request data for API workflows).

You can see in the screenshot below I don’t see it as an option when calling an API connector directly in the workflow and when I try and search for the parameter in the next step in the workflow nothing that would be considered “Request data” comes up.


Hi @andrewmccalister !

Your call is beeing made in the first step?

I call the API connector in the second step.

I create a signature for the API in the first step, which I then use in the second step.

Try to use the command “Result of step 2…” in any block of your third step… Just like you did in your second step, reading the result of your first step…

I looked into doing that but there doesn’t seem to be any option similar to “request data” in the list of options it gives you to interact with the data from step 2.

Do you know if it’s labelled as something else in that list?

I tought that it was a backend workflow… fortget the “Request Data”… sorry about it.

Note that in your image you can see the “id”, “name” and other information of your call! :+1:

Each item’s id
Each item’s name
……

Sorry, I wasn’t clear.

The end solution will be in a backend workflow, but I was testing it on a front end workflow - i.e making sure I could see the data I was wanting to see.

Focusing on the backend workflow (since that is where it will ultimately be implemented). I can now see the ‘Detect Data’ option you are referencing, but on further research it seems like the ‘Detect Data’ option is only useful for webhooks, is that correct?

I’m trying to call an API (via the API connector) and use the response of that API call (which is an Array) to make some decisions. In the example below, I’ve made the API call in step 2, and I only want to take a step 3 if some aspect of the Array response in step 2 is to my liking.

You can see in ‘Only When’ for step 3 I can call ‘Request Data’ but it doesn’t give me any options…

I presume this is something to do with the set up on the workflow level, I have it set up in the screenshot below. When I click ‘Detect Data’ it gives me an endpoint ULR to point a webhook at, but the data I’m requesting is a GET call, which I do in the workflow - not a webhhook.

I think the step you are missing is just to use :filtered and select the field name contains = SKL in constraints
It will return only item that contain it. Now you can use :first item if you know that only one item will contain it. And you will have access to all other field like ID, balance…