{
  "id": "quick-start",
  "title": "Redis Enterprise Software REST API quick start",
  "url": "https://redis.io/docs/latest/operate/rs/7.8/references/rest-api/quick-start/",
  "summary": "Redis Enterprise Software REST API quick start",
  "content": "\nRedis Enterprise Software includes a REST API that allows you to automate certain tasks. This article shows you how to send a request to the Redis Enterprise Software REST API.\n\n## Fundamentals\n\nNo matter which method you use to send API requests, there are a few common concepts to remember.\n\n| Type | Description |\n|------|-------------|\n| [Authentication]() | Use [Basic Auth](https://en.wikipedia.org/wiki/Basic_access_authentication) with your cluster username (email) and password |\n| [Ports]() | All calls are made to port 9443 by default |\n| [Versions]() | Specify the version in the request [URI](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier) |\n| [Headers]() | `Accept` and `Content-Type` should be `application/json` |\n| [Response types and error codes]() | A response of `200 OK` means success; otherwise, the request failed due to an error |  \n\nFor more information, see [Redis Enterprise Software REST API]().\n\n## cURL example requests\n\n[cURL](https://curl.se/) is a command-line tool that allows you to send HTTP requests from a terminal.\n\nYou can use the following options to build a cURL request:\n\n| Option | Description |\n|--------|-------------|\n| -X     | Method (GET, PUT, PATCH, POST, or DELETE) |\n| -H     | Request header, can be specified multiple times |\n| -u     | Username and password information |\n| -d     | JSON data for PUT or POST requests |\n| -F     | Form data for PUT or POST requests, such as for the [`POST /v1/modules`]() or [`POST /v2/modules`]() endpoint |\n| -k     | Turn off SSL  verification |\n| -i     | Show headers and status code as well as the response body |\n\nSee the [cURL documentation](https://curl.se/docs/) for more information.\n\n### GET request\n\nUse the following cURL command to get a list of databases with the [GET `/v1/bdbs/`]() endpoint.\n\n```sh\n$ curl -X GET -H \"accept: application/json\" \\\n              -u \"[username]:[password]\" \\\n              https://[host][:port]/v1/bdbs -k -i\n\nHTTP/1.1 200 OK\nserver: envoy\ndate: Tue, 14 Jun 2022 19:24:30 GMT\ncontent-type: application/json\ncontent-length: 2833\ncluster-state-id: 42\nx-envoy-upstream-service-time: 25\n\n[\n    {\n        ...\n        \"name\": \"tr01\",\n        ...\n        \"uid\": 1,\n        \"version\": \"6.0.16\",\n        \"wait_command\": true\n    }\n]\n```\n\nIn the response body, the `uid` is the database ID. You can use the database ID to view or update the database using the API.\n\nFor more information about the fields returned by [GET `/v1/bdbs/`](), see the [`bdbs` object]().\n\n### PUT request\n\nOnce you have the database ID, you can use [PUT `/v1/bdbs/`]() to update the configuration of the database.\n\nFor example, you can pass the database `uid` 1 as a URL parameter and use the `-d` option to specify the new `name` when you send the request. This changes the database's `name` from `tr01` to `database1`:\n\n```sh\n$ curl -X PUT -H \"accept: application/json\" \\\n            -H \"content-type: application/json\" \\\n            -u \"cameron.bates@redis.com:test123\" \\\n            https://[host]:[port]/v1/bdbs/1 \\\n            -d '{ \"name\": \"database1\" }' -k -i\nHTTP/1.1 200 OK\nserver: envoy\ndate: Tue, 14 Jun 2022 20:00:25 GMT\ncontent-type: application/json\ncontent-length: 2933\ncluster-state-id: 43\nx-envoy-upstream-service-time: 159\n\n{\n    ...\n    \"name\" : \"database1\",\n    ...\n    \"uid\" : 1,\n    \"version\" : \"6.0.16\",\n    \"wait_command\" : true\n}\n```\n\nFor more information about the fields you can update with [PUT `/v1/bdbs/`](), see the [`bdbs` object]().\n\n## Client examples\n\nYou can also use client libraries to make API requests in your preferred language.\n\nTo follow these examples, you need:\n\n- A [Redis Enterprise Software]() node\n- Python 3 and the [requests](https://pypi.org/project/requests/) Python library\n- [node.js](https://nodejs.dev/) and [node-fetch](https://www.npmjs.com/package/node-fetch)\n\n### Python\n\n```python\nimport json\nimport requests\n\n# Required connection information - replace with your host, port, username, and password\nhost = \"[host]\"\nport = \"[port]\"\nusername = \"[username]\"\npassword = \"[password]\"\n\n# Get the list of databases using GET /v1/bdbs\nbdbs_uri = \"https://{}:{}/v1/bdbs\".format(host, port)\n\nprint(\"GET {}\".format(bdbs_uri))\nget_resp = requests.get(bdbs_uri,\n        auth = (username, password),\n        headers = { \"accept\" : \"application/json\" },\n        verify = False)\n\nprint(\"{} {}\".format(get_resp.status_code, get_resp.reason))\nfor header in get_resp.headers.keys():\n    print(\"{}: {}\".format(header, get_resp.headers[header]))\n\nprint(\"\\n\" + json.dumps(get_resp.json(), indent=4))\n\n# Rename all databases using PUT /v1/bdbs\nfor bdb in get_resp.json():\n    uid = bdb[\"uid\"] # Get the database ID from the JSON response\n\n    put_uri = \"{}/{}\".format(bdbs_uri, uid)\n    new_name = \"database{}\".format(uid)\n    put_data = { \"name\" : new_name }\n\n    print(\"PUT {} {}\".format(put_uri, json.dumps(put_data)))\n\n    put_resp = requests.put(put_uri,\n        data = json.dumps(put_data),\n        auth = (username, password),\n        headers = { \"content-type\" : \"application/json\" },\n        verify = False)\n\n    print(\"{} {}\".format(put_resp.status_code, put_resp.reason))\n    for header in put_resp.headers.keys():\n        print(\"{}: {}\".format(header, put_resp.headers[header]))\n\n    print(\"\\n\" + json.dumps(put_resp.json(), indent=4))\n```\n\nSee the [Python requests library documentation](https://requests.readthedocs.io/en/latest/) for more information.\n\n#### Output\n\n```sh\n$ python rs_api.py\npython rs_api.py\nGET https://[host]:[port]/v1/bdbs\nInsecureRequestWarning: Unverified HTTPS request is being made to host '[host]'.\nAdding certificate verification is strongly advised.\nSee: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n  warnings.warn(\n200 OK\nserver: envoy\ndate: Wed, 15 Jun 2022 15:49:43 GMT\ncontent-type: application/json\ncontent-length: 2832\ncluster-state-id: 89\nx-envoy-upstream-service-time: 27\n\n[\n    {\n        ...\n        \"name\": \"tr01\",\n        ...\n        \"uid\": 1,\n        \"version\": \"6.0.16\",\n        \"wait_command\": true\n    }\n]\n\nPUT https://[host]:[port]/v1/bdbs/1 {\"name\": \"database1\"}\nInsecureRequestWarning: Unverified HTTPS request is being made to host '[host]'.\nAdding certificate verification is strongly advised.\nSee: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n  warnings.warn(\n200 OK\nserver: envoy\ndate: Wed, 15 Jun 2022 15:49:43 GMT\ncontent-type: application/json\ncontent-length: 2933\ncluster-state-id: 90\nx-envoy-upstream-service-time: 128\n\n{\n    ...\n    \"name\" : \"database1\",\n    ...\n    \"uid\" : 1,\n    \"version\" : \"6.0.16\",\n    \"wait_command\" : true\n}\n```\n\n### node.js\n\n```js\nimport fetch, { Headers } from 'node-fetch';\nimport * as https from 'https';\n\nconst HOST = '[host]';\nconst PORT = '[port]';\nconst USERNAME = '[username]';\nconst PASSWORD = '[password]';\n\n// Get the list of databases using GET /v1/bdbs\nconst BDBS_URI = `https://${HOST}:${PORT}/v1/bdbs`;\nconst USER_CREDENTIALS = Buffer.from(`${USERNAME}:${PASSWORD}`).toString('base64');\nconst AUTH_HEADER = `Basic ${USER_CREDENTIALS}`;\n\nconsole.log(`GET ${BDBS_URI}`);\n\nconst HTTPS_AGENT = new https.Agent({\n    rejectUnauthorized: false\n});\n\nconst response = await fetch(BDBS_URI, {\n    method: 'GET',\n    headers: {\n        'Accept': 'application/json',\n        'Authorization': AUTH_HEADER\n    },\n    agent: HTTPS_AGENT\n});\n\nconst responseObject = await response.json();\nconsole.log(`${response.status}: ${response.statusText}`);\nconsole.log(responseObject);\n\n// Rename all databases using PUT /v1/bdbs\nfor (const database of responseObject) {\n    const DATABASE_URI = `${BDBS_URI}/${database.uid}`;\n    const new_name = `database${database.uid}`;\n\n    console.log(`PUT ${DATABASE_URI}`);\n\n    const response = await fetch(DATABASE_URI, {\n        method: 'PUT',\n        headers: {\n            'Authorization': AUTH_HEADER,\n            'Content-Type': 'application/json'\n        },\n        body: JSON.stringify({\n            'name': new_name\n        }),\n        agent: HTTPS_AGENT\n    });\n\n    console.log(`${response.status}: ${response.statusText}`);\n    console.log(await(response.json()));\n}\n```\n\nSee the [node-fetch documentation](https://www.npmjs.com/package/node-fetch) for more info.\n\n#### Output\n\n```sh\n$ node rs_api.js\nGET https://[host]:[port]/v1/bdbs\n200: OK\n[\n    {\n        ...\n        \"name\": \"tr01\",\n        ...\n        \"slave_ha\" : false,\n        ...\n        \"uid\": 1,\n        \"version\": \"6.0.16\",\n        \"wait_command\": true\n    }\n]\nPUT https://[host]:[port]/v1/bdbs/1\n200: OK\n{\n    ...\n    \"name\" : \"tr01\",\n    ...\n    \"slave_ha\" : true,\n    ...\n    \"uid\" : 1,\n    \"version\" : \"6.0.16\",\n    \"wait_command\" : true\n}\n```\n\n## More info\n\n- [Redis Enterprise Software REST API]()\n- [Redis Enterprise Software REST API requests]()\n",
  "tags": ["docs","operate","rs"],
  "last_updated": "2026-04-01T08:10:08-05:00"
}

