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

migrate to GitHub "calendar-based versioning" for access to the GitHub REST API ('X-GitHub-Api-Version', etc.) #89

Open
salewski opened this issue Mar 17, 2024 · 0 comments
Labels
priority: 2 (soon) severity: 4 (important) status:acknowledged type:task Activity or change needed for ongoing care and feeding of the project

Comments

@salewski
Copy link
Owner

salewski commented Mar 17, 2024

In late 2022, GitHub announced it was moving to "calendar-based versioning" for the GitHub REST API:

The announcement docs state:

If you’re using the REST API, you don’t need to take any action right now. We’ll get in touch with plenty of notice before we drop support for any old versions.

The "Breaking Changes" doc linked above says:

Breaking changes for 2022-11-28
Version 2022-11-28 is the first version of the GitHub REST API after date-based versioning was introduced. This version does not include any breaking changes.

And indeed, AFAIK there that change has not (yet?) caused any breakage for programs in the ads-github-tools project. However, the "API Versions" doc linked above also state:

Requests without the X-GitHub-Api-Version header will default to use the 2022-11-28 version.

If you specify an API version that is no longer supported, you will receive a 400 error.

The ads-github-tools should adapt the newer approach, in order to avoid surprises in the future.

The current version of ads-github-tools (version 0.3.5, released 2022-10-26) specifies the Media Type for the GitHub v3 API thus:

    Accept: application/vnd.github.v3+json

The GitHub "API Versions" documentation now specifies that the desired version of the API should be specified in the newly added X-GitHub-Api-Version HTTP header rather than as part of the Media Type (in the Accept: header):

    X-GitHub-Api-Version: 2022-11-28

The Media Type (Accept:) header is still used to request specific types of content. The "Media types" docs say that most of the GitHub REST APIs support either:

    Accept: application/vnd.github+json

or:

    Accept: application/json

But the accepted value(s) can vary for different endpoints, so you need to check the docs for each API endpoint.

FWIW, the docs for the /user/repos endpoint recommends:

    Accept: application/vnd.github+json
@salewski salewski added type:task Activity or change needed for ongoing care and feeding of the project severity: 4 (important) priority: 2 (soon) status:acknowledged labels Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: 2 (soon) severity: 4 (important) status:acknowledged type:task Activity or change needed for ongoing care and feeding of the project
Projects
None yet
Development

No branches or pull requests

1 participant