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
Post a Comment