curl --request POST \
--url https://api.upstash.com/v2/redis/database \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '{
"database_name": "myredis",
"platform": "aws",
"primary_region": "us-east-1",
"read_regions": [
"us-west-1",
"us-west-2"
],
"plan": "payg",
"budget": 360,
"eviction": false,
"tls": true
}'
import requests
url = "https://api.upstash.com/v2/redis/database"
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json",
}
payload = {
"database_name": "myredis",
"platform": "aws",
"primary_region": "us-east-1",
"read_regions": [
"us-west-1",
"us-west-2"
],
"plan": "payg",
"budget": 360,
"eviction": False,
"tls": True
}
response = requests.request("POST", url, headers=headers, json=payload)
print(response.text)
const response = await fetch('https://api.upstash.com/v2/redis/database', {
method: 'POST',
headers: {
'Authorization': 'Basic <encoded-value>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"database_name": "myredis",
"platform": "aws",
"primary_region": "us-east-1",
"read_regions": [
"us-west-1",
"us-west-2"
],
"plan": "payg",
"budget": 360,
"eviction": false,
"tls": true
})
});
const data = await response.json();
console.log(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.upstash.com/v2/redis/database',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => '{
"database_name": "myredis",
"platform": "aws",
"primary_region": "us-east-1",
"read_regions": [
"us-west-1",
"us-west-2"
],
"plan": "payg",
"budget": 360,
"eviction": false,
"tls": true
}',
CURLOPT_HTTPHEADER => [
'Authorization: Basic <encoded-value>',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
url := "https://api.upstash.com/v2/redis/database"
payload := strings.NewReader("{\n \"database_name\": \"myredis\",\n \"platform\": \"aws\",\n \"primary_region\": \"us-east-1\",\n \"read_regions\": [\n \"us-west-1\",\n \"us-west-2\"\n ],\n \"plan\": \"payg\",\n \"budget\": 360,\n \"eviction\": false,\n \"tls\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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))
}
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.upstash.com/v2/redis/database"))
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"database_name\": \"myredis\",\n \"platform\": \"aws\",\n \"primary_region\": \"us-east-1\",\n \"read_regions\": [\n \"us-west-1\",\n \"us-west-2\"\n ],\n \"plan\": \"payg\",\n \"budget\": 360,\n \"eviction\": false,\n \"tls\": true\n}"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
require 'uri'
require 'net/http'
url = URI('https://api.upstash.com/v2/redis/database')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = url.scheme == 'https'
request = Net::HTTP::Post.new(url)
request['Authorization'] = 'Basic <encoded-value>'
request['Content-Type'] = 'application/json'
request.body = '{
"database_name": "myredis",
"platform": "aws",
"primary_region": "us-east-1",
"read_regions": [
"us-west-1",
"us-west-2"
],
"plan": "payg",
"budget": 360,
"eviction": false,
"tls": true
}'
response = http.request(request)
puts response.read_body