cancel
Showing results for 
Search instead for 
Did you mean: 

Body in GET requests

SOLVED
New Contributor

Body in GET requests

Hello! How I can use the body with json-structure in GET requests? I haven't MediaType place on GET requests so I haven't place, which I can use for my request body.

Can I send body in GET response? How I can do it if it's possible?

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: Body in GET requests

Hey @Voropaeva_Kris 

 

Right - all the HTTP and w3c rules around the GET method indicate you don't include a payload with a GET - you filter your GET based on the parameters on the request (URI/Template, Query and occasionally Header parms also).

 

REST rules apparently don't define things as tightly as that - they just indicate use whatever method gets the job done, but as I say a GET request is filtered by the parms - not by a payload.

 

Someone else asked this quite recently on the board.

 

There are certain times that you have to switch the method from a GET to say a POST (if the query parms and values become too lengthy to be encoded) and this would allow you to create a payload with your GET request - cos essentially it wouldn't be a GET anymore - but a POST.

 

Yes Postman does allow you to create a payload for a GET, but that's only because there's less field validation in Postman than SoapUI/ReadyAPI!

 

Including a GET on a payload has always been considered a faux pas in the places I've worked.

 

Are you sure you need to include a payload on yoru GET request?  if I were you, I'd go back to the developers and query why they think you need a payload for a GET as this deviates from all the standard rules around GET requests - see w3c, etc.

 

Hence this is why SoapUI/ReadyAPI! doesn't include any MediaType dropdown for the GET request - it was developed with the understanding you don't include a payload with a GET request, so you don't need to define the type!

 

Thanks,

 

richie

 

 

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 title of the post to something more descriptive? This will help people when searching for problems.
1 REPLY 1
Community Hero

Re: Body in GET requests

Hey @Voropaeva_Kris 

 

Right - all the HTTP and w3c rules around the GET method indicate you don't include a payload with a GET - you filter your GET based on the parameters on the request (URI/Template, Query and occasionally Header parms also).

 

REST rules apparently don't define things as tightly as that - they just indicate use whatever method gets the job done, but as I say a GET request is filtered by the parms - not by a payload.

 

Someone else asked this quite recently on the board.

 

There are certain times that you have to switch the method from a GET to say a POST (if the query parms and values become too lengthy to be encoded) and this would allow you to create a payload with your GET request - cos essentially it wouldn't be a GET anymore - but a POST.

 

Yes Postman does allow you to create a payload for a GET, but that's only because there's less field validation in Postman than SoapUI/ReadyAPI!

 

Including a GET on a payload has always been considered a faux pas in the places I've worked.

 

Are you sure you need to include a payload on yoru GET request?  if I were you, I'd go back to the developers and query why they think you need a payload for a GET as this deviates from all the standard rules around GET requests - see w3c, etc.

 

Hence this is why SoapUI/ReadyAPI! doesn't include any MediaType dropdown for the GET request - it was developed with the understanding you don't include a payload with a GET request, so you don't need to define the type!

 

Thanks,

 

richie

 

 

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 title of the post to something more descriptive? This will help people when searching for problems.
New Here?
Join us and watch the welcome video:
Top Kudoed Authors