belgif / rest-guide

REST Guidelines of Belgian government institutions
https://www.belgif.be/specification/rest/api-guide/
Apache License 2.0
24 stars 4 forks source link

Make self links optional #112

Closed pvdbosch closed 1 year ago

pvdbosch commented 1 year ago

Propose to make "self" links OPTIONAL ("MAY") instead of RECOMMENDED ("SHOULD").

Current guideline: Each resource SHOULD also contain its own location in a self attribute at root level of the JSON document.

Self links don't seem frequently provided by APIs however, nor used that much. They also require a modification in the code on each provided resource.

JDMKSZ commented 1 year ago

I don't know if it's relevant to make a distinction between different scenario's?

pvdbosch commented 1 year ago

The response of a resource created using a POST on a collection resource should have a Location HTTP header that points to the newly created resource, so also not really needed there.

If using "self" in this case, the guide isn't very clear that it should be the URL of the collection resource or the one of the new resource. In the long-running task example, the collection resource URL is specified.

pvdbosch commented 1 year ago

WG is in full agreement to make optional

pvdbosch commented 1 year ago

new version of guide is published with the change