Update conditional requests documentation on usage with unsage requests. (#54725)
This commit is contained in:
@@ -69,7 +69,7 @@ Similarly, you should not try to manually construct pagination queries. Instead,
|
|||||||
|
|
||||||
## Use conditional requests if appropriate
|
## Use conditional requests if appropriate
|
||||||
|
|
||||||
Most endpoints return an `etag` header, and many endpoints return a `last-modified` header. You can use the values of these headers to make conditional requests. If the response has not changed, you will receive a `304 Not Modified` response. Making a conditional request does not count against your primary rate limit if a `304` response is returned.
|
Most endpoints return an `etag` header, and many endpoints return a `last-modified` header. You can use the values of these headers to make conditional `GET` requests. If the response has not changed, you will receive a `304 Not Modified` response. Making a conditional request does not count against your primary rate limit if a `304` response is returned.
|
||||||
|
|
||||||
For example, if a previous request returned an `etag` header value of `644b5b0155e6404a9cc4bd9d8b1ae730`, you can use the `if-none-match` header in a future request:
|
For example, if a previous request returned an `etag` header value of `644b5b0155e6404a9cc4bd9d8b1ae730`, you can use the `if-none-match` header in a future request:
|
||||||
|
|
||||||
@@ -83,6 +83,8 @@ For example, if a previous request returned a `last-modified` header value of `W
|
|||||||
curl {% data variables.product.rest_url %}/repos/github/docs --include --header 'if-modified-since: Wed, 25 Oct 2023 19:17:59 GMT'
|
curl {% data variables.product.rest_url %}/repos/github/docs --include --header 'if-modified-since: Wed, 25 Oct 2023 19:17:59 GMT'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Conditional requests for unsafe methods, such as `POST`, `PUT`, `PATCH`, and `DELETE` are not supported unless otherwise noted in the documentation for a specific endpoint.
|
||||||
|
|
||||||
## Do not ignore errors
|
## Do not ignore errors
|
||||||
|
|
||||||
You should not ignore repeated `4xx` and `5xx` error codes. Instead, you should ensure that you are correctly interacting with the API. For example, if an endpoint requests a string and you are passing it a numeric value, you will receive a validation error. Similarly, attempting to access an unauthorized or nonexistent endpoint will result in a `4xx` error.
|
You should not ignore repeated `4xx` and `5xx` error codes. Instead, you should ensure that you are correctly interacting with the API. For example, if an endpoint requests a string and you are passing it a numeric value, you will receive a validation error. Similarly, attempting to access an unauthorized or nonexistent endpoint will result in a `4xx` error.
|
||||||
|
|||||||
Reference in New Issue
Block a user