Important Update: Community URLs redirect issues are partially resolved. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

Request Headers and SessionToken

ChrisJohnson2
Contributor III

Greetings API User group,

Have been working through article 000032481 “How to use the RSA Archer REST API with Windows PowerShell” and the logic is starting to click   I successfully logged in using Windows PowerShell, generated a session token and executed the examples.

 

The part I’m having trouble understanding is how this command attaches the SessionToken to the header?

Based on the attached screenshots can anyone explain what is happening in the background to make this work?

 

Many thanks in advance  

SessionToken.png

Request Header Command.png

1 REPLY 1

Ilya_Khen
Champion III

Session_token is created when you first authenticate to Archer:

$login_url = $base_url + "/api/core/security/login"
$body = '{"InstanceName":"' + $instance_name + '","Username":"' + $username + '","UserDomain":"' + $user_domain + '","Password":"' + $password + '"}'
$response_login = Invoke-RestMethod -Method Post -Uri $login_url -Body $body -ContentType "application/json" -SessionVariable $sess
$session_token = $response_login.RequestedObject.SessionToken

Then you use this session token in the header all the time for the rest of the calls.