Skip to content

Commit 6ed261f

Browse files
stevsmitSteven Smith
andauthored
Build api (quay#1230)
* Adds user api endpoints (quay#1229) Co-authored-by: Steven Smith <[email protected]> * Adds build API endpoints --------- Co-authored-by: Steven Smith <[email protected]>
1 parent c4b78ee commit 6ed261f

File tree

3 files changed

+91
-4
lines changed

3 files changed

+91
-4
lines changed

api/master.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ include::modules/managing-teams-api.adoc[leveloffset=+2]
127127
include::modules/managing-team-members-api.adoc[leveloffset=+3]
128128
include::modules/setting-role-of-team-within-organization-api.adoc[leveloffset=+3]
129129
include::modules/deleting-team-within-organization-api.adoc[leveloffset=+3]
130+
//build
131+
include::modules/managing-builds-api.adoc[leveloffset=+2]
132+
//user
133+
include::modules/managing-user-options-api.adoc[leveloffset=+2]
130134
131135
132136

modules/managing-builds-api.adoc

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
[id="manage-builds-api"]
2+
= Managing builds by using the {productname} API
3+
4+
Builds can be managed by using the {productname} API.
5+
6+
.Procedure
7+
8+
. Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#listbuildtriggers[`GET /api/v1/repository/{repository}/trigger/`] endpoint to list the triggers for the specified repository:
9+
+
10+
[source,terminal]
11+
----
12+
$ curl -X GET "https://quay-server.example.com/api/v1/repository/example_namespace/example_repo/trigger/" \
13+
-H "Authorization: Bearer <your_access_token>"
14+
----
15+
+
16+
.Example output
17+
+
18+
[source,terminal]
19+
----
20+
{"triggers": [{"id": "32ca5eae-a29f-46c7-8f44-3221ca417c92", "service": "custom-git", "is_active": false, "build_source": null, "repository_url": null, "config": {}, "can_invoke": true, "enabled": true, "disabled_reason": null}]}
21+
----
22+
23+
. Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#activatebuildtrigger[`POST /api/v1/repository/{repository}/trigger/{trigger_uuid}/activate`] endpoint to activate the specified build trigger.
24+
+
25+
[source,terminal]
26+
----
27+
$ curl -X POST "https://quay-server.example.com/api/v1/repository/example_namespace/example_repo/trigger/example-trigger-uuid/activate" \
28+
-H "Authorization: Bearer <your_access_token>" \
29+
-H "Content-Type: application/json" \
30+
-d '{
31+
"config": {
32+
"branch": "main"
33+
},
34+
"pull_robot": "example+robot"
35+
}'
36+
----
37+
38+
. Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#manuallystartbuildtrigger[`POST /api/v1/repository/{repository}/trigger/{trigger_uuid}/start`] endpoint to manually start the build from the specified trigger:
39+
+
40+
[source,terminal]
41+
----
42+
$ curl -X POST "https://quay-server.example.com/api/v1/repository/example_namespace/example_repo/trigger/example-trigger-uuid/start" \
43+
-H "Authorization: Bearer <your_access_token>" \
44+
-H "Content-Type: application/json" \
45+
-d '{
46+
"branch_name": "main",
47+
"commit_sha": "abcdef1234567890",
48+
"refs": "refs/heads/main"
49+
}'
50+
----
51+
52+
. Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#listtriggerrecentbuilds[`GET /api/v1/repository/{repository}/trigger/{trigger_uuid}/builds`] endpoint to list the builds started by the specified trigger:
53+
+
54+
[source,terminal]
55+
----
56+
$ curl -X GET "https://quay-server.example.com/api/v1/repository/example_namespace/example_repo/trigger/example-trigger-uuid/builds?limit=10" \
57+
-H "Authorization: Bearer <your_access_token>"
58+
----
59+
60+
. Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#getbuildtrigger[`GET /api/v1/repository/{repository}/trigger/{trigger_uuid}`] endpoint to get information for the specified build trigger:
61+
+
62+
[source,terminal]
63+
----
64+
$ curl -X GET "https://quay-server.example.com/api/v1/repository/example_namespace/example_repo/trigger/example-trigger-uuid" \
65+
-H "Authorization: Bearer <your_access_token>"
66+
----
67+
68+
. Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#updatebuildtrigger[`PUT /api/v1/repository/{repository}/trigger/{trigger_uuid}`] endpoint to update the specified build trigger:
69+
+
70+
[source,terminal]
71+
----
72+
$ curl -X PUT "https://quay-server.example.com/api/v1/repository/example_namespace/example_repo/trigger/example-trigger-uuid" \
73+
-H "Authorization: Bearer <your_access_token>" \
74+
-H "Content-Type: application/json" \
75+
-d '{"enabled": true}'
76+
----
77+
78+
. Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#deletebuildtrigger[`DELETE /api/v1/repository/{repository}/trigger/{trigger_uuid}`] endpoint to delete the specified build trigger:
79+
+
80+
[source,terminal]
81+
----
82+
$ curl -X DELETE "https://quay-server.example.com/api/v1/repository/example_namespace/example_repo/trigger/example-trigger-uuid" \
83+
-H "Authorization: Bearer <your_access_token>"
84+
----

