Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: github/developer.github.com
...
head fork: github/developer.github.com
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 2 contributors
Showing with 41 additions and 0 deletions.
  1. +41 −0 content/v3.md
View
41 content/v3.md
@@ -14,6 +14,7 @@ you have any problems or requests please contact
* <a href="#authentication">Authentication</a>
* <a href="#pagination">Pagination</a>
* <a href="#rate-limiting">Rate Limiting</a>
+* <a href="#conditional-requests">Conditional Requests</a>
* <a href="#cross-origin-resource-sharing">Cross Origin Resource Sharing</a>
* <a href="#json-p-callbacks">JSON-P Callbacks</a>
@@ -223,6 +224,46 @@ You can also check your rate limit status without incurring an API hit.
Please [contact us](https://github.com/contact) to request white listed access for your application. We prefer sites that
setup OAuth applications for their users.
+## Conditional Requests
+
+Most responses return `Last-Modified` and `Etag` headers. You can use the values
+of these headers to make subsequent requests to those resources using the
+`If-Modified-Since` and `If-None-Match` headers, respectively. If the resource
+has not changed, the server will return a `304 Not Modified`. Also note: making
+a conditional request and receiving a 304 response does not count against your
+[Rate Limit](#rate-limiting), so we encourage you to use it whenever possible.
+
+<pre class="terminal">
+$ curl -i https://api.github.com/user
+HTTP/1.1 200 OK
+Cache-Control: private, max-age=60
+ETag: "644b5b0155e6404a9cc4bd9d8b1ae730"
+Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT
+Status: 200 OK
+Vary: Accept, Authorization, Cookie
+X-RateLimit-Limit: 5000
+X-RateLimit-Remaining: 4996
+
+$ curl -i https://api.github.com/user -H "If-Modified-Since: Thu, 05 Jul 2012 15:31:30 GMT"
+HTTP/1.1 304 Not Modified
+Cache-Control: private, max-age=60
+Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT
+Status: 304 Not Modified
+Vary: Accept, Authorization, Cookie
+X-RateLimit-Limit: 5000
+X-RateLimit-Remaining: 4996
+
+$ curl -i https://api.github.com/user -H 'If-None-Match: "644b5b0155e6404a9cc4bd9d8b1ae730"'
+HTTP/1.1 304 Not Modified
+Cache-Control: private, max-age=60
+ETag: "644b5b0155e6404a9cc4bd9d8b1ae730"
+Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT
+Status: 304 Not Modified
+Vary: Accept, Authorization, Cookie
+X-RateLimit-Limit: 5000
+X-RateLimit-Remaining: 4996
+</pre>
+
## Cross Origin Resource Sharing
The API supports Cross Origin Resource Sharing (CORS) for AJAX requests.

No commit comments for this range

Something went wrong with that request. Please try again.