Maybe I'm being dense, but is it common practice to create an API which requires users to submit GET params as an object? I've encountered one which has me submitting GET requests like...

http://www.example.com/?ip={keyOne: "ValueOne", keyTwo: "ValueTwo"}

I find this makes using Postman with the endpoint pretty difficult. Is this a simple pattern I'm not familiar with?


It is pretty weird.Is there something stopping you from using query params?


That solves the problem if you only need to send strings or easily parsable values and is the standard way to send multiple simple values directly in the URL of your endpoint. In Postman, you can then easily edit your query params using the UI since it splits them up nicely.

If you need to receive a complex object or an array of values from the user, you're better off receiving the JSON in the body of your request, since nested keys in your JSON object would be thougher to encode in query params.

| improve this answer | |
  • Yeah, I'm using someone else's API so I cannot use query params as you have here. :( – Qfwfq Oct 15 '19 at 16:14
  • 1
    I see, then it's quite a peculiar choice. One reason might be to be compliant with an old definition of a GET request, which disallowed information in the body of the request. See this great answer on StackOverflow if you want to learn more : stackoverflow.com/a/983458/11292450 – Kawemi Oct 15 '19 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.