In Transaction Recording Policy the "Flow Variable" has a drop down menu (under the 'Transaction Attributes' and 'Custom Attributes' sections) has got three options:
response.status.code response.reason.phrase target.ip
However, it does not allow us to use a customized value for Flow Variable. All the other location options such as "Header", "JSON body", "XML body" and "XML and JSON body" allows us to use customized value.
Can you please let me know if there's a way to add customized Flow Variable in Transaction Recording Policy ?
Solved! Go to Solution.
Figured out a way to set the customized Flow Variables in Transaction Recording Policy. Using the UI, create a TRP for a product and set the Flow Variable wherever you need with any of the values provided in the drop down menu. Then follow the below steps to replace the standard value for the Flow Variable(s) with any customized value as per your needs:
1. Get the API Product using the below curl command
curl -X GET -H "Content-Type: application/json" -o MyProduct_original.json "https://api.enterprise.apigee.com/v1/organizations/{org-name}/apiproducts/{APIProduct-name}" -u <user>:<password>
The above command gets the APIProduct information including Transaction Recording Policy (TRP) information and stores it a file "MyProduct_original.json".
2. Copy the file “MyProduct_orignal.json" to another file let's say "MyProduct_modified.json"
3. Edit the file "MyProduct_modified.json" and replace the value of the Flow Variable with an appropriate value.
For ex:
Note: While modifying the JSON output file in Step#3, be careful not to add/remove any backslashes
4. Update the API Product with the modified file "MyProduct_modified.json" using the below curl command
curl -X PUT -H "Content-Type: application/json" -d @MyProduct_modified.json "https://api.enterprise.apigee.com/v1/organizations/{org-name}/apiproducts/{APIProduct-name}" -u <user>:<password>
Here is the screenshot showing the customized Flow Variable after following the above variables:
Hi @AMAR DEVEGOWDA -
As a workaround, try using the Assign Message policy on the response to to populate the header with the variable value.
<Set> <Headers> <Header name="custom_variable_header_name">{custom_variable}</Header> </Headers> </Set>
Then you could define your transaction recording policy like this:
It's not the most graceful solution, but it should work.
Dear @Floyd Jones,
Thanks for your suggestion. We can add the customized variable for Header. But we can't do it for the Flow Variable as it has a drop down menu. I was looking on how to do it for Flow Variable.
Figured out a way to set the customized Flow Variables in Transaction Recording Policy. Using the UI, create a TRP for a product and set the Flow Variable wherever you need with any of the values provided in the drop down menu. Then follow the below steps to replace the standard value for the Flow Variable(s) with any customized value as per your needs:
1. Get the API Product using the below curl command
curl -X GET -H "Content-Type: application/json" -o MyProduct_original.json "https://api.enterprise.apigee.com/v1/organizations/{org-name}/apiproducts/{APIProduct-name}" -u <user>:<password>
The above command gets the APIProduct information including Transaction Recording Policy (TRP) information and stores it a file "MyProduct_original.json".
2. Copy the file “MyProduct_orignal.json" to another file let's say "MyProduct_modified.json"
3. Edit the file "MyProduct_modified.json" and replace the value of the Flow Variable with an appropriate value.
For ex:
Note: While modifying the JSON output file in Step#3, be careful not to add/remove any backslashes
4. Update the API Product with the modified file "MyProduct_modified.json" using the below curl command
curl -X PUT -H "Content-Type: application/json" -d @MyProduct_modified.json "https://api.enterprise.apigee.com/v1/organizations/{org-name}/apiproducts/{APIProduct-name}" -u <user>:<password>
Here is the screenshot showing the customized Flow Variable after following the above variables:
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |