ReST API和URI中实体的顺序
UC 1:
获取过去60 0到90天或365天内为给定customerId执行的服务列表。
如何定义uri;应该首先在uri,Customer或ContactInfo中指定哪个实体?
www.example.com/operations/customers/{CustomerId}/services?noOfDaysInPast=60
www.example.com/operations/services/customers/{customerId}?noOfDaysInPast=60
www.example.com/operations/services/{customerId}?noOfDaysInPast=60
www.example.com/operations/services/?customerId=12345&noOfDaysInPast=60
UC 2:
获取给定customerid的联系信息(contantInfo = name + Service Address)
如何定义uri 应该首先在uri,Customer或ContactInfo中指定哪个实体?
www.example.com/operations/customers/{CustomerId}/contactInfo?addressType=SERVICE
www.example.com/operations/contactInfo/customers/{customerId}?addressType=SERVICE
答案 0 :(得分:0)
获取过去60 0到90天或365天内为给定customerId执行的服务列表。
让我们分步看一下:
获取服务列表
www.example.com/operations/services
为给定的customerId执行
www.example.com/operations/services/?customerId=12345
过去60天
www.example.com/operations/services/?customerId=12345&noOfDaysInPast=60
你去。