I have a web scenario where I want to
1. Send a POST and retrieve JSON with a token.
2. Use that token in the next step in the header to then make a POST and get more JSON
I am able to make the first POST though I don't know if I am creating the variable correctly.

The resulting JSON looks like:
Then I am trying to use the token in the header but I get a 401 so clearly it doesn't work.

An example in cURL of what does work
Any ideas?
1. Send a POST and retrieve JSON with a token.
2. Use that token in the next step in the header to then make a POST and get more JSON
I am able to make the first POST though I don't know if I am creating the variable correctly.
The resulting JSON looks like:
Code:
{
"ageS": 1,
"expiresInS": 2591999,
"token": "SOMESUPERLONGTOKE123673528792475",
"username": "admin"
}
Then I am trying to use the token in the header but I get a 401 so clearly it doesn't work.
An example in cURL of what does work
Code:
curl -k --header "Content-Type: application/json" \
--request POST \
--data '{"username":"admin","password":"somepassword","setCookie": true}' \
https://10.10.10.214:7001/rest/v2/login/sessions
Code:
curl -s -k -H "Authorization: Bearer somelongtoken1278136487613784"\ 'https://10.10.10.214:7001/api/doCameraDiagnosticsStep?cameraId=fb680f2e-14cf-dc86-721f-f8d6958b4fa1&type=cameraAvailability'