02-24-2023 02:14 AM
I have created a recipe. On step 2 I have used custom connector which get some api and perform some logic to create a custom array for me which I have declared inside the code.
Now I am unable to send this array as an output so I can use it on step 3 of recipe as an input. I want to use repeat action step to do some other stuff on this array.
How to achieve this?
I have tried the below thing as per document, but I guess it worked when the response is directly came from API and not for custom array created by me inside code:
Example of arrays: =>
height_array ["172", "167", "96", "202", "150", "178", "165", "97", "183", "182"]
comapny_id_array [1, 2, 3, 4 , 5, 10]
Solved! Go to Solution.
02-24-2023 09:42 AM - edited 02-24-2023 09:42 AM
I checked one of my connectors and you're configuring the output field correctly. The issue may be related to how you're constructing the custom array, or how you're passing the custom array to your output.
Here's how I managed it:
Output field:
{
"type": "array",
"of": "string",
"label": "List of Asset IDs to Download",
"name": "list_of_asset_ids_to_download"
}
Sample API Output:
{"asset_items": [
{"id": 1},
{"id": 2},
{"id": 3}
]}
Execute:
# API call
response = get("/api/v1/search?query=blahblahblah")
# create custom array and add it to response as a new key
response[:list_of_asset_ids_to_download] = response['asset_items'].pluck('id')
Now I can access "list_of_asset_ids_to_download" as an array of strings data pill on the connector output, like this:
list_of_asset_ids_to_download:
[
8005903,
8005899,
8005896
]
Hope this helps!
02-27-2023 04:17 AM
02-24-2023 09:42 AM - edited 02-24-2023 09:42 AM
I checked one of my connectors and you're configuring the output field correctly. The issue may be related to how you're constructing the custom array, or how you're passing the custom array to your output.
Here's how I managed it:
Output field:
{
"type": "array",
"of": "string",
"label": "List of Asset IDs to Download",
"name": "list_of_asset_ids_to_download"
}
Sample API Output:
{"asset_items": [
{"id": 1},
{"id": 2},
{"id": 3}
]}
Execute:
# API call
response = get("/api/v1/search?query=blahblahblah")
# create custom array and add it to response as a new key
response[:list_of_asset_ids_to_download] = response['asset_items'].pluck('id')
Now I can access "list_of_asset_ids_to_download" as an array of strings data pill on the connector output, like this:
list_of_asset_ids_to_download:
[
8005903,
8005899,
8005896
]
Hope this helps!
02-27-2023 04:17 AM