I am using post call on json API, the request is -
The API I used in HTTP Sampler is -
<API>/api/customers/
On running the test I get following under "Request" tab of "View Results
Tree" -
################################################################
POST <API>/api/customers/42
POST data:
{
"customer_number": "42",
"email": "[email protected]",
"encrypted_password": "z3cr37",
"enabled": true
}
[no cookies]
Request Headers:
Content-Length: 129
Connection: keep-alive
Content-Type: application/json
################################################################
Notice that path is changed to <API>/api/customers/42 even though I only
have <API>/api/customers/ in the sampler.
And the "Response" tab of "View Result Tree" gets me -
################################################################
{"type":"about:blank","title":"Method Not
Allowed","status":"METHOD_NOT_ALLOWED","detail":"Request method 'GET' not
supported"}
################################################################
To debug more, I removed - "customer_number": "42", from data as this gets
added to API URL and now I get the expected error that "customer_number"
field is missing -
################################################################
{"type":"about:blank","title":"Bad
Request","status":"BAD_REQUEST","detail":"Missing fields:
[customer_number]"}
################################################################
Did I miss anything here?
I am using JMeter 2.13
By the way, I can use curl format as specified here to call the API -
http://stackoverflow.com/questions/7172784/how-to-post-json-data-with-curl-from-terminal-commandline-to-test-spring-rest