REST APIs: custom HTTP headers vs URL parameters

后端 未结 8 1248
太阳男子
太阳男子 2020-12-12 11:41

When do you use custom HTTP headers in the request part of a REST API ?

Example:

Would you ever use

GET /orders/view 
(custom HTTP header)          


        
8条回答
  •  眼角桃花
    2020-12-12 12:11

    There is no standard for REST however the accepted way would be

    GET /orders/view/23
    

    Not using the custom headers and hence the 23 after view assumes to be the id hence you would have a function that takes in the id and hence produces just that information.

提交回复
热议问题