Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jira DOC-407: RC Reorg the REST API docs. #1310

Merged
merged 11 commits into from
Apr 30, 2021
35 changes: 23 additions & 12 deletions content/rc/api/_index.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
Title: REST API
Title: Redis Cloud REST API
description: Describes the Redis Cloud REST API and links to additional info
weight: 80
alwaysopen: false
categories: ["RC"]
aliases: /rv/api/
/rc/api/
---

The [Redis Cloud REST API](https://api.redislabs.com/v1/swagger-ui.html) helps you manage your Redis Cloud subscription programmatically.

The [Redis Enterprise Cloud REST API](https://api.redislabs.com/v1/swagger-ui.html) helps you manage your Redis Cloud subscription programmatically.

You can use the API to:

Expand All @@ -25,15 +25,26 @@ The Redis Cloud REST API is available only with Flexible or Annual subscriptions

## Getting started

1. [Enable the API]({{< relref "/rc/api/how-to/enable-your-account-to-use-api.md" >}})
1. [Authenticate and authorize]({{< relref "/rc/api/concepts/authentication-and-authorization.md" >}})
1. [Create API keys]({{< relref "/rc/api/how-to/create-api-keys-for-your-team.md" >}})
1. [Use the API]({{< relref "/rc/api/how-to/using-curl.md" >}})
1. [Learn the API lifecycle]({{< relref "/rc/api/concepts/provisioning-lifecycle.md" >}})
1. [Create and manage subscriptions]({{< relref "/rc/api/how-to/create-and-manage-subscriptions.md" >}})

1. [Enable the API]({{< relref "/rc/api/get-started/enable-the-api.md" >}})
1. [Authenticate and authorize]({{< relref "/rc/api/get-started/_index.md" >}})
1. [Create API keys]({{< relref "/rc/api/get-started/manage-api-keys.md" >}})
1. [Use the API]({{< relref "/rc/api/get-started/use-rest-api.md" >}})
1. [Learn the API lifecycle]({{< relref "/rc/api/get-started/process-lifecycle.md" >}})
1. [Create and manage subscriptions]({{< relref "/rc/api/examples/manage-subscriptions.md" >}})

## Examples

1. [Manage subscriptions]({{< relref "/rc/api/examples/manage-subscriptions.md" >}})
1. Database examples
1. [Create database]({{< relref "/rc/api/examples/create-database.md" >}})
1. [Update database]({{< relref "/rc/api/examples/update-database.md" >}})
1. [Back up and import data]({{< relref "/rc/api/examples/back-up-and-import-data.md" >}})
1. [Manage cloud accounts]({{< relref "/rc/api/examples/manage-cloud-accounts.md" >}})
1. [Estimate costs]({{< relref "/rc/api/examples/dryrun-cost-estimates.md" >}})
1. [View account info]({{< relref "/rc/api/examples/view-account-information.md" >}})

## More info

- Use the [Redis Cloud API]({{< relref "/rc/api/how-to/using-curl.md" >}})
- Use the [Redis Cloud API]({{< relref "/rc/api/get-started/use-rest-api.md" >}})
- [Full API Reference](https://api.redislabs.com/v1/swagger-ui.html)
- Secure [authentication and authorization]({{< relref "/rc/api/concepts/authentication-and-authorization.md" >}})
- Secure [authentication and authorization]({{< relref "/rc/api/get-started/_index.md" >}})
12 changes: 12 additions & 0 deletions content/rc/api/examples/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
Title: REST API Examples
description: These examples show how to use the API and the results to expect.
linkTitle: "Examples"
weight: 30
alwaysopen: false
categories: ["RC"]
aliases: /rv/api/how-to/
/rc/api/how-to/
/rc/api/examples/
---
{{< allchildren style="h2" description="true" />}}
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
---
Title: Auditing using System Log
description: Using the Redis Labs system log to track and audit actions performed in the account
weight: 100
weight: 60
alwaysopen: false
categories: ["RC"]
aliases: /rv/api/how-to/view-auditing-using-system-log/
/rc/api/how-to/view-auditing-using-system-log/
/rc/examples/audit-system-logs/
---
The Redis Labs system log collects and reports on actions performed on various entities in the account. These entities include the account itself, users, API Keys, subscriptions, databases, accounts, payment methods and more. For each entity, various lifecycle events are logged in the system log.
System logs collect and report actions performed on various entities in your Redis Enterprise Cloud subscription. These entities include the account itself, users, API Keys, subscriptions, databases, accounts, payment methods and more. For each entity, various lifecycle events are logged in the system log.

You can view the system log in the Redis Cloud admin console by selecting `Menu` and then `System Log`. This will display the system log entries for the current account.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,23 @@
Title: Databases Backup and Import
description: When you create or update a database, you can specify the backup path.
The import API operation lets you import data from various source types and specified locations.
weight: 72
weight: 40
alwaysopen: false
categories: ["RC"]
aliases: /rv/api/how-to/backup-and-import-databases/
/rc/api/how-to/backup-and-import-databases/
/rc/api/examples/back-up-and-import-data/
---

## Backup a database
## Back up a database

When you create or update a database, you can specify the (optional) `periodicBackupPath` parameter
When you create or update a database in a Flexible or Anual account, you can specify the (optional) `periodicBackupPath` parameter
with a [backup path](/rv/administration/configuration/backups/).
This parameter enables periodic and on-demand backup operations for the specified database.

The API operation for on-demand backups is `POST /subscriptions/{subscriptionId}/databases/{databaseId}/backup`.
On-demand database backup is an [asynchronous operation]({{< relref "/rc/api/concepts/provisioning-lifecycle#asynchronous-operations" >}})".
On-demand database backup is an [asynchronous operation]
({{< relref "/rc/api/get-started/process-lifecycle.md#asynchronous-operations" >}})".

### Prerequisites for backups

Expand All @@ -37,7 +40,7 @@ Instead, the `periodicBackupPath` must be set to a valid path with available sto
## Import a database

You can import data into an existing database from multiple storage sources, including AWS S3, Redis, FTP.
Database import is an [asynchronous operation]({{< relref "/rc/api/concepts/provisioning-lifecycle#asynchronous-operations" >}})".
Database import is an [asynchronous operation]({{< relref "/rc/api/get-started/process-lifecycle.md#asynchronous-operations" >}})".

The API operation for performing on-demand backup is `POST /subscriptions/{subscriptionId}/databases/{databaseId}/import`.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,39 @@
---
Title: Create and manage Databases
Title: Create and manage databases
description: This article describes how to create and manage a database using `cURL` commands.
weight: 70
linkTitle: Create databases
weight: 20
alwaysopen: false
categories: ["RC"]
aliases: /rv/api/how-to/create-and-manage-databases/
/rc/api/how-to/create-and-manage-databases/
/rc/api/examples/create-database
---
You can use `cURL` commands to create and manage a cloud account
with the [CURL HTTP client]({{< relref "/rc/api/how-to/using-curl#using-the-curl-http-client" >}}).

You can use the Redis Enterprise Cloud REST API to create databases.

These examples use the [`cURL` utility]({{< relref "/rc/api/get-started/use-rest-api.md#using-the-curl-http-client" >}}); you can use any REST client to work with the Redis Cloud REST API.

## Create a database

The API operation that creates a database is: `POST /subscriptions/{subscription-id}/databases`
To create a database use `POST /subscriptions/{subscription-id}/databases`

The database is created in an existing or a newly-created subscription.

The database is created in an existing or a newly created subscription.
When a subscription is created, it is created with at least one database.
You can add more databases to the subscription, and you can update or delete existing databases.

Creating a database is an [asynchronous operation]({{< relref "/rc/api/concepts/provisioning-lifecycle#asynchronous-operations" >}}).
You can add databases to the subscription; you can also update or delete existing databases.

The following Linux shell script sends a `POST /subscriptions/{subscription-id}/databases` and waits for a cloud account ID.
When the cloud account ID is received, the processing phase is complete and the provisioning phase starts.
Creating a database is an [asynchronous operation]({{< relref "/rc/api/get-started/process-lifecycle.md#asynchronous-operations" >}}).

The following Linux shell script sends a `POST /subscriptions/{subscription-id}/databases` and waits for a cloud account ID. When the cloud account ID is received, the processing phase is complete and the provisioning phase starts.

### Prerequisites

- Install `jq` on your machine: `sudo apt install jq`
- These example require `jq`, [a JSON parser](https://stedolan.github.io/jq/).

Use your package manager to install it (Example: `sudo apt install jq`)

- Define the expected variables needed to use the API:

```shell
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
Title: Evaluating Cost Before Deployment
description: How to evaluate the cost of a specific subscription or database without changing existing resources.
weight: 65
weight: 50
alwaysopen: false
categories: ["RC"]
aliases: /rv/api/how-to/dry-run-cost-evaluations/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
---
Title: Create and Manage Cloud Accounts
description: Cloud accounts specify which account to use when creating and modifying infrastructure resources.
weight: 50
linkTitle: Manage Cloud accounts
weight: 80
alwaysopen: false
categories: ["RC"]
aliases: /rv/api/how-to/create-and-manage-cloud-accounts/
/rc/api/how-to/create-and-manage-cloud-accounts/
/rc/api/examples/managge-cloud-accounts
---
You can use `cURL` commands to create and manage a cloud account
with the [CURL HTTP client]({{< relref "/rc/api/how-to/using-curl#using-the-curl-http-client" >}}).
You can use the Redis Enterprise Cloud REST API to cloud accounts.

These examples use the [`cURL` utility]({{< relref "/rc/api/get-started/use-rest-api.md#using-the-curl-http-client" >}}); you can use any REST client to work with the Redis Cloud REST API.

## Create a cloud account

The API operation that creates a cloud account is: `POST /cloud-accounts`
To create a cloud account, use: `POST /cloud-accounts`

The following Linux shell script sends a `POST /cloud-accounts` and waits for a cloud account ID.
When the cloud account ID is received, the processing phase runs.
Expand All @@ -20,7 +24,10 @@ When the cloud account ID is received, the processing phase runs.

Before you use the API to create and manage cloud account, you must:

- Install `jq` on your machine: `sudo apt install jq`
- These example require `jq`, [a JSON parser](https://stedolan.github.io/jq/).

Use your package manager to install it (Example: `sudo apt install jq`)

- Define the expected variables needed to use the API:

```shell
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
---
Title: Create and manage Subscriptions
description: This article describes how to create and manage a subscription using `cURL` commands.
weight: 60
weight: 10
alwaysopen: false
categories: ["RC"]
aliases: /rv/api/how-to/create-and-manage-subscriptions/
/rs/api/how-to/create-and-manage-subscriptions/
/rs/api/example/manage-subscriptions/
---
You can use `cURL` commands to create and manage a subscriptions
with the [CURL HTTP client]({{< relref "/rc/api/how-to/using-curl#using-the-curl-http-client" >}}).

You can use the Redis Enterprise Cloud REST API to create and manage subscriptions.

These examples use the [`cURL` utility]({{< relref "/rc/api/get-started/use-rest-api.md#using-the-curl-http-client" >}}); you can use any REST client to work with the Redis Cloud REST API.

## Create a subscription

Expand All @@ -18,7 +22,10 @@ When the cloud account ID is received, the processing phase is complete and the

### Prerequisites

- Install `jq` on your machine: `sudo apt install jq`
- These example require `jq`, [a JSON parser](https://stedolan.github.io/jq/).

Use your package manager to install it (Example: `sudo apt install jq`)

- Define the expected variables needed to use the API:

```shell
Expand Down Expand Up @@ -83,7 +90,7 @@ To use the sample JSON document in your own account, you must modify these param

- The JSON document contains 2 primary segments: subscription specification and databases specification.
- When you create a subscription, you must specify one or more databases in the "`databases`" array of the above JSON file.
- You can [copy-and-paste]({{< relref "/rc/api/how-to/using-curl#swagger-user-interface" >}}) the contents of the JSON file into the `POST /subscriptions` operation in the [Swagger UI](https://api.redislabs.com/v1/swagger-ui.html).
- You can [copy-and-paste]({{< relref "/rc/api/get-started/use-rest-api.md#swagger-user-interface" >}}) the contents of the JSON file into the `POST /subscriptions` operation in the [Swagger UI](https://api.redislabs.com/v1/swagger-ui.html).

{{< note >}}
The Swagger UI generates default JSON examples for `POST` and `PUT` operations. You can reference these examples and modify them to fit your specific needs and account settings. The examples will fail if used as-is.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
---
Title: Update Databases
description: How to construct requests that update an existing database.
weight: 75
weight: 30
alwaysopen: false
categories: ["RC"]
aliases: /rv/api/how-to/update-databases/
---

The API operation that updates an existing database is: `PUT /subscriptions/{subscription-id}/databases/{database-id}`

This API operation uses the same [provisioning lifecycle]({{< relref "/rc/api/concepts/provisioning-lifecycle.md" >}}) as the [create and manage databases]({{< relref "/rc/api/how-to/create-and-manage-databases.md" >}}) operation.
This API operation uses the same [provisioning lifecycle]({{< relref "/rc/api/get-started/process-lifecycle.md" >}}) as the [create database]({{< relref "/rc/api/examples/create-database.md" >}}) operation.

## Database update request JSON body

The primary component of a database update request is the JSON request body that contains the details of the requested database changes.

You can see [the complete set of JSON elements]({{< relref "/rc/api/how-to/using-curl#inputs-for-operations-in-swagger" >}}) accepted by the database update API operation in the [Swagger UI](https://api.redislabs.com/v1/swagger-ui.html).
You can see [the complete set of JSON elements]({{< relref "/rc/api/get-started/use-rest-api.md#inputs-for-operations-in-swagger" >}}) accepted by the database update API operation in the [Swagger UI](https://api.redislabs.com/v1/swagger-ui.html).
To see the JSON elements, expand the specific API operation and, in the request section, click **Model**.

Here are several examples of JSON requests to update a database:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
Title: View Account Information
description: Get initial information on account parameters
weight: 110
weight: 70
alwaysopen: false
categories: ["RC"]
aliases: /rv/api/how-to/view-account-information/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
---
Title: API authentication and authorization
description: How the API uses keys for authenticating users and authorizing API requests
weight: 60
Title: Get started with the REST API
description: Describes how Redis Cloud REST API uses keys to authenicate and authorize access.
weight: 10
alwaysopen: false
categories: ["RC"]
aliases: /rv/api/concepts/authentication-and-authorization/
/rc/api/concepts/authentication-and-authorization/
/rc/api/get-started/
---
All API operations require authentication using a pair of API keys known as the **account key** and the **secret key**:

| Key name | HTTP Header name | Description |
| ----------- | ------------------ | ----------------------------------------------------------------- |
To use the Redis Enterprise Cloud REST API, you need to:

- Enable the API
- Create an account key
- Create a secret keys

{{< note >}}
The Redis Cloud REST API is available only with Flexible or Annual subscriptions. It is not supported for Fixed or Free subscriptions.
{{< /note >}}

To use the keys to authenticate and authorize your request, include the keys with the request headers:

| Key name | HTTP Header name |Description |
| ----------- | -------------------| ----------------------------------------------------- |
| Account key | `x-api-key` | Account-level key assigned to all users of an account |
| Secret key | `x-api-secret-key` | Personal key associated with a specific user and possibly limited to certain IP ranges |

## Enabling the API
## Enable the API

The API is disabled all on all accounts by default. You must first [enable the API]({{< relref "/rc/api/how-to/enable-your-account-to-use-api" >}}) before you can use it.
The API is disabled all on all accounts by default. You must first [enable the API]({{< relref "/rc/api/get-started/enable-the-api.md" >}}) before you can use it.

## Account key

Expand All @@ -37,32 +50,30 @@ The secret key is a personal key that belongs to a specific user having the **ow
The secret key is a personal secret. Do not share this key.
{{< /note >}}

A user can [generate multiple secret keys]({{< relref "/rc/api/how-to/create-api-keys-for-your-team" >}})
A user can [generate multiple secret keys]({{< relref "/rc/api/get-started/manage-api-keys.md" >}})
for themselves or for any other users defined as owners within the same account.

Every secret key has a name. You can use this name to identify which user made a specific API request.

For example, when you [audit create, update, and delete requests]({{< relref "/rc/api/how-to/view-auditing-using-system-log" >}})
in the system log, you can easily see which secret key was used for each request.
For example, when you [audit create, update, and delete requests]({{< relref "/rc/api/examples/audit-system-logs.md" >}}) in the system log, you can easily see which secret key was used for each request.

## Authentication using API keys

You must authenticate using the **account key** and **secret key** on every API request.

You provide these keys as [HTTP request headers]({{< relref "/rc/api/how-to/using-curl#using-the-curl-http-client" >}}).
You provide these keys as [HTTP request headers]({{< relref "/rc/api/get-started/use-rest-api.md#using-the-curl-http-client" >}}).

## Authenticating a request
## Authenticate a request

An API request will successfully authenticate if the following conditions are met:

1. Both the **account key** and **secret key** are valid and properly defined in the HTTP request headers.
1. The secret key is associated with the same account as the account key.
1. The request originates from a valid source IP. This requirement holds when you have [defined sourced IP limitations]({{< relref "/rc/api/how-to/manage-api-keys#add-a-new-allowed-subnet" >}}) for your secret key.
1. The request originates from a valid source IP. This requirement holds when you have [defined sourced IP limitations]({{< relref "/rc/api/get-started/manage-api-keys.md#add-a-new-allowed-subnet" >}}) for your secret key.

## Managing and using API keys
## More info

The following articles describe how to create, manage, and use API keys for your team:
To learn more, see:

- [Creating API Keys for your team]({{< relref "/rc/api/how-to/create-api-keys-for-your-team" >}})
- [Managing API Keys]({{< relref "/rc/api/how-to/manage-api-keys" >}})
- [Using the API]({{< relref "/rc/api/how-to/using-curl" >}})
- [Managing API Keys]({{< relref "/rc/api/get-started/manage-api-keys.md" >}})
- [Use the API]({{< relref "/rc/api/get-started/use-rest-api.md" >}})
Loading