Rubrik Security Cloud API

Rubrik Security Cloud API allows you to integrate the Rubrik platform across a number of existing enterprise tools and workflows.

We utilize GraphQL as the API query language. GraphQL allows you to retrieve just the data you need, eliminating the common scenario of an API call returning either too much or not enough data.

GraphQL overview

GraphQL queries are defined in terms of types and fields. Rather than using various endpoints identified by path-based URIs and HTTP verbs, GraphQL uses a single endpoint backed by a schema that specifies how to retrieve and modify application data based on the relationship between the types and fields.

You can use GraphQL queries to retrieve data, and mutations to modify data. A GraphQL query is a request to retrieve specific fields of an object type, and a GraphQL mutation is a request to modify specific fields of an object type. The GraphQL runtime engine validates the incoming queries and mutations against the schema and fulfils the valid requests.

Every GraphQL service has a Query type, and may also have a Mutation type. The Query and Mutation types are special object types in the schema, as they serve as entry points to the API.

GraphQL query type

type Query {
    # Retrieves the user that is currently logged-in
    currentUser: User!

    # Retrieves the user with the specified user ID
    user(userId: UUID!): User!
}

In the above example, the Query object type has two fields: currentUser and user. This implies that the above schema supports the following types of requests:

A GraphQL query with either of these fields returns an object of type User:

type User {
    # User ID
    userID: UUID!

    # User name
    email: String!

    # Roles that the user has
    roles: [String!]!
}

Based on the definition of the User object type, you can define the fields to be selected from the User object that is returned by the query.

The following example provides a sample query and response based on the above schema definition.

Sample GraphQL query

query {
    currentUser {
        email
        roles {
            name
        }
    }
}

Sample response

{
  "data": {
    "currentUser": {
      "email": "happy.user@rubrik.com",
      "roles": [
        {
          "name": "Administrator",
        }
      ],
    }
  },
}

Resources