modules/managing-user-options-api.adoc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Some user options, like starring a repository, or getting information about your
55

66
.Procedure
77

8-
. Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/3.13/html-single/red_hat_quay_api_guide/index#getloggedinuser[`GET /api/v1/user/`] endpoint to get user information for the authenticated user.
8+
. Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#getloggedinuser[`GET /api/v1/user/`] endpoint to get user information for the authenticated user.
99
+
1010
[source,terminal]
1111
----
@@ -20,8 +20,7 @@ $ curl -X GET "https://quay-server.example.com/api/v1/user/" \
2020
{"anonymous": false, "username": "quayadmin", "avatar": {"name": "quayadmin", "hash": "6d640d802fe23b93779b987c187a4b7a4d8fbcbd4febe7009bdff58d84498fba", "color": "#f7b6d2", "kind": "user"}, "can_create_repo": true, "is_me": true, "verified": true, "email": "[email protected]", "logins": [], "invoice_email": false, "invoice_email_address": null, "preferred_namespace": false, "tag_expiration_s": 1209600, "prompts": [], "company": null, "family_name": null, "given_name": null, "location": null, "is_free_account": true, "has_password_set": true, "quotas": [{"id": 4, "limit_bytes": 2199023255552, "limits": [{"id": 3, "type": "Reject", "limit_percent": 100}]}], "quota_report": {"quota_bytes": 2280675, "configured_quota": 2199023255552, "running_backfill": "complete", "backfill_status": "complete"}, "organizations": [{"name": "test", "avatar": {"name": "test", "hash": "a15d479002b20f211568fd4419e76686d2b88a4980a5b4c4bc10420776c5f6fe", "color": "#aec7e8", "kind": "org"}, "can_create_repo": true, "public": false, "is_org_admin": true, "preferred_namespace": false}, {"name": "sample", "avatar": {"name": "sample", "hash": "ba560c68f1d26e8c6b911ac9b5d10d513e7e43e576cc2baece1b8a46f36a29a5", "color": "#b5cf6b", "kind": "org"}, "can_create_repo": true, "public": false, "is_org_admin": true, "preferred_namespace": false}], "super_user": true}
2121
----
2222

23-
. Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/3.13/html-single/red_hat_quay_api_guide/index#getuserinformation[`GET /api/v1/users/{username}`] endpoint to get user information for the specified user.
24-
23+
. Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#getuserinformation[`GET /api/v1/users/{username}`] endpoint to get user information for the specified user.
2524
+
2625
[source,terminal]
2726
----
@@ -36,7 +35,7 @@ $ curl -X GET "https://quay-server.example.com/api/v1/users/example_user" \
3635
{"anonymous": false, "username": "testuser", "avatar": {"name": "testuser", "hash": "f660ab912ec121d1b1e928a0bb4bc61b15f5ad44d5efdc4e1c92a25e99b8e44a", "color": "#6b6ecf", "kind": "user"}, "super_user": false}
3736
----
3837

39-
. Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/3.13/html-single/red_hat_quay_api_guide/index#createstar[`POST /api/v1/user/starred`] endpoint to star a repository:
38+
. Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#createstar[`POST /api/v1/user/starred`] endpoint to star a repository:
4039
+
4140
[source,terminal]
4241
----

0 commit comments

Comments
 (0)