How to fix response issue in jmeter - 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.

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.

Not able to execute api call for delete through JMeter

I have a delete API http request in Jmeter which is like "serverName/ApplName/api/deleteDataset/{datasetId}"
In the header i have added the below information:
But strangely this api is failing with the below error:
Response code:400
Response message:Bad Request
Please note when i am trying the same API in postmen it is passing without any error. In fact i did not have to pass any header information apart from the access token.
I have tried removing the extra header information(accept,content-type) too from JMeter but that also did not work out.
If your request works fine in Postman the easiest way of replicating it in JMeter would be just recording it using JMeter's HTTP(S) Test Script Recorder
Start the HTTP(S) Test Script Recorder
Import JMeter's certificate into Postman, this way JMeter will be able to intercept and record HTTPS requests
Configure Postman to use JMeter as the proxy so the request to API would go through JMeter
Run your request in Postman
JMeter will generate HTTP Request Sampler and HTTP Header Manager
Correlate bearer token and replace hard-coded value with the appropriate JMeter Variable
You should be able to run the request successfully now

How to fix error 422 Unprocessable Entity in 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

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

Empty response is showing in Jmeter after uploading PDF but in Postman success response showing

Uploaded a doc by adding the following details in the file upload
File path:added the PDF in bin folder
Parameter name : Documentfile
MIME Type: application/json
I am getting empty response but in Postman it is working and getting the success response
There are too many possible ways to upload a file in JMeter and in Postman. Unfortunately we cannot help you with JMeter configuration without seeing how is Postman set up.
The only piece of advice we can provide is that given you're capable of successfully executing the request in Postman you can just record it using JMeter's HTTP(S) Test Script Recorder
Set Postman to use JMeter as the proxy
Import JMeter's certificate into Postman
Copy the file you're uploading to JMeter's "bin" folder
Run your request in Postman
JMeter will intercept the request and generate proper HTTP Request sampler
More information: How to Convert Your Postman API Tests to JMeter for Scaling

Resources