"Post" method test result error in JMeter API testing

1k views Asked by At

I tried to run a POST method for API testing in JMeter, I have sent the parameters as needed, but still it shows cannot post.

What should I do to make it work?

user add post request

response message

2

There are 2 answers

0
AudioBubble On BEST ANSWER

In the post request, you need to provide server name or IP address and port number respectively. If it still doesn't work, try changing the path by adding /api then /user/data. it works in some cases. Hope this works out!

1
Dmitri T On

If you are testing an API my expectation is that you need to send either JSON or XML payload using "Body Data" tab of the HTTP Request sampler.

You will also need HTTP Header Manager to send the relevant Content-Type header

References:

Another way of building a web service test plan is executing the request(s) according to your test scenario using a 3rd-party tool like Postman or SoapUI and recording them via JMeter's HTTP(S) Test Script Recorder.