ArrchanaMohan
ArrchanaMohan

Reputation: 2576

Is there any way to find the request payload structure by using end point URL in REST

I have end point URL, and sample JSON request payload, when I tried to hit(POST) the end point URL through postman it's responding back that the Username field is missing in request payload. But the same request payload is working fine with our internal tool which is used to call the same end-point URL. Even though I set the basic authentication in postman, but still observed the same error message.

Is there any way to identify the sample request payload by using end point URL? or any other way to identify the root cause for this issue and what would be the fix?

Upvotes: 0

Views: 6122

Answers (4)

A.Joly
A.Joly

Reputation: 2387

if you want to see the request payload, you may have a look at this in paragraph "Request/response related properties" You can check headers, data, url etc. by doing ie.

console.log(request.data)

Upvotes: 1

oziomajnr
oziomajnr

Reputation: 1751

postman request body

Since you are using a post request to pass the username and password to the api you have to specify it as a post body, and the picture above shows how to do that with postman.

Upvotes: 0

Abhay Bh
Abhay Bh

Reputation: 132

As you mentioned in your Question that your URL is responding back that the

'Username' field is missing in request payload

And, it is working fine with your internal tool to hit the same URL, I recommend you should check the Payload which you are sending in your POST Request.

As per the error response obtained, you are not sending 'Username' in your payload which is necessary for the POST Request to complete.

I'd recommend you to check once again:

  1. The Payload that your are sending via POSTMAN and compare that payload to the one you send through your internal tool.
  2. Also, check if some additional Headers are being sent by your internal tool in the POST Request which you might be missing to send via POSTMAN.

Upvotes: 1

Catchwa
Catchwa

Reputation: 5865

RESTful web services aren't like SOAP ones where you can grab the WSDL and be (almost certainly!) sure about the expected inputs and outputs. Documenting the request/response structure of a RESTful web service is entirely up to the vendor/maintainer (see Should a RESTful API have a schema?).

If you're 100% sure that you're using Postman correctly, I'd suggest:

  1. Using a tool like Wireshark to look at what's getting sent over the wire
  2. Using curl or another tool as a second (third?) opinion on the matter

Upvotes: 1

Related Questions