Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redirection of POST /services and /jobs #269

Closed
soxofaan opened this issue Apr 10, 2020 · 7 comments · Fixed by #270
Closed

redirection of POST /services and /jobs #269

soxofaan opened this issue Apr 10, 2020 · 7 comments · Fixed by #270

Comments

@soxofaan
Copy link
Member

from current API 1.0 docs about response on POST /jobs and POST /services:

201 The resource has been created successfully and the location of the newly created resource is advertized by the back-end.
Examples:

  • POST /services redirects to GET /services/{service_id}
  • POST /jobs redirects to GET /jobs/{job_id}
    Headers:
  • Location: example Example: "https://openeo.org/api/v1.0/resource/123" URL to the newly created resource.

This is a bit confusing:

  • The usage of "redirects" seems to suggest that backend should use a 3xx HTTP redirect (also note the "Location" header, which is classic 3xx), while it should be a "non-redirecting" 201
  • the examples are also completely different and make it harder to connect the dots:
    -- above: /services/{service_id} and /jobs/{job_id}
    -- below: https://openeo.org/api/v1.0/resource/123
@soxofaan
Copy link
Member Author

Screenshot from 2020-04-10 14-41-08

@m-mohr
Copy link
Member

m-mohr commented Apr 10, 2020

Location is also applicable for HTTP 201, see https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201. Is tells the back-end where the new resource can be found.

Indeed the examples are a bit misleading. The green area should better say "Mapping" instead of "Examples" and "points to" instead of "redirects to". The intentions was to show which endpoint should point to which resource. I'll fix that.

Does that help, @soxofaan ?

@soxofaan
Copy link
Member Author

I would certainly avoid "redirect"

but the difference between the examples is still confusing:

  • in the green area you have relative paths (with a HTTP verb "GET")
  • in the example under "Location" it's an absolute url with this word "resource" in it (not obvious that this should be replaced with "services" or "jobs")

What is also not that obvious (or explicit) is that this "Location" url should be the "full metadata" endpoint. For example, I think in the VITO backend we return the WMTS base url here instead of the service metadata endpoint, which is wrong if I understand correctly

@soxofaan
Copy link
Member Author

Can't you just move all examples to the "Location" header doc

e.g. something like:

Location:

@m-mohr
Copy link
Member

m-mohr commented Apr 10, 2020

In the green area I am refering to the endpoints as defined in the OpenAPI file, the Location example is as concrete as possible with re-usable templates. So indeed it's meant to point to the metadata. Nevertheless, I'll issue a PR later and let you review.

@m-mohr
Copy link
Member

m-mohr commented Apr 14, 2020

Please review PR #269, @soxofaan. I tried to make it very clear now and actually splitted up the common definition into two parts.

@soxofaan
Copy link
Member Author

great, thanks

@m-mohr m-mohr closed this as completed Apr 14, 2020
soxofaan added a commit to soxofaan/openeo-python-driver that referenced this issue Apr 15, 2020
…iance

Also fix location header of 'POST /services' endpoint (Open-EO/openeo-api#269)
soxofaan added a commit to Open-EO/openeo-python-driver that referenced this issue Apr 15, 2020
Introduce a `ServiceMetadata` class to wrap service metadata in a
container with stronger schema/typing than free form dict.

Also fix "Location" header in 'POST /services' response (Open-EO/openeo-api#269):
should be service metadata endpoint, not service (base) url.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants