Deploy and operate

This is the documentation of the GraphQL Library version 6. For the long-term support (LTS) version 5, refer to GraphQL Library version 5 LTS.

Deploy a GraphQL API

Before you deploy a GraphQL API, complete the steps in Prerequisites. Make sure that you have:

  • The ID, username and password for the AuraDB.

  • A file containing the type definitions.

You are now ready to create the GraphQL API with the Aura CLI. Substitute the values in CAPITALS to match your setup:

aura-cli data-api graphql create --name YOUR_FRIENDLY_NAME --instance-id YOUR_AURA_INSTANCE_ID --instance-username YOUR_AURA_INSTANCE_USER --instance-password YOUR_AURA_INSTANCE_PASSWORD --type-definitions-file
FULL_PATH_TO_YOUR_TYPE_DEFS --await

Make sure to record the API key shown in the response as it will not be displayed again. If the API key is lost, a new one can be created by following the steps to create a new API key auth provider in Authentication providers.

There are other items of note in the response:

  • id: unique identifier for the GraphQL API

  • status: tells you if the GraphQL API is ready to receive requests

  • url: the connection address to access the GraphQL API

To check if the GraphQL API is ready for requests, use the Aura CLI again, changing YOUR_AURA_INSTANCE_ID for the ID of your aura instance.

aura-cli data-api graphql list --instance-id YOUR_AURA_INSTANCE_ID

When the status changes to ready, the GraphQL API is available for servicing requests.

Modifying an existing GraphQL API

It is possible to change the configuration of an existing GraphQL API. The following properties can be modified:

  • Friendly name of the GraphQL API

  • Username and/or password for the associated Aura instance

  • Type definitions

To do this, use the Aura CLI update command which requires IDs of the GraphQL API and its linked AuraDB instance. The format of this Aura CLI command is as follows:

aura-cli data-api graphql update YOUR_GRAPHQL_API_ID --instance-id YOUR_AURA_INSTANCE_ID <flags>

As the change takes a few moments to apply, check the status of the GraphQL API after performing this operation. If the status is updating then the change is still being processed. When the change is committed, the status will return to ready.

Additionally, it is possible to modify the authentication providers of GraphQL APIs. To learn more, see Authentication providers.

Deleting a GraphQL API

When you no longer require the GraphQL API then delete it by using the Aura CLI delete command. This requires the Aura instance ID and the ID of the GraphQL API.

The format of this command is as follows:

aura-cli data-api graphql delete YOUR_GRAPHQL_API_ID --instance-id YOUR_AURA_INSTANCE_ID

There is no additional confirmation - the GraphQL API will start to be deleted as soon as you execute the command.