Rest Standard: Path parameters or Request parameters

前端 未结 6 1529
孤独总比滥情好
孤独总比滥情好 2020-11-29 23:53

I am creating a new REST service.

What is the standard for passing parameters to REST services. From different REST implementations in Java, you can configure param

6条回答
  •  清歌不尽
    2020-11-30 00:29

    I think it depends. One URL for one resource. If you want to receive that resource in a slightly different way, give it a query string. But for a value that would deliver a different resource, put it in the path.

    So in your example, the variable's value is directly related to the resource being returned. So it makes more sense in the path.

提交回复
热议问题