-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds several API command examples (#1191)
Co-authored-by: Steven Smith <[email protected]>
- Loading branch information
Showing
15 changed files
with
242 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
:_content-type: PROCEDURE | ||
[id="api-global-messages"] | ||
= Global messages | ||
|
||
Global messages can be created, obtained, or deleted by using the {productname} API. | ||
Use the following procedure to create, obtain, or delete a global message. | ||
|
||
.Prerequisites | ||
|
||
* You have created an OAuth 2 access token. | ||
.Procedure | ||
|
||
. 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: | ||
+ | ||
[source,terminal] | ||
---- | ||
$ curl -X POST "https://quay-server.example.com/api/v1/messages" \ | ||
-H "Authorization: Bearer wplKtAuAX6DzAJwtB3X77nc18RFj2TKE5gTEk5K2" \ | ||
-H "Content-Type: application/json" \ | ||
-d '{ | ||
"message": { | ||
"content": "Hi", | ||
"media_type": "text/plain", | ||
"severity": "info" | ||
} | ||
}' | ||
---- | ||
+ | ||
This command does not return output. | ||
|
||
. 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: | ||
+ | ||
[source,terminal] | ||
---- | ||
$ curl -X GET "https://<quay-server.example.com>/api/v1/messages" \ | ||
-H "Authorization: Bearer <access_token>" | ||
---- | ||
+ | ||
.Example output | ||
+ | ||
[source,terminal] | ||
---- | ||
{"messages": [{"uuid": "ecababd4-3451-4458-b5db-801684137444", "content": "Hi", "severity": "info", "media_type": "text/plain"}]} | ||
---- | ||
|
||
. 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: | ||
+ | ||
[source,terminal] | ||
---- | ||
$ curl -X DELETE "https://<quay-server.example.com>/api/v1/message/<uuid>" \ | ||
-H "Authorization: Bearer <access_token>" | ||
---- | ||
+ | ||
This command does not return output. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
:_content-type: PROCEDURE | ||
[id="discovering-quay-api-endpoints"] | ||
= Discovering {productname} API endpoints | ||
|
||
{productname} API endpoints are discoverable by using the API. | ||
|
||
Use the following procedure to discover available API endpoints. | ||
|
||
.Prerequisites | ||
|
||
* You have created an OAuth 2 access token. | ||
.Procedure | ||
|
||
* Enter the following link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#discovery_2[`GET /api/v1/discovery`] command to list all of the API endpoints available in the swagger API format: | ||
+ | ||
[source,terminal] | ||
---- | ||
$ curl -X GET "https://<quay-server.example.com>/api/v1/discovery?query=true" \ | ||
-H "Authorization: Bearer <access_token>" | ||
---- | ||
+ | ||
.Example output | ||
+ | ||
[source,terminal] | ||
---- | ||
--- | ||
: "Manage the tags of a repository."}, {"name": "team", "description": "Create, list and manage an organization's teams."}, {"name": "trigger", "description": "Create, list and manage build triggers."}, {"name": "user", "description": "Manage the current user."}, {"name": "userfiles", "description": ""}]} | ||
--- | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
:_content-type: CONCEPT | ||
[id="quay-api-examples"] | ||
= {productname} API examples | ||
|
||
The remainder of this chapter provides {productname} API examples for the features in which they are available. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
:_content-type: PROCEDURE | ||
[id="quay-error-details"] | ||
= Obtaining {productname} API error details | ||
|
||
{productname} API error details are discoverable by using the API. | ||
|
||
Use the following procedure to discover error details. | ||
|
||
.Prerequisites | ||
|
||
* You have created an OAuth 2 access token. | ||
.Procedure | ||
|
||
* You can obtain error details of the API by entering the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#geterrordescription[`GET /api/v1/error/{error_type}`] endpoint. Note that you must include one of the following error codes: | ||
+ | ||
[options="header", width=100%, cols=".^2a,.^14a,.^4a"] | ||
|=== | ||
|HTTP Code|Description|Schema | ||
|200|Successful invocation|<<_apierrordescription,ApiErrorDescription>> | ||
|400|Bad Request|<<_apierror,ApiError>> | ||
|401|Session required|<<_apierror,ApiError>> | ||
|403|Unauthorized access|<<_apierror,ApiError>> | ||
|404|Not found|<<_apierror,ApiError>> | ||
|=== | ||
+ | ||
[source,terminal] | ||
---- | ||
$ curl -X GET "https://<quay-server.example.com>/api/v1/error/<error_type>" \ | ||
-H "Authorization: Bearer <access_token>" | ||
---- | ||
+ | ||
.Example output | ||
+ | ||
[source,terminal] | ||
---- | ||
curl: (7) Failed to connect to quay-server.example.com port 443 after 0 ms: Couldn't connect to server | ||
---- |