cURL
curl --request POST \
--url https://api.camposcloud.com/v1/databases/{databaseId}/restart \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.camposcloud.com/v1/databases/{databaseId}/restart"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.camposcloud.com/v1/databases/{databaseId}/restart', 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.camposcloud.com/v1/databases/{databaseId}/restart",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.camposcloud.com/v1/databases/{databaseId}/restart"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.camposcloud.com/v1/databases/{databaseId}/restart")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.camposcloud.com/v1/databases/{databaseId}/restart")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"_id": "64b7f0c2a1b2c3d4e5f60718",
"name": "main-db",
"type": "postgresql",
"status": "active",
"restartRequired": false,
"userId": "64b7f0c2a1b2c3d4e5f60700",
"teamId": null,
"workerNodeId": {
"_id": "64b7f0c2a1b2c3d4e5f60799",
"nodeName": "node-1"
},
"allocatedMemoryMB": 512,
"allocatedVCpu": 1,
"diskLimitBytes": 10737418240,
"diskUsageBytes": 52428800,
"containerImage": "postgres:trixie",
"connection": {
"host": "db.camposcloud.com",
"port": 30001,
"username": "app_user",
"database": "app_db"
},
"currentResourceMetrics": {
"timestamp": "2025-01-01T12:00:00.000Z",
"online": true,
"uptime": 35980,
"startedAt": "2025-01-01T12:00:00.000Z",
"cpuUsagePercent": 0.42,
"memoryUsageBytes": 43671552,
"memoryLimitBytes": 268435456,
"networkRxBytes": 228961,
"networkTxBytes": 228190
},
"createdAt": "2025-01-01T12:00:00.000Z",
"updatedAt": "2025-01-01T12:00:00.000Z"
}{
"error": "This application cannot be started at the moment. Please try again later!"
}{
"error": "Invalid developer token"
}{
"error": "The owner of this application does not have an active plan."
}{
"error": "Application not found or you do not have permission to access it."
}{
"error": "Database power action limit reached, please try again later"
}{
"error": "Internal server error. Please try again later."
}Databases
/v1/databases/{databaseId}/restart
This endpoint restarts a database.
POST
/
v1
/
databases
/
{databaseId}
/
restart
cURL
curl --request POST \
--url https://api.camposcloud.com/v1/databases/{databaseId}/restart \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.camposcloud.com/v1/databases/{databaseId}/restart"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.camposcloud.com/v1/databases/{databaseId}/restart', 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.camposcloud.com/v1/databases/{databaseId}/restart",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.camposcloud.com/v1/databases/{databaseId}/restart"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.camposcloud.com/v1/databases/{databaseId}/restart")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.camposcloud.com/v1/databases/{databaseId}/restart")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"_id": "64b7f0c2a1b2c3d4e5f60718",
"name": "main-db",
"type": "postgresql",
"status": "active",
"restartRequired": false,
"userId": "64b7f0c2a1b2c3d4e5f60700",
"teamId": null,
"workerNodeId": {
"_id": "64b7f0c2a1b2c3d4e5f60799",
"nodeName": "node-1"
},
"allocatedMemoryMB": 512,
"allocatedVCpu": 1,
"diskLimitBytes": 10737418240,
"diskUsageBytes": 52428800,
"containerImage": "postgres:trixie",
"connection": {
"host": "db.camposcloud.com",
"port": 30001,
"username": "app_user",
"database": "app_db"
},
"currentResourceMetrics": {
"timestamp": "2025-01-01T12:00:00.000Z",
"online": true,
"uptime": 35980,
"startedAt": "2025-01-01T12:00:00.000Z",
"cpuUsagePercent": 0.42,
"memoryUsageBytes": 43671552,
"memoryLimitBytes": 268435456,
"networkRxBytes": 228961,
"networkTxBytes": 228190
},
"createdAt": "2025-01-01T12:00:00.000Z",
"updatedAt": "2025-01-01T12:00:00.000Z"
}{
"error": "This application cannot be started at the moment. Please try again later!"
}{
"error": "Invalid developer token"
}{
"error": "The owner of this application does not have an active plan."
}{
"error": "Application not found or you do not have permission to access it."
}{
"error": "Database power action limit reached, please try again later"
}{
"error": "Internal server error. Please try again later."
}This endpoint has a rate limit of 10 requests per minute, shared by start, stop and restart.
Authorizations
Response
The database, with refreshed metrics.