How can we read target response status and assign it to a new variable in AM.
for example my target status is '200'.
I want to set a variable so that I can later check the status in variable and do further treatment.
I tried this and not working 😞
<AssignVariable>
<Name>_httpStatusCode</Name>
<Value>{response.status.code}</Value>
</AssignVariable>
Any help or hint will be much appreciated.
Solved! Go to Solution.
The list of available variables in Apigee is here
https://cloud.google.com/apigee/docs/api-platform/reference/variables-reference
It looks like you're using the right variable, however if you're trying to access another variable with AssignVariable, you should either use the <Ref> tag, or to use a message template ie with the curly braces that you have or other message template functions , use the <Template> tag
<Template>{response.status.code}</Template>
or
<Ref>response.status.code</Ref>
There are further examples in the docs
The list of available variables in Apigee is here
https://cloud.google.com/apigee/docs/api-platform/reference/variables-reference
It looks like you're using the right variable, however if you're trying to access another variable with AssignVariable, you should either use the <Ref> tag, or to use a message template ie with the curly braces that you have or other message template functions , use the <Template> tag
<Template>{response.status.code}</Template>
or
<Ref>response.status.code</Ref>
There are further examples in the docs
Thank you, it works fine 🙂