Skip to main content

Creating a Redis database using the API

This article describes how to create a Redis database via the API.

Prerequisites

To create a Redis database, you will need to have access to a project. Refer to the guide "create a project" for this. You will need the project ID for the subsequent operations.

List available Redis versions

Set a GET request to the /v2/redis-versions endpoint to get a list of available Redis versions. (endpoint documentation for database-list-redis-versions)

Creating a Redis database

To create a Redis database, send a POST request to the /v2/projects/{projectID}/redis-databases endpoint. The request body must contain a JSON object with the following properties:

  • description should contain a human-readable description of the database. This is a required value.
  • version should contain the version of the database. This is a required value, and must reference an existing version as returned by the /v2/redis-versions endpoint.

The response will contain the following properties:

  • id contains the ID of the created database.
info
For details please refer to the endpoint documentation for the following endpoint: database-create-redis-database

Accessing the database

After creating a database, you can send a GET request to the /v2/redis-databases/{id} route.

Among others, the response will contain the following values:

  • hostname and port contain the hostname and port of the database. You can use these values to connect to the database from within your hosting environment.
  • configuration allows you to inspect the specific configuration values that were applied to your database.
info
For details please refer to the endpoint documentation for the following endpoint: database-get-redis-database