Get Database Traffic
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{
"period": "1d",
"database_region": "<string>",
"client_network_window": "1d",
"client_networks": [
{
"prefix": "203.0.113.0/24",
"entry_region": "us-east-1",
"provider": "<string>",
"region": "<string>",
"count": 123,
"weight": 123,
"share": 123,
"idle_seconds": 123
}
],
"client_network_evictions": 123,
"telemetry_window": "1d",
"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": "1d",
"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
}
}Redis
Get Database Traffic
This endpoint reports where a database’s traffic comes from over a period. Available for databases on a Pro plan or with the Production Pack.
GET
/
redis
/
traffic
/
{id}
Get Database Traffic
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{
"period": "1d",
"database_region": "<string>",
"client_network_window": "1d",
"client_networks": [
{
"prefix": "203.0.113.0/24",
"entry_region": "us-east-1",
"provider": "<string>",
"region": "<string>",
"count": 123,
"weight": 123,
"share": 123,
"idle_seconds": 123
}
],
"client_network_evictions": 123,
"telemetry_window": "1d",
"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": "1d",
"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
Query Parameters
Response
200 - application/json
Database traffic retrieved successfully
Was this page helpful?