Skip to content

Commit b529ea3

Browse files
stevsmitSteven Smith
andauthored
Adds robot account token endpoints (quay#1207)
Co-authored-by: Steven Smith <[email protected]>
1 parent 77fd30b commit b529ea3

File tree

3 files changed

+86
-0
lines changed

3 files changed

+86
-0
lines changed

api/master.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ include::modules/creating-policy-api-other-user.adoc[leveloffset=+3]
101101
include::modules/repo-manage-api.adoc[leveloffset=+2]
102102
include::modules/repo-creation-management.adoc[leveloffset=+3]
103103
include::modules/creating-notifications-api.adoc[leveloffset=+3]
104+
//robot account
105+
include::modules/robot-account-manage-api.adoc[leveloffset=+2]
106+
include::modules/creating-robot-account-api.adoc[leveloffset=+3]
107+
include::modules/robot-account-permissions-api.adoc[leveloffset=+3]
108+
include::modules/deleting-robot-account-api.adoc[leveloffset=+3]
109+
104110
105111
106112
// team member management?
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[id="robot-account-manage-api"]
2+
= Creating and configuring robot accounts by using the {productname} API
3+
4+
Robot accounts can be created, retrieved, changed, and deleted for both organizations and users by using the {productname} API.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
:_content-type: CONCEPT
2+
[id="robot-account-permissions-api"]
3+
= Obtaining robot account information by using the {productname} API
4+
5+
Robot account information, such as permissions, can be obtained for both organizations and users by using the {productname} API.
6+
7+
.Prerequisites
8+
9+
* You have link:https://access.redhat.com/documentation/en-us/red_hat_quay/3/html-single/red_hat_quay_api_guide/index#creating-oauth-access-token[Created an OAuth access token].
10+
* You have set `BROWSER_API_CALLS_XHR_ONLY: false` in your `config.yaml` file.
11+
12+
.Procedure
13+
14+
* Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/3/html-single/red_hat_quay_api_guide/index#getorgrobot[`GET /api/v1/organization/{orgname}/robots/{robot_shortname}`] API endpoint to return information for a robot for an organization:
15+
+
16+
[source,terminal]
17+
----
18+
curl -X GET \
19+
-H "Authorization: Bearer <bearer_token>" \
20+
"https://quay-server.example.com/api/v1/organization/<ORGNAME>/robots/<ROBOT_SHORTNAME>"
21+
----
22+
+
23+
.Example output
24+
+
25+
[source,terminal]
26+
----
27+
{"name": "test+example", "created": "Mon, 25 Nov 2024 16:25:16 -0000", "last_accessed": null, "description": "", "token": "BILZ6YTVAZAKOGMD9270OKN3SOD9KPB7OLKEJQOJE38NBBRUJTIH7T5859DJL31Q", "unstructured_metadata": {}}
28+
----
29+
30+
* Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#getorgrobotpermissions[`GET /api/v1/organization/{orgname}/robots/{robot_shortname}/permissions`] endpoint to return the list of permissions for a specific organization robot:
31+
+
32+
[source,terminal]
33+
----
34+
$ curl -X GET \
35+
-H "Authorization: Bearer <bearer_token>" \
36+
"https://quay-server.example.com/api/v1/organization/<ORGNAME>/robots/<ROBOT_SHORTNAME>/permissions"
37+
----
38+
+
39+
.Example output
40+
+
41+
[source,terminal]
42+
----
43+
{"permissions": [{"repository": {"name": "testrepo", "is_public": true}, "role": "admin"}]}
44+
----
45+
46+
* Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/3/html-single/red_hat_quay_api_guide/index#getuserrobot[`GET /api/v1/user/robots/{robot_shortname}`] API endpoint to return the user's robot with the specified name:
47+
+
48+
[source,terminal]
49+
----
50+
$ curl -X GET \
51+
-H "Authorization: Bearer <bearer_token>" \
52+
"https://quay-server.example.com/api/v1/user/robots/<ROBOT_SHORTNAME>"
53+
----
54+
+
55+
.Example output
56+
+
57+
[source,terminal]
58+
----
59+
{"name": "quayadmin+mirror_robot", "created": "Wed, 15 Jan 2025 17:22:09 -0000", "last_accessed": null, "description": "", "token": "QBFYWIWZOS1I0P0R9N1JRNP1UZAOPUIR3EB4ASPZKK9IA1SFC12LTEF7OJHB05Z8", "unstructured_metadata": {}}
60+
----
61+
62+
* Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/3/html-single/red_hat_quay_api_guide/index#getuserrobotpermissions[`GET /api/v1/user/robots/{robot_shortname}/permissions`] API endpoint to return a list of permissions for the user robot:
63+
+
64+
[source,terminal]
65+
----
66+
$ curl -X GET \
67+
-H "Authorization: Bearer <bearer_token>" \
68+
"https://quay-server.example.com/api/v1/user/robots/<ROBOT_SHORTNAME>/permissions"
69+
----
70+
+
71+
.Example output
72+
+
73+
[source,terminal]
74+
----
75+
{"permissions": [{"repository": {"name": "busybox", "is_public": false}, "role": "write"}]}
76+
----

0 commit comments

Comments
 (0)