Trying to work on REST API calls in Javelin.
Our situation is this, we need to do a POST to get an authorization token, then capture that token and then in a second call use that in the header.
I've looked through the documentation on REST and Javelin and the only example is a GET and we need to use POST.
Also, the XPathValues that was suggested in the GET example also isn't working (I'm wondering if this is the response is coming as json and not xml,
but I can't see the response as it's kept in a variable I don't know how to view).
Could someone assist in helping solve how to get this call to work?
TDM 4.9
Javelin 4.8
To use Bearer authentication you must do the following.
1) Connect to the target and get the Token. This is usually done with Basic authentication.
2) in the response you will get back a Token that needs to be saved to a variable.
-You can use firefox restclient or postman to inspect the response manually to get the Security token field name.
-Most times this is just token but it could be something else such as id_token.
-This string text for the token field is required in Javelin to read the value from the response. If this is wrong you will get an error.
3) On the next call, you remove the basic authentication and set the headers with Authentication bearer and the retrieved token in the Header.
Attached is an example of this.
To use headers you must import the system.Collection.generic and system.collection.objectmodel
see the below KB on creating headers with Javelin;
https://ca-broadcom.wolkenservicedesk.com/external/article?articleId=196930
Bearer Authentication:
https://swagger.io/docs/specification/authentication/bearer-authentication/
curl https://reqbin.com/echo/get/json -H "Accept: application/json" -H "Authorization: Bearer {token}"