Skip to content

Commit 92ba17c

Browse files
stevsmitSteven Smith
andauthored
Adds several API command examples (quay#1191)
Co-authored-by: Steven Smith <[email protected]>
1 parent 6d3bd1b commit 92ba17c

15 files changed

+242
-7
lines changed

api/master.adoc

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,22 @@ include::modules/using-the-api.adoc[leveloffset=+2]
4949
include::modules/automating-quay-using-the-api.adoc[leveloffset=+2]
5050
5151
52-
53-
include::modules/creating-oauth-application-api.adoc[leveloffset=+1]
54-
55-
52+
//API examples
53+
include::modules/quay-api-examples.adoc[leveloffset=+1]
54+
//application
55+
include::modules/creating-oauth-application-api.adoc[leveloffset=+2]
56+
//discovery
57+
include::modules/discovering-quay-api-endpoints.adoc[leveloffset=+2]
58+
//error
59+
include::modules/quay-error-details.adoc[leveloffset=+2]
60+
//global message
61+
include::modules/api-global-messages.adoc[leveloffset=+2]
62+
//viewing logs (aggregate)
63+
include::modules/viewing-usage-logs-api.adoc[leveloffset=+2]
64+
//exporting logs
65+
include::modules/use-quay-export-logs-api.adoc[leveloffset=+2]
66+
//manifest label
67+
include::modules/adding-managing-labels-api.adoc[leveloffset=+2]
5668
5769
//include::modules/proc_use-api.adoc[leveloffset=+1]
5870
@@ -64,7 +76,7 @@ This API allows you to perform many of the operations required to work with {pro
6476
6577
include::modules/api-authorization.adoc[leveloffset=+2]
6678
67-
79+
//example procedures provided
6880
include::modules/api-appspecifictokens.adoc[leveloffset=+2]
6981
include::modules/api-appspecifictokens-createAppToken.adoc[leveloffset=+3]
7082
include::modules/api-appspecifictokens-listAppTokens.adoc[leveloffset=+3]
@@ -79,17 +91,21 @@ include::modules/api-build-cancelRepoBuild.adoc[leveloffset=+3]
7991
include::modules/api-build-requestRepoBuild.adoc[leveloffset=+3]
8092
include::modules/api-build-getRepoBuilds.adoc[leveloffset=+3]
8193
94+
//example procedures provided
8295
include::modules/api-discovery.adoc[leveloffset=+2]
8396
include::modules/api-discovery-discovery.adoc[leveloffset=+3]
8497
98+
//example procedures provided
8599
include::modules/api-error.adoc[leveloffset=+2]
86100
include::modules/api-error-getErrorDescription.adoc[leveloffset=+3]
87101
102+
//example procedures provided
88103
include::modules/api-globalmessages.adoc[leveloffset=+2]
89104
include::modules/api-globalmessages-createGlobalMessage.adoc[leveloffset=+3]
90105
include::modules/api-globalmessages-getGlobalMessages.adoc[leveloffset=+3]
91106
include::modules/api-globalmessages-deleteGlobalMessage.adoc[leveloffset=+3]
92107
108+
//example procedures provided
93109
include::modules/api-logs.adoc[leveloffset=+2]
94110
include::modules/api-logs-getAggregateUserLogs.adoc[leveloffset=+3]
95111
include::modules/api-logs-exportUserLogs.adoc[leveloffset=+3]
@@ -101,6 +117,7 @@ include::modules/api-logs-getAggregateRepoLogs.adoc[leveloffset=+3]
101117
include::modules/api-logs-exportRepoLogs.adoc[leveloffset=+3]
102118
include::modules/api-logs-listRepoLogs.adoc[leveloffset=+3]
103119
120+
//example procedures provided
104121
include::modules/api-manifest.adoc[leveloffset=+2]
105122
include::modules/api-manifest-getManifestLabel.adoc[leveloffset=+3]
106123
include::modules/api-manifest-deleteManifestLabel.adoc[leveloffset=+3]

modules/api-appspecifictokens-createAppToken.adoc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,16 @@ _required_|Friendly name to help identify the token|string
3636
|403|Unauthorized access|&lt;&lt;_apierror,ApiError&gt;&gt;
3737
|404|Not found|&lt;&lt;_apierror,ApiError&gt;&gt;
3838
|===
39+
40+
[discrete]
41+
== Example command
42+
[source,terminal]
43+
----
44+
$ curl -X POST \
45+
-H "Authorization: Bearer <access_token>" \
46+
-H "Content-Type: application/json" \
47+
-d '{
48+
"title": "MyAppToken"
49+
}' \
50+
"http://quay-server.example.com/api/v1/user/apptoken"
51+
----

modules/api-appspecifictokens-getAppToken.adoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,12 @@ _required_|The uuid of the app specific token|string
3333
|403|Unauthorized access|&lt;&lt;_apierror,ApiError&gt;&gt;
3434
|404|Not found|&lt;&lt;_apierror,ApiError&gt;&gt;
3535
|===
36+
37+
[discrete]
38+
== Example command
39+
[source,terminal]
40+
----
41+
$ curl -X GET \
42+
-H "Authorization: Bearer <access_token>" \
43+
"http://quay-server.example.com/api/v1/user/apptoken/<token_uuid>"
44+
----

modules/api-appspecifictokens-listAppTokens.adoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,12 @@ _optional_|If true, only returns those tokens expiring soon|boolean
3434
|403|Unauthorized access|&lt;&lt;_apierror,ApiError&gt;&gt;
3535
|404|Not found|&lt;&lt;_apierror,ApiError&gt;&gt;
3636
|===
37+
38+
[discrete]
39+
== Example command
40+
[source,terminal]
41+
----
42+
$ curl -X GET \
43+
-H "Authorization: Bearer <access_token>" \
44+
"http://quay-server.example.com/api/v1/user/apptoken"
45+
----

modules/api-appspecifictokens-revokeAppToken.adoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,12 @@ _required_|The uuid of the app specific token|string
3333
|403|Unauthorized access|&lt;&lt;_apierror,ApiError&gt;&gt;
3434
|404|Not found|&lt;&lt;_apierror,ApiError&gt;&gt;
3535
|===
36+
37+
[discrete]
38+
== Example command
39+
[source,terminal]
40+
----
41+
$ curl -X DELETE \
42+
-H "Authorization: Bearer <access_token>" \
43+
"http://quay-server.example.com/api/v1/user/apptoken/<token_uuid>"
44+
----

modules/api-discovery-discovery.adoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,12 @@ _optional_|Whether to include internal APIs.|boolean
3232
|403|Unauthorized access|&lt;&lt;_apierror,ApiError&gt;&gt;
3333
|404|Not found|&lt;&lt;_apierror,ApiError&gt;&gt;
3434
|===
35+
36+
[discrete]
37+
== Example command
38+
39+
[source,terminal]
40+
----
41+
$ curl -X GET "https://<quay-server.example.com>/api/v1/discovery?query=true" \
42+
-H "Authorization: Bearer <access_token>"
43+
----

modules/api-error-getErrorDescription.adoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,12 @@ _required_|The error code identifying the type of error.|string
3131
|403|Unauthorized access|&lt;&lt;_apierror,ApiError&gt;&gt;
3232
|404|Not found|&lt;&lt;_apierror,ApiError&gt;&gt;
3333
|===
34+
35+
[discrete]
36+
== Example command
37+
38+
[source,terminal]
39+
----
40+
$ curl -X GET "https://<quay-server.example.com>/api/v1/error/<error_type>" \
41+
-H "Authorization: Bearer <access_token>"
42+
----

modules/api-global-messages.adoc

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
:_content-type: PROCEDURE
2+
[id="api-global-messages"]
3+
= Global messages
4+
5+
Global messages can be created, obtained, or deleted by using the {productname} API.
6+
Use the following procedure to create, obtain, or delete a global message.
7+
8+
.Prerequisites
9+
10+
* You have created an OAuth 2 access token.
11+
12+
.Procedure
13+
14+
. Create a message by using the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#createglobalmessage[`POST /api/v1/message] endpoint:
15+
+
16+
[source,terminal]
17+
----
18+
$ curl -X POST "https://quay-server.example.com/api/v1/messages" \
19+
-H "Authorization: Bearer wplKtAuAX6DzAJwtB3X77nc18RFj2TKE5gTEk5K2" \
20+
-H "Content-Type: application/json" \
21+
-d '{
22+
"message": {
23+
"content": "Hi",
24+
"media_type": "text/plain",
25+
"severity": "info"
26+
}
27+
}'
28+
----
29+
+
30+
This command does not return output.
31+
32+
. Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/{productname}/html-single/red_hat_quay_api_guide/index#getglobalmessages[`GET /api/v1/messages`] command to return the list of global messages:
33+
+
34+
[source,terminal]
35+
----
36+
$ curl -X GET "https://<quay-server.example.com>/api/v1/messages" \
37+
-H "Authorization: Bearer <access_token>"
38+
----
39+
+
40+
.Example output
41+
+
42+
[source,terminal]
43+
----
44+
{"messages": [{"uuid": "ecababd4-3451-4458-b5db-801684137444", "content": "Hi", "severity": "info", "media_type": "text/plain"}]}
45+
----
46+
47+
. Delete the global message by using the link:https://docs.redhat.com/en/documentation/red_hat_quay/{productname}/html-single/red_hat_quay_api_guide/index#deleteglobalmessage[`DELETE /api/v1/message/{uuid}`] endpoint:
48+
+
49+
[source,terminal]
50+
----
51+
$ curl -X DELETE "https://<quay-server.example.com>/api/v1/message/<uuid>" \
52+
-H "Authorization: Bearer <access_token>"
53+
----
54+
+
55+
This command does not return output.

