我有一个类似于以下结构的REST API URL:
/api/contacts GET Returns an array of contacts
/api/contacts/:id GET Returns the contact with id of :id
/api/contacts POST Adds a new contact and return it with an id added
/api/contacts/:id PUT Updates the contact with id of :id
/api/contacts/:id PATCH Partially updates the contact with id of :id
/api/contacts/:id DELETE Deletes the contact with id of :id
我的问题与以下内容有关:
/api/contacts/:id GET
假设除了通过ID获取联系人外,我还想通过唯一别名获取联系人。如果我想通过ID或别名获取联系人,URI结构应该是什么?