Athul
August 5, 2025, 7:44am
1
Hi everyone,
I’m working on a Reels workflow with the following steps:
Input: The workflow takes quote_id as input.
API Rule Node: Calls a deployed SSD API that returns all member details for the given quote_id.
Script Node: In the same workflow, I need to perform age calculation using the API response.
Output: Based on the calculation, the workflow should respond with:OP_valid = true;
Issue I’m facing:
I’m unable to access the API response in the Script Node .
I tried using OP_ and IP_ prefixes, but I can’t get the data returned from the API node inside the script node. How do I correctly access the API response from the API rule in the next Script Node?
4 Likes
Eldho
August 5, 2025, 7:46am
2
Athul
August 5, 2025, 9:08am
3
Hi @Rocky , @Muhammed_Sinan
Thanks for checking my post. This is a bit urgent for my workflow as I’m blocked at the Script Node step.
2 Likes
Rocky
August 5, 2025, 9:23am
4
Hi Athul, could you please share the correct cURL command for the API? I’m not getting any response when I trigger it.
2 Likes
Sam
August 5, 2025, 9:23am
5
Hello @Athul ,
It seems like your API is not working as expected.
Could you please:
Verify whether the API is up and functioning correctly?
Ensure that any required headers are configured appropriately?
In the meantime, here’s a quick reference on how to consume an API response in the Reels Platform using an API Rule :
Steps to Consume API Response in an API Rule
1. Create an API Rule
Navigate to the Rules section from the left navigation panel.
Click the Add button → Choose Rule .
Enter:
Rule Name
Description
Select API Rule as the Rule Type.
Click Create .
2. Configure the Rule
You’ll be directed to the Rule Details page.
Go to the Rule Designer tab.
Double-click the rule name to open the editor.
You will see three tabs: Rule , Model Editor , and Constants .
3. Define Input and Output Keys
Go to the Model Editor tab.
Use Add Root in both Input and Output editors to define your structure:
Example:
Input: inputTitle (string)
Output: id (number), outputTitle (string)
4. Configure API Request
In the Rule tab:
Select the appropriate HTTP method (e.g., POST).
Enter the API URL .
Configure:
Headers (if needed)
Request Body – Map input keys
After Response – This is critical for consuming the response.
5. Consume the API Response
In the After Response section:
Click Add Field .
Provide the key from the response (e.g., id, title).
Map it to your defined output key in the Model Editor.
For example, if the API responds with:
{
"id": 195,
"title": "BMW"
}
Then map as:
id → Output Target: id
title → Output Target: outputTitle
How to consume API response in Script Node:
If you’re getting a response from an API rule, you can access and process it in the Script Node using the IP_ prefix.
Step-by-step example:
Let’s say your Api rule returns the following response:
{
"productId": "1234",
"productName": "Smart Watch",
"rating": 4.5
}
To consume this response in your Script Node:
Access the input using the IP_ prefix:
let product = IP_response; // API response
Write your logic based on the API data:
if (product && product.rating >= 4) {
OP_valid = true;
} else {
OP_valid = false;
}
Expected Output:
If the rating is 4.5, this script will return:
OP_valid = true;
And Add vaild as output in model Editor
5 Likes
Athul
August 5, 2025, 10:25am
6
@Rocky , @Sam Thanks a lot for sharing the necessary details! Everything worked perfectly now.
6 Likes