The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
David Fischer
Community Champion
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)
}}
TAGS
AUG Leaders

Atlassian Community Events