1
votes

I'm quite new on the JMeter, I'm writing tests for an api what is in JSON and I cannot figure out how to post an request what uses the parameters in URL. Posting body data works fine.

As I send the request, I get Required String parameter 'dataType' is not present error. When I post the URL to my web browser, the link works.

And some pictures of the request:

I cannot add more than 2 links at the moment, but the full error in response data:

This application has no explicit mapping for /error, so you are seeing this as a fallback.
Fri Oct 24 06:10:07 EDT 2014
There was an unexpected error (type=Bad Request, status=400).
Required String parameter 'dataType' is not present
1
try encoding the json/parameters, it may be ignoring the entire line if it cannot interpret all parts? - CharlieS
Same problem with encoding - M2dis
try implementation httpclient4, java has some limitations, but not sure if this is one.. Your config looks ok, can you access the logs of the server application to see how the post is being received? several of your parameters contain characters that can be misinterpreted if not encoded, hence my previous suggestion - CharlieS
I assume there can be 2 reasons why this is not working. 1. multiple content-type, you are not passing only JSON as parameters. 2. did you try by passing "utf-8" in "content-encoding" field & check "Encode?" for JSON parameter. - Zubair M Hamdani
Okay, I got the data parameter name there before what shouldn't have been in the request. Edited the first screenshot as it is at the moment and still same problem. The last row should be handled as body data. I got it working when I filled the path with the parameters in the "utf-8" encoding and submitted only body data(the last row). I still would like to know if there is any way to get the first method working? - M2dis

1 Answers

0
votes

Your request is not correctly configured, it should look like this:

Configuration

Otherwise it's not JSON.