I'm using the Azure API management, and I have the following response stored in this variable
<set-variable name="externalAPIResponse" value="@((IResponse)context.Variables["response"])" />
The response, has the following structure :
"value": {
"status": {
"code": 400,
"reason": "Bad Request"
},
...
}
I'm struggling to access the status code from this variable, in order to take further decisions based on the value.
@{
var response = JObject.Parse((IResponse)context.Variables["response"]);
string code = response?['value']?['status']?['code'];
return code;
}