trompamusic / ce-api

The Contributor Environment API for the TROMPA project
https://trompamusic.eu
Apache License 2.0
6 stars 1 forks source link

allow OPTIONS on json-ld API #176

Closed alastair closed 3 years ago

alastair commented 3 years ago

linked data clients use OPTIONS to see what kind of operations that they can do on a server. Because the json-ld export in the CE is read-only, we should implement OPTIONS that returns:

HTTP/1.1 204 No Content
Allow: OPTIONS, GET

so that clients know that they cannot write to the CE.

musicog commented 3 years ago

N.b. "Allow" is a header. See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Allow and https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS

ChristiaanScheermeijer commented 3 years ago

@alastair @musicog the Allow header should only be set when a wrong request method is being used. We do support POST requests for GraphQL requests. Should this restriction only be made for the /:identifier route?

alastair commented 3 years ago

From what I understand I think that we should do:

OPTIONS /:identifier -> return Allow: OPTIONS, GET GET /:identifier -> return data (optionally add Allow: OPTIONS, GET) POST /:identifier -> return method not allowed (optional add Allow: OPTIONS, GET)

I'm not sure if Allow: should also be included in the GET and POST methods, however the header should only appear in the /:identifier route