|
| 1 | +// module included in the following assemblies: |
| 2 | + |
| 3 | +// * use_quay/master.adoc |
| 4 | + |
| 5 | +:_content-type: CONCEPT |
| 6 | +[id="org-application-create-api"] |
| 7 | += Creating an organization application by using the {productname} API |
| 8 | + |
| 9 | +Organization applications can be created by using the {productname} UI. |
| 10 | + |
| 11 | +[NOTE] |
| 12 | +==== |
| 13 | +Organization applications can be created by using the UI, however OAuth 2 access tokens must be created on the UI. |
| 14 | +==== |
| 15 | + |
| 16 | +.Procedure |
| 17 | + |
| 18 | +. Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#createorganizationapplication[`POST /api/v1/organization/{orgname}/applications`] endpoint to create a new application for your organization. For example: |
| 19 | ++ |
| 20 | +[source,terminal] |
| 21 | +---- |
| 22 | +$ curl -X POST "https://<quay-server.example.com>/api/v1/organization/<orgname>/applications" \ |
| 23 | + -H "Authorization: Bearer <access_token>" \ |
| 24 | + -H "Content-Type: application/json" \ |
| 25 | + -d '{ |
| 26 | + "name": "<app_name>", |
| 27 | + "redirect_uri": "<redirect_uri>", |
| 28 | + "application_uri": "<application_uri>", |
| 29 | + "description": "<app_description>", |
| 30 | + "avatar_email": "<avatar_email>" |
| 31 | + }' |
| 32 | +---- |
| 33 | ++ |
| 34 | +.Example output |
| 35 | ++ |
| 36 | +[source,terminal] |
| 37 | +---- |
| 38 | +{"name": "new-application", "description": "", "application_uri": "", "client_id": "E6GJSHOZMFBVNHTHNB53", "client_secret": "SANSWCWSGLVAUQ60L4Q4CEO3C1QAYGEXZK2VKJNI", "redirect_uri": "", "avatar_email": null} |
| 39 | +---- |
| 40 | + |
| 41 | +. Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#getorganizationapplications[`GET /api/v1/organization/{orgname}/applications`] endpoint to return a list of all organization applications. For example: |
| 42 | ++ |
| 43 | +[source,terminal] |
| 44 | +---- |
| 45 | +$ curl -X GET "https://<quay-server.example.com>/api/v1/organization/<orgname>/applications" \ |
| 46 | + -H "Authorization: Bearer <access_token>" |
| 47 | +---- |
| 48 | ++ |
| 49 | +.Example output |
| 50 | ++ |
| 51 | +[source,terminal] |
| 52 | +---- |
| 53 | +{"applications": [{"name": "test", "description": "", "application_uri": "", "client_id": "MCJ61D8KQBFS2DXM56S2", "client_secret": "J5G7CCX5QCA8Q5XZLWGI7USJPSM4M5MQHJED46CF", "redirect_uri": "", "avatar_email": null}, {"name": "new-token", "description": "", "application_uri": "", "client_id": "IG58PX2REEY9O08IZFZE", "client_secret": "2LWTWO89KH26P2CO4TWFM7PGCX4V4SUZES2CIZMR", "redirect_uri": "", "avatar_email": null}, {"name": "second-token", "description": "", "application_uri": "", "client_id": "6XBK7QY7ACSCN5XBM3GS", "client_secret": "AVKBOUXTFO3MXBBK5UJD5QCQRN2FWL3O0XPZZT78", "redirect_uri": "", "avatar_email": null}, {"name": "new-application", "description": "", "application_uri": "", "client_id": "E6GJSHOZMFBVNHTHNB53", "client_secret": "SANSWCWSGLVAUQ60L4Q4CEO3C1QAYGEXZK2VKJNI", "redirect_uri": "", "avatar_email": null}]} |
| 54 | +---- |
| 55 | ++ |
| 56 | +Applications can also be returned for a specific client using the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#getorganizationapplication[`GET /api/v1/organization/{orgname}/applications/{client_id}`] endpoint. For example: |
| 57 | ++ |
| 58 | +[source,terminal] |
| 59 | +---- |
| 60 | +$ curl -X GET "https://<quay-server.example.com>/api/v1/organization/<orgname>/applications/<client_id>" \ |
| 61 | + -H "Authorization: Bearer <access_token>" |
| 62 | +---- |
| 63 | ++ |
| 64 | +.Example output |
| 65 | ++ |
| 66 | +[source,terminal] |
| 67 | +---- |
| 68 | +{"name": "test", "description": "", "application_uri": "", "client_id": "MCJ61D8KQBFS2DXM56S2", "client_secret": "J5G7CCX5QCA8Q5XZLWGI7USJPSM4M5MQHJED46CF", "redirect_uri": "", "avatar_email": null} |
| 69 | +---- |
| 70 | + |
| 71 | +. After creation, organization applications can be updated, for example, if you want to add a redirect URI or a new description, using the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#updateorganizationapplication[`PUT /api/v1/organization/{orgname}/applications/{client_id}`] endpoint: |
| 72 | ++ |
| 73 | +[source,terminal] |
| 74 | +---- |
| 75 | +$ curl -X PUT "https://quay-server.example.com/api/v1/organization/test/applications/12345" \ |
| 76 | + -H "Authorization: Bearer wplKtAuAX6DzAJwtB3X77nc18RFj2TKE5gTEk5K2" \ |
| 77 | + -H "Content-Type: application/json" \ |
| 78 | + -d '{ |
| 79 | + "name": "Updated Application Name", |
| 80 | + "redirect_uri": "https://example.com/oauth/callback", |
| 81 | + "application_uri": "https://example.com", |
| 82 | + "description": "Updated description for the application", |
| 83 | + "avatar_email": "[email protected]" |
| 84 | + }' |
| 85 | +---- |
| 86 | + |
| 87 | +. After creation, application information can be returned by using the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#getapplicationinformation[`GET /api/v1/app/{client_id}`] endpoint: |
| 88 | ++ |
| 89 | +[source,terminal] |
| 90 | +---- |
| 91 | +$ curl -X GET "https://<quay-server.example.com>/api/v1/app/<client_id>" \ |
| 92 | + -H "Authorization: Bearer <access_token>" |
| 93 | +---- |
| 94 | ++ |
| 95 | +.Example output |
| 96 | ++ |
| 97 | +[source,terminal] |
| 98 | +---- |
| 99 | +{"name": "new-application3", "description": "", "uri": "", "avatar": {"name": "new-application3", "hash": "a15d479002b20f211568fd4419e76686d2b88a4980a5b4c4bc10420776c5f6fe", "color": "#aec7e8", "kind": "app"}, "organization": {"name": "test", "email": "[email protected]", "avatar": {"name": "test", "hash": "a15d479002b20f211568fd4419e76686d2b88a4980a5b4c4bc10420776c5f6fe", "color": "#aec7e8", "kind": "user"}, "is_admin": true, "is_member": true, "teams": {}, "ordered_teams": [], "invoice_email": true, "invoice_email_address": "[email protected]", "tag_expiration_s": 1209600, "is_free_account": true, "quotas": [{"id": 2, "limit_bytes": 10737418240, "limits": [{"id": 1, "type": "Reject", "limit_percent": 90}]}], "quota_report": {"quota_bytes": 0, "configured_quota": 10737418240, "running_backfill": "complete", "backfill_status": "complete"}}} |
| 100 | +---- |
| 101 | + |
| 102 | +. Organization applications can be deleted with the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#deleteorganizationapplication[`DELETE /api/v1/organization/{orgname}/applications/{client_id}`] endpoint. For example: |
| 103 | ++ |
| 104 | +[source,terminal] |
| 105 | +---- |
| 106 | +$ curl -X DELETE "https://<quay-server.example.com>/api/v1/organization/{orgname}/applications/{client_id}" \ |
| 107 | + -H "Authorization: Bearer <access_token>" |
| 108 | +---- |
| 109 | ++ |
| 110 | +This command does not return output. |
0 commit comments