0

I have a question. For a rest service API designing, we can have a post method with parameters. There are four places to put my parameters.

1, we can pass it as URI template, I think if the variable is a resource, we have to put it there. 2, we can put it to the header of the request, I guess "version" is a good choice. 3, we can put it to the post request body, I mean the real parameters we want to execute the method on server. 4, we can put it as a query string, such as /sample.com/orders?id=1025.

In my mind, the post and put is not suggest to put parameters in the query string as my fourth point indicated, I cannot remember where I got that, or I might misunderstand it. Please correct me if I'm wrong, and let me know how do you think about this.

Thanks,

Howard
  • 3,638
  • 4
  • 32
  • 39
  • Does this answer your question? "[REST API Best practices: Where to put parameters?](//stackoverflow.com/q/4024271/90527)", "[Restful URLs with data in query string or request body?](//stackoverflow.com/q/1619302/90527)" – outis Dec 24 '21 at 15:02

1 Answers1

0

I think I already figureout what I asked. Here is a related post, please refer that if anymore needs it. Do HTTP POST methods send data as a QueryString?

Thanks,

Community
  • 1
  • 1
Howard
  • 3,638
  • 4
  • 32
  • 39