NatLibFi / voyager-http-api

RESTful HTTP API for Voyager ILS
Apache License 2.0
0 stars 0 forks source link

Return created resource ID #4

Open natlibfi-arlehiko opened 7 years ago

natlibfi-arlehiko commented 7 years ago

Creating a new bibliographic record calling POST /bib returns 201 Created and sets the Location response header to point to the newly created resource.

To know the ID of the newly created resource the client must either parse the ID from the URL set in the Location header or call GET /bib/ and parse the ID from the data.

Suggested implementation

Write the ID of the newly created resource to Resource-ID header.

petuomin commented 7 years ago

This seems like a good idea. It avoids the extra reads in case the newly created record is not needed.

Perhaps the header name should be just Resource-ID. Just in case the same API design will be implemented for Aleph etc. also.

natlibfi-arlehiko commented 7 years ago

Good point. Modified the "spec" above.