How to fix error 422 Unprocessable Entity in Jmeter? - jmeter

I am trying to create a Student and Teacher profiles while using Jmeter. So i am placing a POST http request in Jmeter getting Response code: 422, Response Message: unprocessable entity error. But the same requests are getting success in Postman.
here is the POST request
Student: {"mobile_country":"60","mobile_number":"189557840","name":"Reddy","email":"reddy#gmail.com","gender":"male","enrollment_date":"2022-09-01","description":"social teacher"}
Please help me, how to resolve this issue. Thanks in advance

As per 422 Unprocessable Entity error description:
The HyperText Transfer Protocol (HTTP) 422 Unprocessable Entity response status code indicates that the server understands the content type of the request entity, and the syntax of the request entity is correct, but it was unable to process the contained instructions
so unless your server is lying it means that there is a problem with your request payload.
Given the request is "getting success" in Postman and not "getting success" in JMeter it means that you're not sending the same request. I'd recommend using an external sniffer tool like Fiddler or Wireshark to inspect requests from Postman and JMeter, identify the differences and amend your JMeter configuration to match Postman with 100% accuracy.
If you cannot figure what is the inconsistency just record the request using JMeter's Proxy Server
Prepare JMeter for recording. Start HTTP(S) Test Script Recorder from the recording template.
Prepare Postman for Recording
Import JMeter certificate to Postman
Configure Postman to use JMeter as the proxy
Run your request in Postman
JMeter will generate the appropriate HTTP Request sampler and HTTP Header Manager

Related

Jmeter: Syntax error while sending a http delete request

We are sending a HTTP DELETE request from JMeter, but getting syntax error (Error 400 Bad request),
Request url: https://somewebsite.org/Acctid/123?AcctId=123
"AcctId=123" is in Query Parameter.
We have no specific headers except for the Cookie and Accept. No content-encoding.
The same request works perfectly fine from Postman.
Any suggestions what could be wrong with our request?
Best!
We cannot tell you what's wrong without seeing your Postman and JMeter configurations.
If the request works in Postman and doesn't in JMeter you could just record it using JMeter's HTTP(S) Test Script Recorder.
Start JMeter's HTTP(S) Test Script Recorder
Import JMeter's certificate into Postman
Configure Postman to use JMeter as the proxy
Run your request in Postman.
That's it, JMeter should generate proper HTTP Request sampler and HTTP Header Manager and you should be able to replay the request.

How to fix response issue in jmeter

After adding some data from csv file getting 415 status code in jmeter response. I am getting success in postman for same payload which is present in jmeter sample request header. But in jmeter it's showing error. Error is "{"type":"https://tools.ietf.org/html/rfc7231#section-6.5.13","title":"Unsupported Media Type","status":415,"traceId":"|fc0a70d2-46g24ac7bc010330.fc0a10d3_c9c4264_"}". I configured all the things properly. Please guide me how to fix that issue
You didn't configure at least "one thing" property: HTTP Header Manager. Add it to your Test Plan and set it up to send the same "Content-Type" header as Postman does
Most probably the value should be application/json
Also be aware that if you can successfully execute the request using Postman you can just record the request execution using JMeter's HTTP(S) Test Script Recorder.

Sales force application load testing using JMeter, one of the requests has got response of invalid JSON message

We are using JMeter for salesforce application performance testing and the request information is sent using parameters and one of the parameters holds the Json message and when we execute the request we are getting as
/{"event":{"descriptor":"markup://aura:systemError","attributes":{"values":{"message":"[AuraClientInputException from server] Unexpected request input. Expected input format: "Data in a request must be a valid JSON Object and must be in the expected format."."}}
when i have validated the request using Json format validator it is valid json however when take the request sent from the view result tree it is not a valid json, something went wrong or JMeter has modified the message. anybody has faced this issue any solution is appreciated.
It's hard to say anything without seeing your HTTP Request sampler configuration
Normally if you add your JSON to the "Body Data" tab of the HTTP Request sampler:
and add a HTTP Header Manager configured to send Content-Type header with the value of application/json
the request should reach the server "as it is"
If you have doubts whether your JMeter setup is correct you can just record the relevant request using JMeter's HTTP(S) Test Script Recorder

Post Request getting failed due to webkitformboundary in JMeter

We have a recorded script using Blaze Meter(HTTPS call) and run in JMeter, One POST request getting failed and shows "500 Internal Server error". In Post request, JSON passed in form of "form-Data" as parameter. When endpoint executed we observed Webkitformbounday in HTTP header, Please give some solution for
HTTPs Request
HTTP Header Manager
POST Request Body
enter image description here
It looks like the recording solution you're using isn't very suitable for building proper HTTP POST request, I would suggest the following amendments:
Untick Use multipart/form-data box in the HTTP Request sampler
Remove issueDetail parameter name and put it to the end of "path"
Change Content-Type header value to application/json
Authorization header value might need to be correlated if the token life span is short
More information: Testing SOAP/REST Web Services Using JMeter

403 forbidden error in jmeter but api works fine in postman

I have an API that is running in GET method. It works fine in postman with 200 status code. But when I try to run the API in jmeter it throws 403 forbidden error. I have configured the debug sampler and tried to re-run the test. The debug sampler passed with 200 but http request still fails.
I have tried to correlate but even that fails.
I removed the port number from the HTTP request, it still fails.
I have added the authorization manager and enter the username and password still fails.
HTTP cookie manager and cache manager added in the script.
As per HTTP Status Code 403 description
The HTTP 403 Forbidden client error status response code indicates that the server understood the request but refuses to authorize it.
This status is similar to 401, but in this case, re-authenticating will make no difference. The access is permanently forbidden and tied to the application logic, such as insufficient rights to a resource.
Most probably you have inconsistencies between requests originated from Postman and from JMeter.
There are 2 possible causes:
You failed to configure JMeter's HTTP Request sampler properly. Given your request works fine in Postman you can try to record it using JMeter's HTTP(S) Test Script Recorder
Prepare JMeter for recording. The easiest way is going for JMeter Templates Feature
From JMeter's main menu choose File -> Templates -> Recording and click "Create"
Open HTTP(S) Test Script Recorder and click "Start"
Prepare Postman for recording.
On Settings page set proxy host to 127.0.0.1 and port to 8888
Execute the request in Postman
JMeter will capture the request and store it under the Recording Controller
Postman uses specific Authorization header which cannot be recorded and replayed. Look into Authorization tab for the request and check which one is used, once you figure out - implement the same in JMeter:
Status Code 403 means you are not authorized to access it, so Ensure you are using the right Authorization for your GET call.
Add cookie manager in jmeter http sampler.

Resources