跳至主要內容
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?

4563博客

全新的繁體中文 WordPress 網站
  • 首頁
  • 请教一个 REST api 设计的问题
未分類
15 5 月 2020

请教一个 REST api 设计的问题

请教一个 REST api 设计的问题

資深大佬 : zivyou 0

各位老哥,我们有一个「预约申请审批」系统,里面有一个管理员角色,他可以审批「预约」,同时,管理员也可以发起「预约」。所以,现在要设计两个接口:
1. 用来展示「我」发起的「预约」;
2. 用来展示和我相关的已经完成了的预约,「和我相关」指的是「我发起的」或者「由我审批」的

目前,1 我用的是 ‘GET /application/my’, 2 我用的是’GET /application/myRelated’,感觉设计的不好。
望各位老哥不吝赐教。

大佬有話說 (3)

  • 資深大佬 : superchijinpeng

    用 fliter 就好了 1: /applications?我申请的=true 2: /applications?我参与的=true

  • 資深大佬 : jerray

    1. /applications?issuer=uid
    2. /applications?related=uid

    不论是我的还是谁的,都是在按照条件做筛选。

  • 資深大佬 : ChanKc

    无所谓

    Roy T Fielding: A REST API must not define fixed resource names or hierarchies (an obvious coupling of client and server). Servers must have the freedom to control their own namespace. Instead, allow servers to instruct clients on how to construct appropriate URIs, such as is done in HTML forms and URI templates, by defining those instructions within media types and link relations. [Failure here implies that clients are assuming a resource structure due to out-of band information, such as a domain-specific standard, which is the data-oriented equivalent to RPC’s functional coupling].

文章導覽

上一篇文章
下一篇文章

AD

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文

51la

4563博客

全新的繁體中文 WordPress 網站
返回頂端
本站採用 WordPress 建置 | 佈景主題採用 GretaThemes 所設計的 Memory
4563博客
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?
在這裡新增小工具