【发布时间】:2017-07-12 13:08:52
【问题描述】:
我有两个实体“人员”和“企业”,它们都有一个子资源(例如位置)
所以我有端点:
GET /persons/{id}/locations
GET /businesses/{id}/locations
现在我想要一个端点来过滤主要资源的位置。 如果我这样做:
GET /persons/{id}/locations?country={...}
GET /businesses/{id}/locations?country={...}
我将搜索特定人员/企业的位置。
过滤所有人的位置的最佳做法是什么 我有一些想法:
1. GET /persons/locations?country={...}
2. GET /locations?entity=persons&country={...}
但不确定这些是否正常。
【问题讨论】:
标签: rest api api-design