modules/api-globalmessages-createGlobalMessage.adoc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,19 @@ _required_|A single message|object
3636
|403|Unauthorized access|&lt;&lt;_apierror,ApiError&gt;&gt;
3737
|404|Not found|&lt;&lt;_apierror,ApiError&gt;&gt;
3838
|===
39+
40+
[discrete]
41+
== Example command
42+
[source,terminal]
43+
----
44+
$ curl -X POST "https://quay-server.example.com/api/v1/messages" \
45+
-H "Authorization: Bearer wplKtAuAX6DzAJwtB3X77nc18RFj2TKE5gTEk5K2" \
46+
-H "Content-Type: application/json" \
47+
-d '{
48+
"message": {
49+
"content": "Hi",
50+
"media_type": "text/plain",
51+
"severity": "info"
52+
}
53+
}'
54+
----

modules/api-globalmessages-deleteGlobalMessage.adoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,11 @@ _required_||string
3333
|403|Unauthorized access|&lt;&lt;_apierror,ApiError&gt;&gt;
3434
|404|Not found|&lt;&lt;_apierror,ApiError&gt;&gt;
3535
|===
36+
37+
[discrete]
38+
== Example command
39+
[source,terminal]
40+
----
41+
$ curl -X DELETE "https://<quay-server.example.com>/api/v1/message/<uuid>" \
42+
-H "Authorization: Bearer <access_token>"
43+
----

0 commit comments

Comments
 (0)