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

API responses don't include version information #20

Closed
jackdos opened this issue Aug 4, 2021 · 4 comments
Closed

API responses don't include version information #20

jackdos opened this issue Aug 4, 2021 · 4 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@jackdos
Copy link
Collaborator

jackdos commented Aug 4, 2021

As a consumer of the API, I want to know what version of the API/Schema the endpoint is implementing, so that I know how to marshall the response and what further queries, filters, etc are possible.

@jackdos jackdos added the enhancement New feature or request label Sep 2, 2021
@jackdos
Copy link
Collaborator Author

jackdos commented May 4, 2022

Options:

  1. Put the version in the http response header
  2. Put the version in the http response body
  3. Have a separate endpoint for querying version

Could we/would we want to support version negotiation?

@carlwilson carlwilson added this to the v1.3.0 milestone May 4, 2023
@carlwilson
Copy link
Member

This one's important for 1.3 IMO, I'd vote for the HTTP header implementation, it's simple and in every response automagically. A "cheap" HEAD request will get you the info you want then.

@carlwilson carlwilson self-assigned this Aug 2, 2023
@carlwilson
Copy link
Member

Letting people know the API version they are using is the first aim here. For that, I would suggest a custom HTTP response header that advertises the default version supported, e.g. PAR-Default-Version: 1.3 in the header. A quick HTTP HEAD request could then establish the version. There would be no way of knowing the version used for a URL as that information is in the header. ALL PAR response messages should contain a version attribute somewhere so that it's clear when looking at responses.

This would NOT be enough to support version negotiation. Support that through HTTP headers feels potentially clunky, but the following might work.

  • advertise the available versions in a second HTTP response header list, e.g. PAR-Available-Versions: 1.3; 1.2; 1.1`;
  • support negotiation via an HTTP request header, e.g. PAR-Version: 1.2; and
  • add a custom HTTP response in case the requested version is unavailable.

This would still leave some implementation details for endpoints to support different versions, as the incoming request header would have to be checked, and the appropriate routing would have to be done behind the scenes.

@carlwilson
Copy link
Member

API HEADER definition: Closed by #75

See openpreserve/par-wikidp#1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants