Example: Creating, Updating, and Deleting Apps and Authorizations

๐Ÿ“˜

Reading apps and keys

This page covers creating, updating, and deleting apps and keys using the REST Platform API. For reading apps and keys, see Example: Obtaining apps and keys for users and teams.

The examples below use the REST Platform API.

Creating an app

You can use the POST Create App endpoint to create an app for the team or personal account context selected in the team dropdown. In the body of the request, you must pass a JSON object with the name of the app, as well as an option description.

The call to Create App returns the new appId as well as the value of the X-RapidAPI-Key that is automatically created when creating the app. The key is associated with the Production applicationEnvironmentName. The Testing applicationEnvironmentName is not used.

Here's an example where we create an app for Team A1 (selected in the team dropdown offscreen):

Creating an app using the Create App endpoint.

Creating an app using the Create App endpoint.

You can then view the new app in the team's Developer Dashboard (Apps). The appID is shown under the new app name. The Description is shown in the Configuration tab. The X-RapidAPI-Key is in the Authorization tab.

Viewing the new app in the Developer Dashboard (Apps).

Viewing the new app in the Developer Dashboard (Apps).

The new app's information is also available programmatically. See Example: Obtaining apps and keys for users and teams.

If you have Admin access to the Platform API, you can use the optional on-behalf-of header to create apps to be owned by any team or user. The value of the on-behalf-of header is the team or user ID.

Here is an example that creates an app to be owned by a user with the ID of 5713300:

Creating an app for another user or team using the on-behalf-of header.

Creating an app for another user or team using the on-behalf-of header.

Create an authorization within an app

Currently, you must use the GraphQL Platform API to create an authorization (or X-RapidAPI-Key) within an app. This uses mutation.createApplicationAuthorization. See API Access Provisioning (Preview)

Updating an app

Use the PUT Update App endpoint to update an app's name or description. You must pass the appId (obtained above) to identify which app you would like to update.

If you have Admin access to the Platform API, you can use the optional on-behalf-of header to update apps owned by any team or user. The value of the on-behalf-of header is the team or user ID.

The Update App endpoint returns 204 Success if the update is successful.

Updating an app including the optional on-behalf-of header.

Updating an app including the optional on-behalf-of header.

Update an authorization within the app

Currently, you must use the GraphQL Platform API to update an authorization (or X-RapidAPI-Key) within an app. This uses mutation.updateApplicationAuthorization. See Apps and authorizations.

Deleting an app

Use the DELETE DELETE App endpoint to delete an app. You must pass the appId (obtained above) to identify which app you would like to delete.

If you have Admin access to the Platform API, you can use the optional on-behalf-of header to delete apps owned by any team or user. The value of the on-behalf-of header is the team or user ID.

The Delete App endpoint returns 204 Success if the update is successful.

Deleting an app including the optional on-behalf-of header.

Deleting an app including the optional on-behalf-of header.

Delete an authorization within an app

Currently, you must use the GraphQL Platform API to delete an authorization (or X-RapidAPI-Key) within an app. This uses mutation.deleteApplicationAuthorization. See Apps and authorizations.