cancel
Showing results for 
Search instead for 
Did you mean: 

how to mention JSON body in GET rest API

swetakumar
Occasional Contributor

how to mention JSON body in GET rest API

I am trying to find how to mention JSON body in GET rest API, but not successful. There are no parameters in the REST api request, just the JSON body. 

Postman_GET-RESTrequest qith JSON body.png

I can easily do it in Postman but struggling to find it in SoapUI pro or SoapUI. Attached the screenshot from Postman for the reference. 

6 REPLIES 6
PrathapR
Frequent Contributor

Re: how to mention JSON body in GET rest API

Hey @swetakumar 

 

I don't think we can add request body for "GET". It should not have body by the definition, It should fetch data by using Query, Path parameters and Headers.

 

If we have to pass request body,  need to add your REST resource(end point) as "POST" (If it's POST), then will see window to add request body.

 

PrathapR_0-1609354736184.png

 

Thanks!

richie
Community Hero

Re: how to mention JSON body in GET rest API

Hi @swetakumar,

The reason why it appears you can submit a payload in a GET request in Postman is cos theres no context relative to the method selected in Postman whereas there is in soapui/soapui pro/readyapi!

The RFCs that describe http methods are vague in places but are clear on this point that they dont expect payloads to be submitted using GET. If you want to retrieve data and pass a payload the RFCs suggest using POST instead.

However, if you have the licensed version of soapui pro or readyapi you can make a config update to enable a payload field to appear for the GET method. There was another post recently where someone else asked the same question and one of the SmartBear staff respondef with the config entry change (i think it goes in the vmoptions file).

The config change does NOT work for open source soapui but does work for pro/readyapi version according to what the SB staff memner stated in the post. If you have a search you should be able to find it.

Ta

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
swetakumar
Occasional Contributor

Re: how to mention JSON body in GET rest API

I figured it out another solution. I can add a JSON body as a parameter in the value field with the Type 'Plain'. 

richie
Community Hero

Re: how to mention JSON body in GET rest API

Hey @swetakumar,

Can you just explain what youve done please, cos you say youve managed to add a json body as a parameter type using the PLAIN option, but that isnt how that functionality works at all.

Setting a parm to PLAIN (from one of the other options stops the parm appearing in your request) it shouldnt support adding a payload to a parm in the request at all.

Ta

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
swetakumar
Occasional Contributor

Re: how to mention JSON body in GET rest API

I have attached the screenshot for your reference.

ChrisAdams
Community Leader

Re: how to mention JSON body in GET rest API

Hi,

 

This doesn't add it into the body.  That 'builder' creates the params to add at the end of the url for the GET reuqest.

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors