0

I am trying to create Student and Teacher profiles while using Jmeter. So I am submitting a POST HTTP request in Jmeter getting

Response code: 422, Response Message: unprocessable entity error

But the same requests are succeeding in Postman.

Here is the POST request for 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

Aiden Cullo
  • 312
  • 3
  • 15

1 Answers1

0

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

  1. Prepare JMeter for recording. Start HTTP(S) Test Script Recorder from the recording template.

    enter image description here

  2. Prepare Postman for Recording

  3. Run your request in Postman

  4. JMeter will generate the appropriate HTTP Request sampler and HTTP Header Manager

    enter image description here

Dmitri T
  • 159,985
  • 5
  • 83
  • 133