1

How can I send https request with access token in JMeter? I get access token from another API. I am getting 403 forbidden response. When I run same API call using postman, it works (I need to have an active session). Is this why I am getting 403 error?

Here is a sample request screenshot:

https request

2

Given you are testing an API my expectation is that you should build your request a little bit differently, to wit:

  1. Instead of passing request data in form of parameters you need to switch to "Body Data" tab of the HTTP Request sampler
  2. Your data needs to be in JSON format like:

    JMeter JSON Payload

  3. You will also need to add HTTP Header Manager to send Content-Type header with the value of application/json

More information: REST API Testing - How to Do it Right


Also be aware that you can record requests from Postman using JMeter's HTTP(S) Test Script Recorder, all you need is to just "tell" Postman to use JMeter as a proxy like:

C:\Users\your_user_name_here\AppData\Local\Postman\app-x.x.x\Postman.exe --proxy-server=localhost:8888 

See How to configure Postman Native Client App to use an external proxy for details.

0

If you want to pass the authorization token as a header you just need to add a HTTP Header Manager config element in the HTTP Request Sampler. You can then pass the Authorization token value in the same manner as you do when you hit the api via a rest client like POSTMAN!

In-case you get the token as a response from another api and you want to simulate that as well. Then the api that gives the token in response need to precede and you need to extract the token received in the response into a variable that you'll pass in the subsequent requests. You can extract the token using a Regular Expression Extractor post processor, Thanks!

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.