curl --request GET \
--url https://api.upstash.com/v2/redis/traffic/{id} \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.upstash.com/v2/redis/traffic/{id}"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://api.upstash.com/v2/redis/traffic/{id}', 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.upstash.com/v2/redis/traffic/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$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.upstash.com/v2/redis/traffic/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.upstash.com/v2/redis/traffic/{id}")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.upstash.com/v2/redis/traffic/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"database_region": "<string>",
"client_network_window": "1h",
"client_networks": [
{
"prefix": "203.0.113.0/24",
"provider": "<string>",
"region": "<string>",
"count": 123,
"weight": 123,
"share": 123,
"idle_seconds": 123
}
],
"client_network_evictions": 123,
"telemetry_window": "today",
"telemetry": {
"sdks": [
{
"name": "@upstash/redis@1.34.0",
"count": 123,
"share": 123
}
],
"platforms": [
{
"name": "@upstash/redis@1.34.0",
"count": 123,
"share": 123
}
],
"runtimes": [
{
"name": "@upstash/redis@1.34.0",
"count": 123,
"share": 123
}
],
"retries": {
"requests": 123,
"retried": 123,
"rate": 123
}
},
"routes_window": "today",
"routes": [
{
"proxy_region": "<string>",
"member_region": "<string>",
"http_requests": 123,
"tcp_connections_opened": 123,
"tcp_connections": 123,
"ingress_bytes": 123,
"egress_bytes": 123,
"errors": 123,
"cross_region": true
}
],
"entry_regions": [
{
"region": "<string>",
"share": 123
}
],
"cross_region_share": 123,
"commands": {
"rest_commands": 123,
"script_commands": 123
}
}Get Database Traffic
This endpoint reports where a database’s traffic comes from. Available for databases on a Pro plan or with the Production Pack.
curl --request GET \
--url https://api.upstash.com/v2/redis/traffic/{id} \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.upstash.com/v2/redis/traffic/{id}"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://api.upstash.com/v2/redis/traffic/{id}', 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.upstash.com/v2/redis/traffic/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$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.upstash.com/v2/redis/traffic/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.upstash.com/v2/redis/traffic/{id}")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.upstash.com/v2/redis/traffic/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"database_region": "<string>",
"client_network_window": "1h",
"client_networks": [
{
"prefix": "203.0.113.0/24",
"provider": "<string>",
"region": "<string>",
"count": 123,
"weight": 123,
"share": 123,
"idle_seconds": 123
}
],
"client_network_evictions": 123,
"telemetry_window": "today",
"telemetry": {
"sdks": [
{
"name": "@upstash/redis@1.34.0",
"count": 123,
"share": 123
}
],
"platforms": [
{
"name": "@upstash/redis@1.34.0",
"count": 123,
"share": 123
}
],
"runtimes": [
{
"name": "@upstash/redis@1.34.0",
"count": 123,
"share": 123
}
],
"retries": {
"requests": 123,
"retried": 123,
"rate": 123
}
},
"routes_window": "today",
"routes": [
{
"proxy_region": "<string>",
"member_region": "<string>",
"http_requests": 123,
"tcp_connections_opened": 123,
"tcp_connections": 123,
"ingress_bytes": 123,
"egress_bytes": 123,
"errors": 123,
"cross_region": true
}
],
"entry_regions": [
{
"region": "<string>",
"share": 123
}
],
"cross_region_share": 123,
"commands": {
"rest_commands": 123,
"script_commands": 123
}
}Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Path Parameters
The ID of the database
Response
Database traffic retrieved successfully
Primary region of the database, to compare client regions against
"1h"
Show child attributes
Show child attributes
Networks the proxies pushed out of their sampling tables. A value comparable to the observations means the list is a sample of the traffic rather than a ranking.
"today"
Show child attributes
Show child attributes
"today"
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Share of bytes served by a replica in another region than the entry region
Today's exact command counts, absent until the database saw commands
Show child attributes
Show child attributes
Was this page helpful?