Skip to content

Commit c53d747

Browse files
authored
Update conditional requests documentation on usage with unsage requests. (#54725)
1 parent bddac63 commit c53d747

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

content/rest/using-the-rest-api/best-practices-for-using-the-rest-api.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Similarly, you should not try to manually construct pagination queries. Instead,
6969

7070
## Use conditional requests if appropriate
7171

72-
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.
72+
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.
7373

7474
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:
7575

@@ -83,6 +83,8 @@ For example, if a previous request returned a `last-modified` header value of `W
8383
curl {% data variables.product.rest_url %}/repos/github/docs --include --header 'if-modified-since: Wed, 25 Oct 2023 19:17:59 GMT'
8484
```
8585

86+
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.
87+
8688
## Do not ignore errors
8789

8890
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.

0 commit comments

Comments
 (0)