Skip to content

Commit 39f2435

Browse files
Merge pull request #2612 from buildkite/jh/docs/team-api-docs-overarching-branch
[FDN-3587] Add new Orgs / Teams / Suites REST API Documentation
2 parents ae030c2 + fc2152d commit 39f2435

32 files changed

+1017
-149
lines changed

app/models/beta_pages.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
class BetaPages
22
def self.all
33
[
4-
'pipelines/cluster-queue-metrics'
4+
'pipelines/cluster-queue-metrics',
5+
'apis/rest-api/team-pipelines',
6+
'apis/rest-api/organizations/members',
7+
'apis/rest-api/teams',
8+
'apis/rest-api/teams/members',
9+
'apis/rest-api/teams/pipelines',
10+
'apis/rest-api/teams/suites'
511
]
612
end
713
end

config/routes.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Pages and guides that have been renamed (and we don't want to break old URLs)
33
get "/docs/api", to: redirect("/docs/apis/rest-api")
44
get "/docs/api/accounts", to: redirect("/docs/apis/rest-api/organizations")
5+
get "/docs/api/organizations", to: redirect("/docs/apis/rest-api/organizations")
56
get "/docs/api/projects", to: redirect("/docs/apis/rest-api/pipelines")
67
get "/docs/api/*page", to: redirect("/docs/apis/rest-api/%{page}")
78
get "/docs/apis/graphql-tutorial", to: redirect("/docs/apis/graphql/graphql-tutorial")

data/nav.yml

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@
310310
path: "clusters/queue-metrics"
311311
- name: "Hosted agents"
312312
pill: "private trials"
313-
children:
313+
children:
314314
- name: "Overview"
315315
path: "pipelines/hosted-agents/overview"
316316
- name: "Mac hosted agents"
@@ -429,8 +429,33 @@
429429
path: "apis/rest-api"
430430
- name: "Limits"
431431
path: "apis/rest-api/limits"
432-
- name: "Pipelines REST API"
432+
- name: "Agent"
433+
children:
434+
- name: "Overview"
435+
path: "apis/agent-api"
436+
- name: "Metrics"
437+
path: "apis/agent-api/metrics"
438+
- name: "Analytics"
433439
children:
440+
- name: "Flaky tests"
441+
path: "apis/rest-api/analytics/flaky-tests"
442+
- name: "Runs"
443+
path: "apis/rest-api/analytics/runs"
444+
- name: "Suites"
445+
path: "apis/rest-api/analytics/suites"
446+
- name: "Tests"
447+
path: "apis/rest-api/analytics/tests"
448+
- name: "Organizations"
449+
children:
450+
- name: "Overview"
451+
path: "apis/rest-api/organizations"
452+
- name: "Members"
453+
path: "apis/rest-api/organizations/members"
454+
pill: "beta"
455+
- name: "Pipelines "
456+
children:
457+
- name: "Overview"
458+
path: "apis/rest-api/pipelines"
434459
- name: "Access token"
435460
path: "apis/rest-api/access-token"
436461
- name: "Agents"
@@ -449,32 +474,21 @@
449474
path: "apis/rest-api/jobs"
450475
- name: "Meta"
451476
path: "apis/rest-api/meta"
452-
- name: "Organizations"
453-
path: "apis/rest-api/organizations"
454-
- name: "Pipelines"
455-
path: "apis/rest-api/pipelines"
456477
- name: "Pipeline templates"
457478
path: "apis/rest-api/pipeline-templates"
458-
- name: "Teams"
459-
path: "apis/rest-api/teams"
460479
- name: "User"
461480
path: "apis/rest-api/user"
462-
- name: "Agent REST API"
481+
- name: "Teams"
482+
pill: "beta"
463483
children:
464484
- name: "Overview"
465-
path: "apis/agent-api"
466-
- name: "Metrics"
467-
path: "apis/agent-api/metrics"
468-
- name: "Analytics REST API"
469-
children:
470-
- name: "Flaky tests"
471-
path: "apis/rest-api/analytics/flaky-tests"
472-
- name: "Runs"
473-
path: "apis/rest-api/analytics/runs"
485+
path: "apis/rest-api/teams"
486+
- name: "Members"
487+
path: "apis/rest-api/teams/members"
488+
- name: "Pipelines"
489+
path: "apis/rest-api/teams/pipelines"
474490
- name: "Suites"
475-
path: "apis/rest-api/analytics/suites"
476-
- name: "Tests"
477-
path: "apis/rest-api/analytics/tests"
491+
path: "apis/rest-api/teams/suites"
478492
- name: "GraphQL"
479493
children: []
480494
- name: "Webhooks"

pages/agent/v3/tokens.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ To create an agent token for a cluster using the Buildkite interface:
4949

5050
To [create an agent token](/docs/apis/rest-api/clusters#agent-tokens-create-a-token) using the [REST API](/docs/apis/rest-api), run the following example `curl` command:
5151

52-
```curl
52+
```bash
5353
curl -H "Authorization: Bearer $TOKEN" \
5454
-X POST "https://api.buildkite.com/v2/organizations/{org.slug}/clusters/{cluster.id}/tokens" \
5555
-H "Content-Type: application/json" \
@@ -153,7 +153,7 @@ To update a cluster's agent token using the Buildkite interface:
153153

154154
To [update an agent token](/docs/apis/rest-api/clusters#agent-tokens-update-a-token) using the [REST API](/docs/apis/rest-api), run the following example `curl` command:
155155

156-
```curl
156+
```bash
157157
curl -H "Authorization: Bearer $TOKEN" \
158158
-X PUT "https://api.buildkite.com/v2/organizations/{org.slug}/clusters/{cluster.id}/tokens/{id}" \
159159
-H "Content-Type: application/json" \
@@ -253,7 +253,7 @@ To revoke a cluster's agent token using the Buildkite interface:
253253

254254
To [revoke an agent token](/docs/apis/rest-api/clusters#agent-tokens-revoke-a-token) using the [REST API](/docs/apis/rest-api), run the following example `curl` command:
255255

256-
```curl
256+
```bash
257257
curl -H "Authorization: Bearer $TOKEN" \
258258
-X DELETE "https://api.buildkite.com/v2/organizations/{org.slug}/clusters/{cluster.id}/tokens/{id}"
259259
```

pages/apis/agent_api/metrics.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ The Metrics API endpoint provides information on idle and busy agents, jobs, and
1010

1111
Get agent metrics
1212

13-
```
14-
curl -H "Authorization: Token $BUILDKITE_AGENT_TOKEN" "https://agent.buildkite.com/v3/metrics"
13+
```bash
14+
curl -H "Authorization: Bearer $BUILDKITE_AGENT_TOKEN" \
15+
-X GET "https://agent.buildkite.com/v3/metrics"
1516
```
1617

1718
```json

pages/apis/descriptions/_rest_agent_token_id.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
* By running the [List tokens](/docs/apis/rest-api/clusters#agent-tokens-list-tokens) REST API query and obtain this value from the `id` in the response associated with the description of your token (specified by the `description` value in the response). For example:
99

10-
```curl
11-
curl -H "Authorization: Bearer $TOKEN" "https://api.buildkite.com/v2/organizations/{org.slug}/clusters/{cluster.id}/tokens"
10+
```bash
11+
curl -H "Authorization: Bearer $TOKEN" \
12+
- X GET "https://api.buildkite.com/v2/organizations/{org.slug}/clusters/{cluster.id}/tokens"
1213
```

pages/apis/descriptions/_rest_cluster_id.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
* By running the [List clusters](/docs/apis/rest-api/clusters#clusters-list-clusters) REST API query and obtain this value from the `id` in the response associated with the name of your target cluster (specified by the `name` value in the response). For example:
88

9-
```curl
10-
curl -H "Authorization: Bearer $TOKEN" "https://api.buildkite.com/v2/organizations/{org.slug}/clusters"
9+
```bash
10+
curl -H "Authorization: Bearer $TOKEN" \
11+
- X GET "https://api.buildkite.com/v2/organizations/{org.slug}/clusters"
1112
```

pages/apis/descriptions/_rest_cluster_id_body.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
* By running the [List clusters](/docs/apis/rest-api/clusters#clusters-list-clusters) REST API query and obtain this value from the `id` in the response associated with the name of your target cluster (specified by the `name` value in the response). For example:
88

9-
```curl
10-
curl -H "Authorization: Bearer $TOKEN" "https://api.buildkite.com/v2/organizations/{org.slug}/clusters"
9+
```bash
10+
curl -H "Authorization: Bearer $TOKEN"
11+
- X GET "https://api.buildkite.com/v2/organizations/{org.slug}/clusters"
1112
```

pages/apis/descriptions/_rest_org_slug.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
* By running the [List organizations](/docs/apis/rest-api/organizations#list-organizations) REST API query to obtain this value from `slug` in the response. For example:
66

7-
```curl
8-
curl -H "Authorization: Bearer $TOKEN" "https://api.buildkite.com/v2/organizations"
7+
```bash
8+
curl -H "Authorization: Bearer $TOKEN" \
9+
- X GET "https://api.buildkite.com/v2/organizations"
910
```

pages/apis/rest_api.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ The current version of the Buildkite API is v2.
66

77
For the list of existing disparities between the REST API and the GraphQL API, see [API differences](/docs/apis/api-differences).
88

9-
109
## Schema
1110

1211
All API access is over HTTPS, and accessed from the `api.buildkite.com` domain. All data is sent as JSON.
@@ -25,16 +24,18 @@ curl https://api.buildkite.com
2524

2625
Some API endpoints accept query string parameters which are added to the end of the URL. For example, the [builds listing APIs](/docs/api/builds#list-all-builds) can be filtered by `state` using the following `curl` command:
2726

28-
```
29-
curl "https://api.buildkite.com/v2/organizations/my-org/pipelines/my-pipeline/builds?state=passed"
27+
```bash
28+
curl -H "Authorization: Bearer $TOKEN" \
29+
-X GET "https://api.buildkite.com/v2/organizations/my-org/pipelines/my-pipeline/builds?state=passed"
3030
```
3131

3232
## Request body properties
3333

3434
Some API requests accept JSON request bodies for specifying data. For example, the [build create API](/docs/api/builds#create-a-build) can be passed the required properties using the following `curl` command:
3535

36-
```
37-
curl -X POST "https://api.buildkite.com/v2/organizations/my-org/pipelines/my-pipeline/builds" \
36+
```bash
37+
curl -H "Authorization: Bearer $TOKEN" \
38+
-X POST "https://api.buildkite.com/v2/organizations/my-org/pipelines/my-pipeline/builds" \
3839
-H "Content-Type: application/json" \
3940
-d '{
4041
"key": "value"
@@ -45,25 +46,26 @@ The data encoding is assumed to be `application/json`. Unless explicitly stated
4546

4647
## Authentication
4748

48-
You can authenticate with the Buildkite API using access tokens.
49+
You can authenticate with the Buildkite API using access tokens, represented by the value `$TOKEN` throughout this documentation.
4950

5051
API access tokens allow to call the API without using your username and password. They can be created on your <a href="<%= url_helpers.user_access_tokens_url %>" rel="nofollow">API access tokens</a> page, limited to individual organizations and permissions, and revoked at any time from the web interface [or the REST API](/docs/apis/rest-api/access-token#revoke-the-current-token).
5152

5253
To authenticate using a token, set the <code>Authorization</code> HTTP header to the word <code>Bearer</code>, followed by a space, followed by the access token. For example:
5354

5455
```bash
55-
curl -H "Authorization: Bearer $TOKEN" https://api.buildkite.com/v2/user
56+
curl -H "Authorization: Bearer $TOKEN" \
57+
-X GET "https://api.buildkite.com/v2/user"
5658
```
5759

58-
>🚧 Basic authentication
59-
> Access using basic HTTP authentication is no longer available.
60+
Access using basic HTTP authentication is not supported.
6061

6162
## Pagination
6263

6364
For endpoints which support pagination, the pagination information can be found in the `Link` HTTP response header containing zero or more of `next`, `prev`, `first` and `last`.
6465

6566
```bash
66-
curl -i "https://api.buildkite.com/v2/organizations/my-great-org/pipelines/my-pipeline/builds"
67+
curl -i -H "Authorization: Bearer $TOKEN" \
68+
-X GET "https://api.buildkite.com/v2/organizations/my-great-org/pipelines/my-pipeline/builds"
6769
```
6870

6971
```

0 commit comments

Comments
 (0)