Skip to main content
POST
/
project
/
{project_id}
/
location
/
{location}
/
postgres
/
{postgres_database_reference}
/
rename
Rename a PostgreSQL database
curl --request POST \
  --url https://api.ubicloud.com/project/{project_id}/location/{location}/postgres/{postgres_database_reference}/rename \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>"
}
'
import requests

url = "https://api.ubicloud.com/project/{project_id}/location/{location}/postgres/{postgres_database_reference}/rename"

payload = { "name": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>'})
};

fetch('https://api.ubicloud.com/project/{project_id}/location/{location}/postgres/{postgres_database_reference}/rename', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ubicloud.com/project/{project_id}/location/{location}/postgres/{postgres_database_reference}/rename",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.ubicloud.com/project/{project_id}/location/{location}/postgres/{postgres_database_reference}/rename"

payload := strings.NewReader("{\n \"name\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.ubicloud.com/project/{project_id}/location/{location}/postgres/{postgres_database_reference}/rename")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.ubicloud.com/project/{project_id}/location/{location}/postgres/{postgres_database_reference}/rename")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "flavor": "<string>",
  "ha_type": "<string>",
  "target_server_count": 123,
  "id": "pgn30gjk1d1e2jj34v9x0dq4rp",
  "location": "<string>",
  "name": "<string>",
  "state": "<string>",
  "storage_size_gib": 123,
  "vm_size": "<string>",
  "maintenance_window_start_at": 123,
  "read_replica": true,
  "fallback_active": true,
  "tags": [
    {
      "key": "<string>",
      "value": "<string>"
    }
  ],
  "created_at": "2023-11-07T05:31:56Z",
  "connection_string": "<string>",
  "username": "<string>",
  "password": "<string>",
  "hostname": "<string>",
  "earliest_restore_time": "<string>",
  "firewall_rules": [
    {
      "cidr": "<string>",
      "id": "frmjgkgbktw62k53005jpx8tt7",
      "description": "<string>",
      "port": 123
    }
  ],
  "latest_restore_time": "<string>",
  "primary": true,
  "target_storage_size_gib": 123,
  "target_vm_size": "<string>",
  "ca_certificates": "<string>",
  "parent": "<string>"
}
{
"error": {
"code": 401,
"message": "There was an error logging in",
"type": "InvalidCredentials",
"details": {}
}
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

project_id
string
required

ID of the project

Pattern: ^pj[0-9a-hj-km-np-tv-z]{24}$
Example:

"pjkkmx0f2vke4h36nk9cm8v8q0"

location
string
required

The Ubicloud location/region

Example:

"eu-central-h1"

postgres_database_reference
string
required

Postgres database ID or name Resource ID or name

Pattern: ^[a-z0-9](?:[a-z0-9\-]{0,61}[a-z0-9])?$

Body

application/json
name
string
required

New name for PostgreSQL database

Response

A Postgres Database

flavor
string
required

Kind of Postgres database

ha_type
string
required

High availability type

target_server_count
integer
required

Target number of servers (primary + standbys)

id
string
required

ID of the Postgres database

Pattern: ^pg[0-9a-hj-km-np-tv-z]{24}$
Example:

"pgn30gjk1d1e2jj34v9x0dq4rp"

location
string
required

Location of the Postgres database

name
string
required

Name of the Postgres database

state
string
required

State of the Postgres database

storage_size_gib
integer
required

Storage size in GiB

version
enum<string>
required

Current Postgres version

Available options:
16,
17,
18
target_version
enum<string>
required

Target Postgres version

Available options:
16,
17,
18
vm_size
string
required

Size of the underlying VM

maintenance_window_start_at
integer | null
required

Maintenance window start time

read_replica
boolean
required

If the database is a read replica or not

fallback_active
boolean
required

Whether the primary server is running on a fallback instance type

tags
object[]
required

Tags of the Postgres database

created_at
string<date-time>
required

Creation timestamp of the Postgres database

connection_string
string | null
required

Connection string to the Postgres database

username
string | null
required

Username for the Postgres database

password
string | null
required

Password for the Postgres database

hostname
string | null
required

Hostname for the Postgres database

earliest_restore_time
string | null
required

Earliest restore time (if primary)

firewall_rules
object[]
required

List of Postgres firewall rules

latest_restore_time
string
required

Latest restore time (if primary)"

primary
boolean
required

Is the database primary

target_storage_size_gib
integer

Desired storage size in GiB

target_vm_size
string

Desired VM size

ca_certificates
string | null

CA certificates of the root CA used to issue postgres server certificates

parent
string | null

Parent Postgres database