Reputation: 10240
i'm trying to get one value of the http response. which looks like this:
"body": {
"token_type": "string",
"expires_in": "number but as string",
"ext_expires_in": "same",
"expires_on": "same",
"not_before": "number but as string",
"resource": "string",
"access_token": "string"
}
i tried this expression in Set a variable: body('parse_JSON')?[variables('access_token')]
which returned this error.
InvalidTemplate. Unable to process template language expressions in action 'Set_Access_Token' inputs at line '0' and column '0': 'The template language expression 'body('Parse_JSON')?[triggerBody()?['access_token']]' cannot be evaluated because property '' cannot be selected. Please see https://aka.ms/logicexpressions for usage details.'.
my workflow looks like this at the moment:
how can i get access_token value?
Upvotes: 0
Views: 5357
Reputation: 8244
This can be done in 2 ways
WAY - 1
You can use Parse JSON
action and extract the required variables which are directly generated. Below is the flow of my logic app.
Json Schema
{
"type": "object",
"properties": {
"body": {
"type": "object",
"properties": {
"token_type": {
"type": "string"
},
"expires_in": {
"type": "string"
},
"ext_expires_in": {
"type": "string"
},
"expires_on": {
"type": "string"
},
"not_before": {
"type": "string"
},
"resource": {
"type": "string"
},
"access_token": {
"type": "string"
}
}
}
}
}
RESULTS:
WAY - 2
You can use the below expression to extract access_token
from the request.
body('Compose_2')?['access_token']
In your case its
body('HTTP_to_Refresh_Fibo')?['access_token']
RESULTS:
Upvotes: 0