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

Question: how to provide forward compatibility for newer clients? #96

Open
xopr opened this issue Feb 16, 2022 · 1 comment
Open

Question: how to provide forward compatibility for newer clients? #96

xopr opened this issue Feb 16, 2022 · 1 comment

Comments

@xopr
Copy link

xopr commented Feb 16, 2022

Since #56 it is possible to provide a sort of compatibility indication server side, but there is no client side preferred version possible.

We're looking into migrating to newer SpaceAPI versions but our hackerspace makes heavily use of the null/undefined spacestate on the backend where it determines that after n minutes, there is no certain state (internet loss, power failure, building torn down).

We also have multiple implementations of several (embedded) clients that reflect the v.013 state, so upgrading to the future v0.15 would most likely break those implementations (of which one is built into a car dashboard).

What would your suggestion be for a client to indicate support for newer versions?
Can these suggestions be documented as well?

In my opinion there are a couple of ways to go about:

  • look at the user agent requesting the API; very prone to errors
  • provide a compatibility parameter, I.E. https://ackspace.nl/spaceAPI/?api_compatibility=13,14,15 (simple, but might not work for all implementations)
  • provide a custom request header: X-API-Compatibility: (not recommended since custom X- prefixes are deprecated since 2012
  • provide name value pair within the Accept header like described in RFC7231 section 5.3.2(fairly complex) for example, prefer version 15 but accept version 14 as well: Accept: application/json;api=14;q=0.1, application/json;api=15

API endpoints might default to their liking but still provide forward compatibility while clients can specify which version they actually want.

I know this could be regarded as an edge case, but it might assist in migrating to future versions really well where a hackerspace wants to provide the latest and greatest while still pleasing the dozens of IOT devices that might be difficult to upgrade.

@rnestler
Copy link
Member

I'd prefer to solve it at the directory level an be able to provide multiple endpoints like:

[
   {
      "url": "https://my.space.api/013/status.json",
       "supported_api_versions": ["0.13"]
  },
   {
      "url": "https://my.space.api/status.json",
       "supported_api_versions": ["14", "15"]
  },
]

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

No branches or pull requests

2 participants