简体   繁体   English

是否有任何额外的粒度级别标准可以与 RESTful API 一起使用

[英]Are there any additional granular level standards which can be used with RESTful APIs

I'm working on an HR product and we are building RESTful APIs in the backend to make them public for our partners to connect with the product.我正在开发一个 HR 产品,我们正在后端构建 RESTful API,以便将它们公开供我们的合作伙伴连接到该产品。 We are using REST standards as the architectural style for the APIs.我们使用 REST 标准作为 API 的架构风格。

Recently we identified, some of the filter parameters are different than how it should be.最近我们发现,一些过滤器参数与应有的不同。 Ex: In our api/employees endpoint, the date filters were implemented differently.例如:在我们的 api/employees 端点中,日期过滤器的实现方式不同。

  1. Birth Day Filter accepted two array values such as from and to and it'll return employees who are having birth days between those two dates including from date and to date. Birth Day Filter 接受两个数组值,例如 from 和 to,它会返回出生日期在这两个日期之间的员工,包括 from date 和 to date。

filters[birth_day][from] = 2000-01-01 filters[birth_day][to] = 2001-01-01过滤器[生日][从] = 2000-01-01 过滤器[生日][到] = 2001-01-01

  1. Joined Date filter has two separate filters such as joined_date_from and joined_date_to and works similar to the above filter. Joined Date 过滤器有两个独立的过滤器,例如 joined_date_from 和 joined_date_to,其工作方式与上述过滤器类似。

filters[joined_date_from] = 2000-01-01 filters[joined_date_from] = 2001-01-01过滤器[加入日期_起始日期] = 2000-01-01 过滤器[加入日期_起始日期] = 2001-01-01

These type of mismatches are there in pagination and sorting options as well.这些类型的不匹配也存在于分页和排序选项中。

Is there any place which defines detailed level standards for ReSTful APIs which can be considered as industry standards.是否有任何地方定义了可被视为行业标准的 ReSTful API 的详细级别标准。

I recommend 'REST API Design Rulebook' by Mark Masse.我推荐 Mark Masse 的“REST API 设计规则手册”。 It contains a lot of useful info with explanation and examples.它包含许多有用的信息以及解释和示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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