curl --request POST \
--url https://api.example.com/v3/queries \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"queries": [
{
"query_key": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"model_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"metric": "<string>",
"columns": [
"<string>"
],
"baseline_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"categories": [
"<string>"
],
"segment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"segment": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"definition": "<string>"
}
}
]
}
'import requests
url = "https://api.example.com/v3/queries"
payload = {
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"queries": [
{
"query_key": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"model_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"metric": "<string>",
"columns": ["<string>"],
"baseline_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"categories": ["<string>"],
"segment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"segment": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"definition": "<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({
project_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
queries: [
{
query_key: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
model_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
metric: '<string>',
columns: ['<string>'],
baseline_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
categories: ['<string>'],
segment_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
segment: {id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', definition: '<string>'}
}
]
})
};
fetch('https://api.example.com/v3/queries', 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.example.com/v3/queries",
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([
'project_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'queries' => [
[
'query_key' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'model_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'metric' => '<string>',
'columns' => [
'<string>'
],
'baseline_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'categories' => [
'<string>'
],
'segment_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'segment' => [
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'definition' => '<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.example.com/v3/queries"
payload := strings.NewReader("{\n \"project_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"queries\": [\n {\n \"query_key\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"model_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"metric\": \"<string>\",\n \"columns\": [\n \"<string>\"\n ],\n \"baseline_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"categories\": [\n \"<string>\"\n ],\n \"segment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"segment\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"definition\": \"<string>\"\n }\n }\n ]\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.example.com/v3/queries")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"project_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"queries\": [\n {\n \"query_key\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"model_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"metric\": \"<string>\",\n \"columns\": [\n \"<string>\"\n ],\n \"baseline_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"categories\": [\n \"<string>\"\n ],\n \"segment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"segment\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"definition\": \"<string>\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v3/queries")
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 \"project_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"queries\": [\n {\n \"query_key\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"model_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"metric\": \"<string>\",\n \"columns\": [\n \"<string>\"\n ],\n \"baseline_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"categories\": [\n \"<string>\"\n ],\n \"segment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"segment\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"definition\": \"<string>\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"api_version": "3.0",
"kind": "NORMAL",
"data": {
"organization": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"project": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"asset_type": "ML_MODEL"
},
"query_type": "MONITORING",
"filters": {
"time_zone": "Etc/GMT",
"bin_size": "Hour",
"time_label": "yesterday",
"time_range": {
"start_time": "2023-11-07T05:31:56Z",
"end_time": "2023-11-07T05:31:56Z"
}
},
"time_comparison": "Previous Day",
"results": {}
}
}{
"api_version": "3.0",
"kind": "ERROR",
"error": {
"code": 400,
"message": "Resource Not Found",
"errors": [
{
"reason": "ResourceNotFoundException",
"message": "Resource Not Found",
"help": "<string>"
}
]
}
}{
"api_version": "3.0",
"kind": "ERROR",
"error": {
"code": 400,
"message": "Resource Not Found",
"errors": [
{
"reason": "ResourceNotFoundException",
"message": "Resource Not Found",
"help": "<string>"
}
]
}
}{
"api_version": "3.0",
"kind": "ERROR",
"error": {
"code": 400,
"message": "Resource Not Found",
"errors": [
{
"reason": "ResourceNotFoundException",
"message": "Resource Not Found",
"help": "<string>"
}
]
}
}{
"api_version": "3.0",
"kind": "ERROR",
"error": {
"code": 400,
"message": "Resource Not Found",
"errors": [
{
"reason": "ResourceNotFoundException",
"message": "Resource Not Found",
"help": "<string>"
}
]
}
}{
"api_version": "3.0",
"kind": "ERROR",
"error": {
"code": 400,
"message": "Resource Not Found",
"errors": [
{
"reason": "ResourceNotFoundException",
"message": "Resource Not Found",
"help": "<string>"
}
]
}
}{
"api_version": "3.0",
"kind": "ERROR",
"error": {
"code": 400,
"message": "Resource Not Found",
"errors": [
{
"reason": "ResourceNotFoundException",
"message": "Resource Not Found",
"help": "<string>"
}
]
}
}API to fetch metrics used to plot monitoring charts
API to fetch metrics used to plot monitoring charts.
Limits. By default, the requested time range can span at most 366 days, and each time range (including the comparison range when time_comparison is set) can contain at most 10,000 bins at the requested bin_size; for example, Hour bins cover up to 366 days, but Five_Minute bins cover up to about 34 days. A request over either limit, with a start time that is not before its end time, or with an unknown bin_size returns 400 before any query runs. Fiddler administrators can change both limits per deployment.
Rate limiting. Requests may be rate limited per access token (or per user for browser sessions) and receive 429 with a Retry-After header; wait that many seconds before retrying. Each query in queries counts toward the limit, so a request with 20 queries uses 20 times the budget of a request with one. Requests rejected with 400 are also counted.
Timeouts. A query that exceeds the server-side time limit returns 504. For ML models, queries in one request run one after another and the whole request is also time limited; reduce the number of queries or the time range if requests time out.
curl --request POST \
--url https://api.example.com/v3/queries \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"queries": [
{
"query_key": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"model_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"metric": "<string>",
"columns": [
"<string>"
],
"baseline_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"categories": [
"<string>"
],
"segment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"segment": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"definition": "<string>"
}
}
]
}
'import requests
url = "https://api.example.com/v3/queries"
payload = {
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"queries": [
{
"query_key": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"model_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"metric": "<string>",
"columns": ["<string>"],
"baseline_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"categories": ["<string>"],
"segment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"segment": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"definition": "<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({
project_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
queries: [
{
query_key: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
model_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
metric: '<string>',
columns: ['<string>'],
baseline_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
categories: ['<string>'],
segment_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
segment: {id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', definition: '<string>'}
}
]
})
};
fetch('https://api.example.com/v3/queries', 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.example.com/v3/queries",
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([
'project_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'queries' => [
[
'query_key' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'model_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'metric' => '<string>',
'columns' => [
'<string>'
],
'baseline_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'categories' => [
'<string>'
],
'segment_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'segment' => [
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'definition' => '<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.example.com/v3/queries"
payload := strings.NewReader("{\n \"project_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"queries\": [\n {\n \"query_key\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"model_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"metric\": \"<string>\",\n \"columns\": [\n \"<string>\"\n ],\n \"baseline_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"categories\": [\n \"<string>\"\n ],\n \"segment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"segment\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"definition\": \"<string>\"\n }\n }\n ]\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.example.com/v3/queries")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"project_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"queries\": [\n {\n \"query_key\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"model_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"metric\": \"<string>\",\n \"columns\": [\n \"<string>\"\n ],\n \"baseline_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"categories\": [\n \"<string>\"\n ],\n \"segment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"segment\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"definition\": \"<string>\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v3/queries")
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 \"project_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"queries\": [\n {\n \"query_key\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"model_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"metric\": \"<string>\",\n \"columns\": [\n \"<string>\"\n ],\n \"baseline_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"categories\": [\n \"<string>\"\n ],\n \"segment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"segment\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"definition\": \"<string>\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"api_version": "3.0",
"kind": "NORMAL",
"data": {
"organization": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"project": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"asset_type": "ML_MODEL"
},
"query_type": "MONITORING",
"filters": {
"time_zone": "Etc/GMT",
"bin_size": "Hour",
"time_label": "yesterday",
"time_range": {
"start_time": "2023-11-07T05:31:56Z",
"end_time": "2023-11-07T05:31:56Z"
}
},
"time_comparison": "Previous Day",
"results": {}
}
}{
"api_version": "3.0",
"kind": "ERROR",
"error": {
"code": 400,
"message": "Resource Not Found",
"errors": [
{
"reason": "ResourceNotFoundException",
"message": "Resource Not Found",
"help": "<string>"
}
]
}
}{
"api_version": "3.0",
"kind": "ERROR",
"error": {
"code": 400,
"message": "Resource Not Found",
"errors": [
{
"reason": "ResourceNotFoundException",
"message": "Resource Not Found",
"help": "<string>"
}
]
}
}{
"api_version": "3.0",
"kind": "ERROR",
"error": {
"code": 400,
"message": "Resource Not Found",
"errors": [
{
"reason": "ResourceNotFoundException",
"message": "Resource Not Found",
"help": "<string>"
}
]
}
}{
"api_version": "3.0",
"kind": "ERROR",
"error": {
"code": 400,
"message": "Resource Not Found",
"errors": [
{
"reason": "ResourceNotFoundException",
"message": "Resource Not Found",
"help": "<string>"
}
]
}
}{
"api_version": "3.0",
"kind": "ERROR",
"error": {
"code": 400,
"message": "Resource Not Found",
"errors": [
{
"reason": "ResourceNotFoundException",
"message": "Resource Not Found",
"help": "<string>"
}
]
}
}{
"api_version": "3.0",
"kind": "ERROR",
"error": {
"code": 400,
"message": "Resource Not Found",
"errors": [
{
"reason": "ResourceNotFoundException",
"message": "Resource Not Found",
"help": "<string>"
}
]
}
}Authorizations
Body
- Monitoring queries request object
- LLM Monitoring queries request object
Monitoring queries request object
Was this page helpful?