Hello, I have two collections and each of them has one reqest that gets authentication token from separate APIs. The first one works great and it returns a Json with 3 properties.
Then I use the new variable “Access_Token” in the authorization tab for other endpoints that require authentication.
The above scenario works great. The second collection is the one I am having issues with. The token endpoint doesn’t return a json token with properties like the above. It just returns the text of the token. The following is the Api token end point
Method: Post
the url is https://Example.api/session/login
Headers:
Accept: application/vnd.v1+json
Content-Type: application/json
Body:
{"UserId": "userid","Password": "xxxxxxxx"}
I don’t know what else you have tried in the script. What was the output in the console for the request body?
It’s going to work in the main request because you’re not sending it via the script, which would have a slightly different structure and most of those things been auto done for you already.
Try adding quotes around the key values?
Try removing the JSON.stringify() the body.
Basically, trial and error. I’m not sat there in front of this so I can only make suggestions of what I might do to solve that situation, I don’t have the ‘solution’