Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Using RestAPI Post Functions in jmwe

Jonathan Towles June 3, 2021

To integrate with the Microsoft Graph API, we need to first get an access token.

Can we store the result of one REST call in a variable to be used on a second REST call?

1 answer

1 accepted

0 votes
Answer accepted
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 3, 2021

Hi @Jonathan Towles 

I didn't test this code, as it would require getting an account on the Microsoft Graph platform, but something like this should work:

{%set token = "https://login.microsoftonline.com/TENANT/oauth2/v2.0/token" | callRest(
verb="post",
options= {
form:{
client_id:"CLIENT_ID",
scope:"https://graph.microsoft.com/mail.read",
refresh_token: "REFRESH_TOKEN",
grant_type: "refresh_token",
client_secret: "CLIENT_SECRET"
}
}
) | field("access_token") %}
{{"https://graph.microsoft.com/v1.0/me/" | callRest(
options= {
'auth': {
'bearer': token
}
}
) | dump(2)
}}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events