Accessing w/ Postscript
The Postscript feature is very useful when you want to use coded variables on different API requests. With this feature, you can access then throughout your automated flow. This is helpful when you need to store and use information from a previous API request in subsequent requests.
In this test case we have an API returning a list of fruits as a
JSONobject. From that list, we'll be extracting the name and the calories from the "Apple" object and use it on our next requests.
const apple = $.find((fruit)=>fruit.name == "Apple");
// the $ represend the whole json response object
// we then use an array method to find the "Apple" object
We can now access this object and it's attributes such that:
const appleName = apple.name; // returns "Apple"
const appleCalories = apple.nutritions.calories; //returns 52
To test this out we can use the
console.logmethod to print out appleName and appleCategories
You can now access those variables within the rest of your flow.
You can use Postscript print out values from the Extractions section used across the flow.
Here are the steps:
- 1.Create any extraction from the Extractions section.
- 2.Open your Postscript section.
- 3.Assign the extracted parameter to postscript. ie:
const name = extractedParameterName;