Skip to content

Commit 9339b97

Browse files
stevsmitSteven Smith
andauthored
Adds repo notifications to API book (quay#1204)
Co-authored-by: Steven Smith <[email protected]>
1 parent 10606e9 commit 9339b97

File tree

2 files changed

+124
-1
lines changed

2 files changed

+124
-1
lines changed

api/master.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ include::modules/creating-repository-policy-api.adoc[leveloffset=+3]
9999
include::modules/creating-policy-api-other-user.adoc[leveloffset=+3]
100100
//repo
101101
include::modules/repo-manage-api.adoc[leveloffset=+2]
102-
102+
include::modules/repo-creation-management.adoc[leveloffset=+3]
103+
include::modules/creating-notifications-api.adoc[leveloffset=+3]
103104
104105
105106
// team member management?
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
[id="repo-creation-api"]
2+
= Creating and configuring repositories by using the {productname} API
3+
4+
Repositories can be created, retrieved, changed, and deleted by using the {productname} API.
5+
6+
.Procedure
7+
8+
. Enter the following command to create a repository using the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#createrepo[`POST /api/v1/repository`] endpoint:
9+
+
10+
[source,terminal]
11+
----
12+
$ curl -X POST \
13+
-H "Authorization: Bearer <bearer_token>" \
14+
-H "Content-Type: application/json" \
15+
-d '{
16+
"repository": "<new_repository_name>",
17+
"visibility": "<private>",
18+
"description": "<This is a description of the new repository>."
19+
}' \
20+
"https://quay-server.example.com/api/v1/repository"
21+
----
22+
+
23+
.Example output
24+
+
25+
[source,terminal]
26+
----
27+
{"namespace": "quayadmin", "name": "<new_repository_name>", "kind": "image"}
28+
----
29+
30+
. You can list a repositories with the link:https://docs.redhat.com/en/documentation/red_hat_quay/3/html-single/red_hat_quay_api_guide/index#listrepos[`GET /api/v1/repository`] endpoint. For example:
31+
+
32+
[source,terminal]
33+
----
34+
$ curl -X GET \
35+
-H "Authorization: Bearer <ACCESS_TOKEN>" \
36+
"https://quay-server.example.com/api/v1/repository?public=true&starred=false&namespace=<NAMESPACE>"
37+
----
38+
+
39+
.Example output
40+
+
41+
[source,terminal]
42+
----
43+
{"repositories": [{"namespace": "quayadmin", "name": "busybox", "description": null, "is_public": false, "kind": "image", "state": "MIRROR", "is_starred": false, "quota_report": {"quota_bytes": 2280675, "configured_quota": 2199023255552}}]}
44+
----
45+
46+
. Visibility can be changed from public to private with the link:https://docs.redhat.com/en/documentation/red_hat_quay/3/html-single/red_hat_quay_api_guide/index#changerepovisibility[`POST /api/v1/repository/{repository}/changevisibility`] endpoint:
47+
+
48+
[source,terminal]
49+
----
50+
$ curl -X POST \
51+
-H "Authorization: Bearer <ACCESS_TOKEN>" \
52+
-H "Content-Type: application/json" \
53+
-d '{
54+
"visibility": "private"
55+
}' \
56+
"https://quay-server.example.com/api/v1/repository/<NAMESPACE>/<REPO_NAME>/changevisibility"
57+
----
58+
.Example output
59+
+
60+
[source,terminal]
61+
----
62+
{"success": true}
63+
----
64+
65+
. You can check the {productname} UI, or you can enter the following link:https://docs.redhat.com/en/documentation/red_hat_quay/3/html-single/red_hat_quay_api_guide/index#getrepo[`GET /api/v1/repository/{repository}`] command to return details about a repository:
66+
+
67+
[source,terminal]
68+
----
69+
$ curl -X GET -H "Authorization: Bearer <bearer_token>" "<quay-server.example.com>/api/v1/repository/<namespace>/<repository_name>"
70+
----
71+
+
72+
Example output
73+
+
74+
[source,terminal]
75+
----
76+
{"detail": "Not Found", "error_message": "Not Found", "error_type": "not_found", "title": "not_found", "type": "http://quay-server.example.com/api/v1/error/not_found", "status": 404}
77+
----
78+
79+
. Repository descriptions can be updated with the link:https://docs.redhat.com/en/documentation/red_hat_quay/3/html-single/red_hat_quay_api_guide/index#updaterepo[`PUT /api/v1/repository/{repository}`] endpoint:
80+
+
81+
[source,terminal]
82+
----
83+
$ curl -X PUT \
84+
-H "Authorization: Bearer <bearer_token>" \
85+
-H "Content-Type: application/json" \
86+
-d '{
87+
"description": "This is an updated description for the repository."
88+
}' \
89+
"https://quay-server.example.com/api/v1/repository/<NAMESPACE>/<REPOSITORY>"
90+
----
91+
+
92+
.Example output
93+
+
94+
[source,terminal]
95+
----
96+
{"success": true}
97+
----
98+
99+
. Enter the following command to delete a repository using the link:https://docs.redhat.com/en/documentation/red_hat_quay/3/html-single/red_hat_quay_api_guide/index#deleterepository[`DELETE /api/v1/repository/{repository}`] endpoint:
100+
+
101+
[source,terminal]
102+
----
103+
$ curl -X DELETE -H "Authorization: Bearer <bearer_token>" "<quay-server.example.com>/api/v1/repository/<namespace>/<repository_name>"
104+
----
105+
+
106+
This command does not return output in the CLI.
107+
108+
////
109+
. The link:https://docs.redhat.com/en/documentation/red_hat_quay/3/html-single/red_hat_quay_api_guide/index#changerepostate[`PUT /api/v1/repository/{repository}/changestate`] API endpoint can be used to change the state of the repository:
110+
+
111+
[source,terminal]
112+
----
113+
114+
----
115+
+
116+
.Example output
117+
+
118+
[source,terminal]
119+
----
120+
121+
----
122+
////

0 commit comments

Comments
 (0)