rest - RESTful API design: reasonable to accept unique identifiers rather than resource URIs? -


are there disadvantages allowing restful api accept representation implicit link resource?

to illustrate this, take have 2 resources:

get /people/:id /houses/:id 

a person has unique identifier in addition id, email.

are there disadvantages allowing following interaction?

post /houses {     "_links": {         "owner": {             "email": "example@example.com"         }     },     "street_number": 20 } 

the server know email field unique, , therefore can used identify people resource. create association person.

the reason allow make easier on api client, don't have first uri of resource.

in contrast, allow type of call:

post /houses {     "_links": {         "owner": {             "href": "/people/3"         }     },     "street_number": 20 } 

the common sense should drive here. if in business model user has unique email, there no drawback me.


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -