Skip to content

Commit 55612ac

Browse files
authored
Update responses for current format (github#8016)
1 parent 3572d88 commit 55612ac

File tree

1 file changed

+40
-22
lines changed

1 file changed

+40
-22
lines changed

content/rest/guides/getting-started-with-the-rest-api.md

Lines changed: 40 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ $ curl https://api.github.com/users/defunkt
5050
> {
5151
> "login": "defunkt",
5252
> "id": 2,
53-
> "url": "{% data variables.product.api_url_pre %}/users/defunkt",
53+
> "node_id": "MDQ6VXNlcjI=",
54+
> "avatar_url": "https://avatars.githubusercontent.com/u/2?v=4",
55+
> "gravatar_id": "",
56+
> "url": "https://api.github.com/users/defunkt",
5457
> "html_url": "https://github.com/defunkt",
5558
> ...
5659
> }
@@ -61,26 +64,41 @@ Mmmmm, tastes like [JSON][json]. Let's add the `-i` flag to include headers:
6164
```shell
6265
$ curl -i https://api.github.com/users/defunkt
6366
64-
> HTTP/2 200
65-
> Server: GitHub.com
66-
> Date: Sun, 11 Nov 2012 18:43:28 GMT
67-
> Content-Type: application/json; charset=utf-8
68-
> ETag: "bfd85cbf23ac0b0c8a29bee02e7117c6"
69-
> X-RateLimit-Limit: 60
70-
> X-RateLimit-Remaining: 57
71-
> X-RateLimit-Reset: 1352660008
72-
> X-GitHub-Media-Type: github.v3
73-
> Vary: Accept
74-
> Cache-Control: public, max-age=60, s-maxage=60
75-
> X-Content-Type-Options: nosniff
76-
> Content-Length: 692
77-
> Last-Modified: Tue, 30 Oct 2012 18:58:42 GMT
78-
67+
> HTTP/2 200
68+
> server: GitHub.com
69+
> date: Thu, 08 Jul 2021 07:04:08 GMT
70+
> content-type: application/json; charset=utf-8
71+
> cache-control: public, max-age=60, s-maxage=60
72+
> vary: Accept, Accept-Encoding, Accept, X-Requested-With
73+
> etag: W/"61e964bf6efa3bc3f9e8549e56d4db6e0911d8fa20fcd8ab9d88f13d513f26f0"
74+
> last-modified: Fri, 01 Nov 2019 21:56:00 GMT
75+
> x-github-media-type: github.v3; format=json
76+
> access-control-expose-headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset
77+
> access-control-allow-origin: *
78+
> strict-transport-security: max-age=31536000; includeSubdomains; preload
79+
> x-frame-options: deny
80+
> x-content-type-options: nosniff
81+
> x-xss-protection: 0
82+
> referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
83+
> content-security-policy: default-src 'none'
84+
> x-ratelimit-limit: 60
85+
> x-ratelimit-remaining: 53
86+
> x-ratelimit-reset: 1625731053
87+
> x-ratelimit-resource: core
88+
> x-ratelimit-used: 7
89+
> accept-ranges: bytes
90+
> content-length: 1305
91+
> x-github-request-id: 9F60:7019:ACC5CD5:B03C931:60E6A368
92+
>
7993
> {
80-
> "login": "defunkt",
81-
> "id": 2,
82-
> "url": "{% data variables.product.api_url_pre %}/users/defunkt",
83-
> "html_url": "https://github.com/defunkt",
94+
> "login": "defunkt",
95+
> "id": 2,
96+
> "node_id": "MDQ6VXNlcjI=",
97+
> "avatar_url": "https://avatars.githubusercontent.com/u/2?v=4",
98+
> "gravatar_id": "",
99+
> "url": "https://api.github.com/users/defunkt",
100+
> "html_url": "https://github.com/defunkt",
101+
>
84102
> ...
85103
> }
86104
```
@@ -400,7 +418,7 @@ first call we made to get defunkt's profile:
400418
$ curl -i {% data variables.product.api_url_pre %}/users/defunkt
401419
402420
> HTTP/2 200
403-
> ETag: "bfd85cbf23ac0b0c8a29bee02e7117c6"
421+
> etag: W/"61e964bf6efa3bc3f9e8549e56d4db6e0911d8fa20fcd8ab9d88f13d513f26f0"
404422
```
405423
406424
In addition to the JSON body, take note of the HTTP status code of `200` and
@@ -409,7 +427,7 @@ The [ETag][etag] is a fingerprint of the response. If we pass that on subsequent
409427
we can tell the API to give us the resource again, only if it has changed:
410428
411429
```shell
412-
$ curl -i -H 'If-None-Match: "bfd85cbf23ac0b0c8a29bee02e7117c6"' \
430+
$ curl -i -H 'If-None-Match: "61e964bf6efa3bc3f9e8549e56d4db6e0911d8fa20fcd8ab9d88f13d513f26f0"' \
413431
$ {% data variables.product.api_url_pre %}/users/defunkt
414432
415433
> HTTP/2 304

0 commit comments

Comments
 (0)