Skip to content

Commit 78f53a4

Browse files
stevsmitSteven Smith
andauthored
Adds swagger ui instructions (quay#1267)
Co-authored-by: Steven Smith <[email protected]>
1 parent 3a813f7 commit 78f53a4

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed

api/master.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ include::modules/creating-v2-oauth-access-token.adoc[leveloffset=+2]
4747
include::modules/enabling-using-the-api.adoc[leveloffset=+1]
4848
include::modules/configuring-api-calls.adoc[leveloffset=+2]
4949
include::modules/using-the-api.adoc[leveloffset=+2]
50+
include::modules/accessing-swagger-ui.adoc[leveloffset=+2]
5051
include::modules/automating-quay-using-the-api.adoc[leveloffset=+2]
5152
5253

modules/accessing-swagger-ui.adoc

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
:_content-type: REFERENCE
2+
[id="accessing-swagger-ui"]
3+
= Accessing {productname} Swagger UI
4+
5+
{productname} administrators and users can interacting with the API by using the Swagger UI-an interactive web interface that compiles executable commands. The Swagger UI can be launched as a container that points to your {productname} instance's API discovery endpoint (`/api/v1/discovery`). After deploying the container, you can access the Swagger UI, which loads the OpenAPI specification for {productname} from the specified URL. {productname} administrators and users can explore the available endpoints and their structure.
6+
7+
Use the following procedure to access the {productname} Swagger UI.
8+
9+
.Procedure
10+
11+
. Enter the following command to deploy the Swagger UI container, pointing the URL to your {productname}'s API discovery endpoint. For example:
12+
+
13+
[source,terminal]
14+
----
15+
$ podman run -p 8080:8080 -e SWAGGER_JSON_URL=<quay-server.example.com> docker.swagger.io/swaggerapi/swagger-ui
16+
----
17+
+
18+
.Example output
19+
+
20+
[source,terminal]
21+
----
22+
---
23+
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
24+
20-envsubst-on-templates.sh: Running envsubst on /etc/nginx/templates/default.conf.template to /etc/nginx/conf.d/default.conf
25+
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
26+
/docker-entrypoint.sh: Launching /docker-entrypoint.d/40-swagger-ui.sh
27+
/docker-entrypoint.sh: Configuration complete; ready for start up
28+
---
29+
----
30+
31+
. Navigate to the `localhost` URL. In this example, it is *http://localhost:8080/*.
32+
33+
. Use the Swagger UI to test various API endpoints. For example, to create a new token for a user, you can click the *POST /api/v1/user/apptoken* endpoint -> *Try it out* -> *Execute* to generate an example `curl` command.
34+
+
35+
[NOTE]
36+
====
37+
Currently, server responses cannot be generated. This is because the Swagger UI is not set up to accept bearer tokens. As a result, the following error is returned for each command: `{"error": "CSRF token was invalid or missing."}`. As a workaround, you can copy this command into your terminal and manually add your bearer token, for example, `-H 'Authorization: Bearer <bearer_token>'`
38+
====

modules/using-the-api.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ After you have created an application and generated an OAuth 2 access token with
66

77
[source,terminal]
88
----
9-
$ curl -X GET -H "Authorization: Bearer <your_access_token>" <1>
9+
$ curl -X GET -H "Authorization: Bearer <your_access_token>" \ <1>
1010
https://<quay-server.example.com>/api/v1/<example>/<endpoint>/ <2>
1111
----
1212
<1> The OAuth 2 access token that was generated through the {productname} UI.
@@ -21,7 +21,7 @@ Create a new app specific token for user. <2>
2121
2222
*POST /api/v1/user/apptoken* <3>
2323
24-
**Authorizations: **oauth2_implicit (**user:admin**) <4>
24+
**Authorizations: **oauth2_implicit (**user:admin**) <4>
2525
2626
Request body schema (application/json)
2727

0 commit comments

Comments
 (0)