Im currently working with policys in Azure API Management and Im interesting in extracting a value that gets returned from the response-body.
<send-one-way-request mode="new">
<set-url>http://requestb.in/xje199xj</set-url>
<set-method>POST</set-method>
<set-header name="Content-Type" exists-action="override">
<value>application/json</value>
</set-header>
<set-body>@{
//JObject or string?
string response = context.Response.Body.As<string>(preserveContent: true);
//something here..
}
</set-body>
</send-one-way-request>
The response looks like this :
"getBookableResourcesResponse": {
"getBookableResourcesResult": {
"hasError": false,
"errorCode": 0,
"BookableResource": [
{
"resourceCode": "TRA",
"description": "Trailer",
"group": "F",
"subGroup": "C",
"category": "R",
"dialogType": "CARGO",
"orgCode": "DECK",
"length": 14,
"taraWeight": "7000",
"grossWeight": "25001",
"AddResource": [
{
"resourceCode": "EXPFIN",
"description": "Export Finland",
"dialogType": "UNDEFINED",
"amount": "0",
"ticketType": "",
"orgCode": "EXPFIN",
"required": "false"
}.....`
I want to get the value thats being returned from the "resourceCode" attribute, in this case "TRA" and then create a new JObject wich I can send to my Azure function.
{
"resourceCode": "valueFromResponseBody"
}