简体   繁体   中英

Where is the proper place to post my uri with parameters in rest API designing

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,

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,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM