RSC API Playground

API Playground is an integrated development environment (IDE) that you can use to browse, explore, and run GraphQL APIs offered by Rubrik Security Cloud (RSC). The IDE also provides reference to the latest Rubrik GraphQL API documentation. Running GraphQL queries and mutations in API Playground validates the GraphQL operations so that you can confirm that your queries or mutations will achieve the desired result when included in automation scripts.

After logging in to API Playground with your RSC user account credentials, you can choose to run GraphQL queries and mutations either as yourself or with a service account. The level of access you have for running the GraphQL queries and mutations depends on the RBAC roles assigned to your user account or to the service account you are using. For enhanced security, API Playground does not persist the service account access credentials.

Warning: If not used cautiously, the GraphQL mutations that you run in API Playground can result in data loss because they affect the data managed in real time by RSC.

Accessing API Playground

You can access API Playground through the RSC Settings menu or directly through a web browser. You can also use the global search in RSC to search for API Playground.

Procedure

  1. Log in to RSC.
  2. Open the app tray and select Settings. The Settings menu appears.
  3. Click API Playground. The API Playground page appears.
  4. Click Open API Playground. API Playground opens in a new browser tab.

The URL of the API Playground page is in the following format: https://rsc_domain_url/playground/, where, rsc_domain_url is the IPv4 address or resolvable hostname of your RSC domain.

You can also open API Playground directly in a web browser by using the preceding URL for your RSC domain.

Non-persistence of service account sessions on API Playground

When you use a service account to run GraphQL API operations in API Playground, for security reasons, API Playground does not persist the service account credentials and renders them invalid when the service account is not in use.

To run Rubrik GraphQL queries and mutations using service account credentials, the API Playground obtains an access token, which is valid for 24 hours. To maintain the security of your RSC domain, API Playground does not save the service account credentials or the access token in the browser session.

The following actions render the service account access token invalid and unusable for further requests:

When the service account access token is rendered invalid, you can continue to use API Playground with the user account that you previously used to log in to API Playground.

Using a service account to run GraphQL APIs

In API Playground, to test and validate the use of a service account in automation scripts, use a service account to run GraphQL queries and mutations.

Before you begin Add a service account with the required RBAC roles to run the GraphQL queries and mutations, as described in [#Adding a service account].

Procedure

  1. In a web browser, open API Playground. Open https://rsc_domain_url/playground/. Where, rsc_domain_url is the IPv4 address or resolvable hostname of your RSC domain. When a valid user session does not exist in the browser, the RSC login page appears.
  2. Log in to RSC. The API Playground web page appears.
  3. Click Test with Service Account.
  4. Enter the Client ID and Client Secret. The Client ID and Client Secret identify the service account you want to use to run the GraphQL APIs.
  5. Click Authenticate. RSC authenticates the service account credentials, using which you can test the GraphQL APIs on behalf of the service account.
  6. Optional: Click End Testing. API Playground ends the service account session and invalidates the service account access token for further use, but you can continue to run GraphQL API operations with the user acc ount that you used previously to log in to RSC.

API Playground user interface

API Playground leverages the powerful user interface of the GraphiQL integrated development environment (IDE). Using the API Playground user interface, you can refer to the latest Rubrik GraphQL API documentation. The interface also provides an editor, which you can use to compose your queries and mutations, and a results area, where you can see the result of the API operation.

The following table describes the icons available on the user interface and the associated functionality. The Icon column refers to the icons using the text that appears when you hover over each icon.

Icon Description
Show Documentation Explorer Displays the Rubrik GraphQL documentation derived from the latest schema reference and Provides a search option to search for specific queries and mutations.
Show History Displays a list of GraphQL operations run using the API Playground user interface in the current browser session.
Re-fetch GraphQL Schema Refreshes the documentation with the latest Rubrik GraphQL schema reference, on demand.
Open short keys dialog Displays a list of keyboard shortcuts for frequently performed actions on the editor.
Open settings dialog Displays additional settings for the web page.
Execute query Runs the GraphQL query or mutation that is entered in the editor.
Prettify query Formats the content of the editor.
Merge fragments into query Merges fragments with the main query for ease of understanding and readability.
Copy query Copies the editor content to the clipboard.
Add tab Adds a tab to the editor.

For more details about the GraphiQL IDE, refer to the official GraphiQL IDE documentation.