0

I am performing API testing using Jmeter, we have a API request which require authentication.

When I make a call http://localhost:3001/city/latitude/longitude (GET method) it returns User is not authorized. And to get authorization you require to call http://localhost:3001/user (POST method) passing username in json format.

So, how can I make a authorized call on http://localhost:3001/city/latitude/longitude

2

Depending on what kind of "authorization" you get by sending POST request to http://localhost:3001/user it might be:

  • some "token" which you need to add to request body
  • some Header which contains authorization data.
  • some Cookie which indicates whether user is authorized or not.

So in any case you need to design your test as follows:

  1. POST request to /user
    • Extract authorization bearer
  2. GET request to /city/lat/lon which has either token or authentication passed via HTTP Header Manager or HTTP Cookie Manager

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.