Skip to content

Commit 1a30d7d

Browse files
committed
Lets use API 2.1 all the way
1 parent c005868 commit 1a30d7d

File tree

1 file changed

+27
-29
lines changed

1 file changed

+27
-29
lines changed

slate/source/index.md

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -43,29 +43,27 @@ A similar pattern of HTTP response codes applies to other endpoints such us `/bu
4343

4444
To use API V2.1 set the `Accept` header of your API request to `application/vnd.travis-ci.2.1+json`.
4545

46-
> Note that the rest of the examples in this document have the `Accept` header set to API V2.
47-
4846
# Making Requests
4947

5048
```http
5149
GET / HTTP/1.1
5250
User-Agent: MyClient/1.0.0
53-
Accept: application/vnd.travis-ci.2+json
51+
Accept: application/vnd.travis-ci.2.1+json
5452
Host: api.travis-ci.org
5553
```
5654

5755
```http
5856
GET / HTTP/1.1
5957
User-Agent: MyClient/1.0.0
60-
Accept: application/vnd.travis-ci.2+json
58+
Accept: application/vnd.travis-ci.2.1+json
6159
Authorization: token "YOUR TRAVIS ACCESS TOKEN"
6260
Host: api.travis-ci.com
6361
```
6462

6563
```http
6664
GET /api HTTP/1.1
6765
User-Agent: MyClient/1.0.0
68-
Accept: application/vnd.travis-ci.2+json
66+
Accept: application/vnd.travis-ci.2.1+json
6967
Authorization: token "YOUR TRAVIS ACCESS TOKEN"
7068
Host: travis.example.com
7169
```
@@ -120,7 +118,7 @@ The first thing you need to know is what API URL endpoint to use:
120118
When you write your own Travis CI client, please keep the following in mind:
121119

122120
- Always set the **User-Agent** header. This header is not required right now, but will be in the near future. Assuming your client is called "My Client", and its current version is 1.0.0, a good value would be `MyClient/1.0.0`. For our command line client running on OS X 10.9 on Ruby 2.1.1, it might look like this: `Travis/1.6.8 (Mac OS X 10.9.2 like Darwin; Ruby 2.1.1; RubyGems 2.0.14) Faraday/0.8.9 Typhoeus/0.6.7`.
123-
- Always set the **Accept** header to `application/vnd.travis-ci.2+json` to make sure that you get results from the V2 API. See also the note about [API V2.1](#API-V2.1)
121+
- Always set the **Accept** header to `application/vnd.travis-ci.2.1+json` to make sure that you get results from the V2.1 API. See also the note about [API V2.1](#API-V2.1)
124122

125123
Client libraries will usually set these headers automatically.
126124

@@ -129,7 +127,7 @@ Client libraries will usually set these headers automatically.
129127
```http
130128
GET /config HTTP/1.1
131129
User-Agent: MyClient/1.0.0
132-
Accept: application/vnd.travis-ci.2+json
130+
Accept: application/vnd.travis-ci.2.1+json
133131
Host: api.travis-ci.org
134132
```
135133

@@ -198,7 +196,7 @@ This includes, amongst other things:
198196
```http
199197
GET /users HTTP/1.1
200198
User-Agent: MyClient/1.0.0
201-
Accept: application/vnd.travis-ci.2+json
199+
Accept: application/vnd.travis-ci.2.1+json
202200
Host: api.travis-ci.org
203201
Authorization: token "YOUR TRAVIS ACCESS TOKEN"
204202
```
@@ -232,7 +230,7 @@ You can retrieve a token by using a GitHub token to prove who you are. In the fu
232230
```http
233231
POST /auth/github HTTP/1.1
234232
User-Agent: MyClient/1.0.0
235-
Accept: application/vnd.travis-ci.2+json
233+
Accept: application/vnd.travis-ci.2.1+json
236234
Host: api.travis-ci.org
237235
Content-Type: application/json
238236
Content-Length: 37
@@ -307,7 +305,7 @@ Content-Type: application/json
307305
```http
308306
POST /auth/github HTTP/1.1
309307
User-Agent: MyClient/1.0.0
310-
Accept: application/vnd.travis-ci.2+json
308+
Accept: application/vnd.travis-ci.2.1+json
311309
Host: api.travis-ci.org
312310
Content-Type: application/json
313311
Content-Length: 37
@@ -401,7 +399,7 @@ There is an alternative version of this that will try to run the handshake in a
401399
```http
402400
GET /accounts HTTP/1.1
403401
User-Agent: MyClient/1.0.0
404-
Accept: application/vnd.travis-ci.2+json
402+
Accept: application/vnd.travis-ci.2.1+json
405403
Host: api.travis-ci.org
406404
Authorization: token "YOUR TRAVIS ACCESS TOKEN"
407405
```
@@ -475,7 +473,7 @@ This request always needs to be authenticated.
475473
```http
476474
GET /repos/rails/rails/branches HTTP/1.1
477475
User-Agent: MyClient/1.0.0
478-
Accept: application/vnd.travis-ci.2+json
476+
Accept: application/vnd.travis-ci.2.1+json
479477
Host: api.travis-ci.org
480478
```
481479

@@ -549,7 +547,7 @@ This will list the latest 25 branches.
549547
```http
550548
GET /broadcasts HTTP/1.1
551549
User-Agent: MyClient/1.0.0
552-
Accept: application/vnd.travis-ci.2+json
550+
Accept: application/vnd.travis-ci.2.1+json
553551
Authorization: token YOUR TRAVIS ACCESS TOKEN
554552
Host: api.travis-ci.org
555553
```
@@ -599,7 +597,7 @@ This request always needs to be authenticated.
599597
```http
600598
GET /repos/sinatra/sinatra/builds HTTP/1.1
601599
User-Agent: MyClient/1.0.0
602-
Accept: application/vnd.travis-ci.2+json
600+
Accept: application/vnd.travis-ci.2.1+json
603601
Host: api.travis-ci.org
604602
```
605603

@@ -728,7 +726,7 @@ This request always needs to be authenticated.
728726
```http
729727
GET /repos/travis-pro/billing/caches HTTP/1.1
730728
User-Agent: MyClient/1.0.0
731-
Accept: application/vnd.travis-ci.2+json
729+
Accept: application/vnd.travis-ci.2.1+json
732730
Authorization: token YOUR TRAVIS ACCESS TOKEN
733731
Host: api.travis-ci.com
734732
```
@@ -818,7 +816,7 @@ This request always needs to be authenticated.
818816
```http
819817
GET /repos/sinatra/sinatra/builds HTTP/1.1
820818
User-Agent: MyClient/1.0.0
821-
Accept: application/vnd.travis-ci.2+json
819+
Accept: application/vnd.travis-ci.2.1+json
822820
Host: api.travis-ci.org
823821
```
824822

@@ -884,7 +882,7 @@ There is no API endpoint for resolving commits, however commit data might be inc
884882
```http
885883
PUT /hooks HTTP/1.1
886884
User-Agent: MyClient/1.0.0
887-
Accept: application/vnd.travis-ci.2+json
885+
Accept: application/vnd.travis-ci.2.1+json
888886
Authorization: token YOUR TRAVIS ACCESS TOKEN
889887
Host: api.travis-ci.org
890888
Content-Type: application/json
@@ -939,7 +937,7 @@ This request always needs to be authenticated.
939937
```http
940938
POST /jobs/42/restart HTTP/1.1
941939
User-Agent: MyClient/1.0.0
942-
Accept: application/vnd.travis-ci.2+json
940+
Accept: application/vnd.travis-ci.2.1+json
943941
Authorization: token YOUR TRAVIS ACCESS TOKEN
944942
Host: api.travis-ci.org
945943
```
@@ -1082,7 +1080,7 @@ To stream the logs, you will have to subscribe to the channel for the job the lo
10821080
```http
10831081
GET /users/permissions HTTP/1.1
10841082
User-Agent: MyClient/1.0.0
1085-
Accept: application/vnd.travis-ci.2+json
1083+
Accept: application/vnd.travis-ci.2.1+json
10861084
Authorization: token YOUR TRAVIS ACCESS TOKEN
10871085
Host: api.travis-ci.org
10881086
```
@@ -1134,7 +1132,7 @@ This request always needs to be authenticated.
11341132
```http
11351133
GET /repos/sinatra/sinatra/key HTTP/1.1
11361134
User-Agent: MyClient/1.0.0
1137-
Accept: application/vnd.travis-ci.2+json
1135+
Accept: application/vnd.travis-ci.2.1+json
11381136
Authorization: token YOUR TRAVIS ACCESS TOKEN
11391137
Host: api.travis-ci.org
11401138
```
@@ -1203,7 +1201,7 @@ This request always needs to be authenticated.
12031201
```http
12041202
GET /repos/sinatra/sinatra HTTP/1.1
12051203
User-Agent: MyClient/1.0.0
1206-
Accept: application/vnd.travis-ci.2+json
1204+
Accept: application/vnd.travis-ci.2.1+json
12071205
Authorization: token YOUR TRAVIS ACCESS TOKEN
12081206
Host: api.travis-ci.org
12091207
```
@@ -1280,7 +1278,7 @@ If no parameters are given, a list or repositories with recent activity is retur
12801278
```http
12811279
GET /requests/6301283 HTTP/1.1
12821280
User-Agent: MyClient/1.0.0
1283-
Accept: application/vnd.travis-ci.2+json
1281+
Accept: application/vnd.travis-ci.2.1+json
12841282
Authorization: token YOUR TRAVIS ACCESS TOKEN
12851283
Host: api.travis-ci.org
12861284
```
@@ -1375,7 +1373,7 @@ You have to either provide `repository_id` or `slug`.
13751373
```http
13761374
GET /repos/82/settings HTTP/1.1
13771375
User-Agent: MyClient/1.0.0
1378-
Accept: application/vnd.travis-ci.2+json
1376+
Accept: application/vnd.travis-ci.2.1+json
13791377
Authorization: token YOUR TRAVIS ACCESS TOKEN
13801378
Host: api.travis-ci.org
13811379
```
@@ -1443,7 +1441,7 @@ This request always needs to be authenticated.
14431441
```http
14441442
GET /settings/env_vars?repository_id=124920 HTTP/1.1
14451443
User-Agent: MyClient/1.0.0
1446-
Accept: application/vnd.travis-ci.2+json
1444+
Accept: application/vnd.travis-ci.2.1+json
14471445
Authorization: token YOUR TRAVIS ACCESS TOKEN
14481446
Host: api.travis-ci.org
14491447
```
@@ -1547,7 +1545,7 @@ This API is only available on Travis Pro.
15471545
```http
15481546
GET /settings/ssh_key/124920 HTTP/1.1
15491547
User-Agent: MyClient/1.0.0
1550-
Accept: application/vnd.travis-ci.2+json
1548+
Accept: application/vnd.travis-ci.2.1+json
15511549
Authorization: token YOUR TRAVIS ACCESS TOKEN
15521550
Host: api.travis-ci.com
15531551
```
@@ -1612,7 +1610,7 @@ This request always needs to be authenticated.
16121610
```http
16131611
GET /users/ HTTP/1.1
16141612
User-Agent: MyClient/1.0.0
1615-
Accept: application/vnd.travis-ci.2+json
1613+
Accept: application/vnd.travis-ci.2.1+json
16161614
Authorization: token YOUR TRAVIS ACCESS TOKEN
16171615
Host: api.travis-ci.org
16181616
```
@@ -1688,7 +1686,7 @@ This request always needs to be authenticated.
16881686
```http
16891687
PUT /lint/ HTTP/1.1
16901688
User-Agent: MyClient/1.0.0
1691-
Accept: application/vnd.travis-ci.2+json
1689+
Accept: application/vnd.travis-ci.2.1+json
16921690
Host: api.travis-ci.org
16931691
Content-Type: text/yaml
16941692
@@ -1765,7 +1763,7 @@ The following clients are maintained by the Travis CI team:
17651763
if(req) {
17661764
req.open("GET", "https://api.travis-ci.org/", true);
17671765
req.onreadystatechange = function() { alert("it worked!") };
1768-
req.setRequestHeader("Accept", "application/vnd.travis-ci.2+json");
1766+
req.setRequestHeader("Accept", "application/vnd.travis-ci.2.1+json");
17691767
req.send();
17701768
}
17711769
</script>
@@ -1777,7 +1775,7 @@ The following clients are maintained by the Travis CI team:
17771775
<script>
17781776
$.ajax({
17791777
url: "https://api.travis-ci.org/",
1780-
headers: { Accept: "application/vnd.travis-ci.2+json" },
1778+
headers: { Accept: "application/vnd.travis-ci.2.1+json" },
17811779
success: function() { alert("it worked!") }
17821780
});
17831781
</script>

0 commit comments

Comments
 (0)