vendredi 10 février 2017

How to better design of Rest URIs

I am stuck in a rest service I am trying to deploy on wildfly 10 which shall expose to client its own company customers entities but also some other customers but by calling external rest service and passing its results. Both ressources are called "customers". There shall be two different paths in uri, one to get own customers, one to get those other customers and users.

How shall the URIs of my rest service look alike in such case? I am not happy with what I came up with so far:

GET localhost\myrestservice_v0\rest\customers
GET localhost\myrestservice_v0\rest\customers\{id}
GET localhost\myrestservice_v0\rest\users
GET localhost\myrestservice_v0\rest\users\{id}
....

GET localhost\myrestservice_v0\rest\externalService\customers
GET localhost\myrestservice_v0\rest\externalService\customers\{1}
GET localhost\myrestservice_v0\rest\externalService\users
....

That externalService path is kinda signaling that the app is using external rest service calls..

Any ideas how to make the uri rest conform?

Aucun commentaire:

Enregistrer un commentaire