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

Update Best Practices doc for Github API Conditional Requests to mention limitations #34689

Open
1 task done
Tracked by #34807
mikebroberts opened this issue Sep 22, 2024 · 10 comments
Open
1 task done
Tracked by #34807
Labels
content This issue or pull request belongs to the Docs Content team more-information-needed More information is needed to complete review rest Content related to rest - overview. SME reviewed An SME has reviewed this issue/PR

Comments

@mikebroberts
Copy link

Code of Conduct

What article on docs.github.com is affected?

https://docs.github.com/en/rest/using-the-rest-api/best-practices-for-using-the-rest-api?apiVersion=2022-11-28#use-conditional-requests-if-appropriate

What part(s) of the article would you like to see updated?

The section in this doc "Use conditional requests if appropriate" explains how to use conditional requests to avoid rate limit concerns for repeated use. However there's a problem with this approach which isn't mentioned in the doc - this solution only works when the access token being used to make the REST API doesn't change. When a different access token is used a different etag is returned, and further setting the if-none-match header for an etag value given with a previous token doesn't give the 304 response.

This is particularly a problem when using a GitHub App since the "installation token" refreshes (at least) every hour. Therefore this "best practice" will not be appropriate in many scenarios when using a GitHub App.

I suspect changing the API behavior will be hard or may never happen, so I think it's worth at least updating the document. I had made an assumption that conditional requests would work during the design of a GitHub App - based on this doc - and now that I know that they don't I have to rethink a few things.

Additional information

The overall issue with the API was raised in 2023 here by someone else - https://github.com/orgs/community/discussions/75228#discussioncomment-10697940 .

@mikebroberts mikebroberts added the content This issue or pull request belongs to the Docs Content team label Sep 22, 2024
Copy link

welcome bot commented Sep 22, 2024

Thanks for opening this issue. A GitHub docs team member should be by to give feedback soon. In the meantime, please check out the contributing guidelines.

@github-actions github-actions bot added the triage Do not begin working on this issue until triaged by the team label Sep 22, 2024
@nguyenalex836 nguyenalex836 added waiting for review Issue/PR is waiting for a writer's review rest Content related to rest - overview. and removed triage Do not begin working on this issue until triaged by the team labels Sep 23, 2024
@nguyenalex836
Copy link
Contributor

@mikebroberts Thank you for raising this issue! I'll get this triaged for review ✨ Our team will provide feedback regarding the best next steps for this issue - thanks for your patience! 💛

@subatoi subatoi added the needs SME This proposal needs review from a subject matter expert label Sep 24, 2024
Copy link
Contributor

Thanks for opening an issue! We've triaged this issue for technical review by a subject matter expert 👀

@nguyenalex836
Copy link
Contributor

@mikebroberts Thank you for your patience while our SME team reviewed! Your analysis is correct 💛 Would you be open to raising a PR to call out this behavior with Apps?

@nguyenalex836 nguyenalex836 added SME reviewed An SME has reviewed this issue/PR more-information-needed More information is needed to complete review and removed waiting for review Issue/PR is waiting for a writer's review needs SME This proposal needs review from a subject matter expert labels Sep 30, 2024
@muhammadumar313

This comment was marked as spam.

@github-actions github-actions bot added the stale There is no recent activity on this issue or pull request label Oct 15, 2024
Copy link
Contributor

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further. See this blog post on bug reports and the importance of repro steps for more information about the kind of information that may be helpful.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 15, 2024
@JoshuaTheMiller
Copy link
Contributor

I believe this Issue should remain open as I did not find this mentioned in the existing docs (linked above).

Getting this called out in the documentation in some way would likely save application authors a LOT of headache 😁 (perhaps speaking from personal experience).

@nguyenalex836
Copy link
Contributor

@JoshuaTheMiller Thanks for the nudge on this! ✨ I've just reopened - would you be willing to raise a PR calling out this behavior with Apps? If not, we can look at opening this up to the community 💛

@nguyenalex836 nguyenalex836 reopened this Oct 28, 2024
@nguyenalex836 nguyenalex836 removed the stale There is no recent activity on this issue or pull request label Oct 28, 2024
@github-actions github-actions bot added triage Do not begin working on this issue until triaged by the team and removed stale There is no recent activity on this issue or pull request labels Oct 28, 2024
@nguyenalex836 nguyenalex836 removed the triage Do not begin working on this issue until triaged by the team label Oct 28, 2024
@Skitso51-50

This comment was marked as spam.

@Skitso51-50

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content This issue or pull request belongs to the Docs Content team more-information-needed More information is needed to complete review rest Content related to rest - overview. SME reviewed An SME has reviewed this issue/PR
Projects
None yet
Development

No branches or pull requests

6 participants