25

I have an API which accepts many parameters. Passing the values of the parameters will exceed the length of the URL Header.

I am using Postman client to pass the parameters in the body but this is not working any ideas on how to make this work.

The API accepts many parameters because the backend is legacy and is exposed as an API by a service bus.

Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122
jhon.smith
  • 1,963
  • 6
  • 30
  • 56

5 Answers5

27

Older versions of Postman didn't allow you to send body data with get request.

Yet, if your server receives data as URL parameters you won't be able just to change the way of sending them and include them to the body (server won't accept them).

So if the length of parameters is indeed so big and the server indeed can receive the same data from body instead of from parameters then the Postman is just not the tool that you can use (maybe cURL is for you).

If your server allows to send data only as URL parameters and they are so long (more then 2000 chars What is the maximum length of a URL in different browsers?) then I think you have no chances to test this API.

UPDATE: new Version 7.20.1 now allows to send Body with GET request

Denis Koreyba
  • 3,144
  • 1
  • 31
  • 49
  • Brilliant Answer can you please add how to do this in curl for future reference of API challenged folks like me :) – jhon.smith Feb 06 '17 at 17:18
  • Thanks:) Unfortunately I don't know cURL very well. I need to google it to give you an answer. Tell me what you want to do: to pass something in body of GET request or just to use cURL to pass params in URL? You can generate cURL code in Postman! Another languages are also available here. – Denis Koreyba Feb 06 '17 at 17:26
  • 1
    I can google and get the answer.The reason i wanted you to google it and paste the answer would be to help others like me.A simple curl command to pass the parameters in the body not in the url would make the answer better for many others. – jhon.smith Feb 06 '17 at 17:56
  • The thing is cURL is one of tools that can do it. But it's not connected to Postman at all. – Denis Koreyba Feb 07 '17 at 09:28
  • 2
    Curl example ... I came across this while trying to use an example from Elasticsearch in Postman - see here: https://www.elastic.co/guide/en/elasticsearch/reference/2.0/indices-analyze.html The specifics: `curl -XGET 'localhost:9200/test/_analyze' -d ' { "text" : "this is a test" }'` – mistertee Apr 28 '17 at 14:26
  • Fiddler lets you do this. It lights up the body in red but it works. – Paul Speranza Oct 05 '17 at 14:08
19

Workaround:

  1. Change the request type to POST.
  2. Set the value of your body
  3. Change request type to GET
  4. Send request and the body is included
Steve Mullin
  • 207
  • 2
  • 2
  • 1
    Simply make a POST request instead of GET works for me too: https://github.com/postmanlabs/postman-app-support/issues/131 – shiouming Aug 27 '18 at 04:24
  • You answer solved my other problem ,I was getting unsupported media for get type, and I changed to application json after following your steps. :) – Pritish Jan 25 '21 at 19:41
7

Postman is already added this feature of sending body in get request.

enter image description here

But i still i recommended to go for post request (if body is present) since many projects like angular http client does't have updated protocols yet.

Rahul Uttarkar
  • 3,367
  • 3
  • 35
  • 40
0

Latest Postman supports body object for Get request enter image description here

just choose json format as shown in pic above

Badr Bellaj
  • 11,560
  • 2
  • 43
  • 44
0

If you want to make a GET request in Postman then you can use Params or Body to pass parameters, but not both. Either Params only or Body only. If you specify both Params and Body, Postman will select and send only Params (in GET request of course). So if you want it to send Body, clear Params.