GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Cube Documentation home page
  • Demos
  • Changelog
  • Community
  • Get Started
  • Documentation
  • Admin
  • Embedding
  • Reference
  • Cube Core
  • Recipes
  • API
  • Authentication
  • POSTJSON query

This view

  • Original page
  • New address

GeezerVison is showing docs.cube.dev — JSON query - Cube Documentation

JSON query
curl --request POST \
  --url https://{deployment}.{region}.cubecloudapp.dev/cubejs-api/v1/load \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "queryType": "<string>",
  "query": {
    "measures": [
      "<string>"
    ],
    "dimensions": [
      "<string>"
    ],
    "segments": [
      "<string>"
    ],
    "timeDimensions": [
      {
        "dimension": "<string>",
        "granularity": "<string>",
        "dateRange": {}
      }
    ],
    "order": [
      [
        "<string>"
      ]
    ],
    "limit": 123,
    "offset": 123,
    "filters": [
      {
        "member": "<string>",
        "operator": "<string>",
        "values": [
          "<string>"
        ]
      }
    ],
    "ungrouped": true,
    "joinHints": [
      [
        "<string>"
      ]
    ],
    "timezone": "<string>"
  }
}
'
import requests

url = "https://{deployment}.{region}.cubecloudapp.dev/cubejs-api/v1/load"

payload = {
    "queryType": "<string>",
    "query": {
        "measures": ["<string>"],
        "dimensions": ["<string>"],
        "segments": ["<string>"],
        "timeDimensions": [
            {
                "dimension": "<string>",
                "granularity": "<string>",
                "dateRange": {}
            }
        ],
        "order": [["<string>"]],
        "limit": 123,
        "offset": 123,
        "filters": [
            {
                "member": "<string>",
                "operator": "<string>",
                "values": ["<string>"]
            }
        ],
        "ungrouped": True,
        "joinHints": [["<string>"]],
        "timezone": "<string>"
    }
}
headers = {
    "Authorization": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    queryType: '<string>',
    query: {
      measures: ['<string>'],
      dimensions: ['<string>'],
      segments: ['<string>'],
      timeDimensions: [{dimension: '<string>', granularity: '<string>', dateRange: {}}],
      order: [['<string>']],
      limit: 123,
      offset: 123,
      filters: [{member: '<string>', operator: '<string>', values: ['<string>']}],
      ungrouped: true,
      joinHints: [['<string>']],
      timezone: '<string>'
    }
  })
};

fetch('https://{deployment}.{region}.cubecloudapp.dev/cubejs-api/v1/load', 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://{deployment}.{region}.cubecloudapp.dev/cubejs-api/v1/load",
  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([
    'queryType' => '<string>',
    'query' => [
        'measures' => [
                '<string>'
        ],
        'dimensions' => [
                '<string>'
        ],
        'segments' => [
                '<string>'
        ],
        'timeDimensions' => [
                [
                                'dimension' => '<string>',
                                'granularity' => '<string>',
                                'dateRange' => [
                                                                
                                ]
                ]
        ],
        'order' => [
                [
                                '<string>'
                ]
        ],
        'limit' => 123,
        'offset' => 123,
        'filters' => [
                [
                                'member' => '<string>',
                                'operator' => '<string>',
                                'values' => [
                                                                '<string>'
                                ]
                ]
        ],
        'ungrouped' => true,
        'joinHints' => [
                [
                                '<string>'
                ]
        ],
        'timezone' => '<string>'
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: <api-key>",
    "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://{deployment}.{region}.cubecloudapp.dev/cubejs-api/v1/load"

	payload := strings.NewReader("{\n  \"queryType\": \"<string>\",\n  \"query\": {\n    \"measures\": [\n      \"<string>\"\n    ],\n    \"dimensions\": [\n      \"<string>\"\n    ],\n    \"segments\": [\n      \"<string>\"\n    ],\n    \"timeDimensions\": [\n      {\n        \"dimension\": \"<string>\",\n        \"granularity\": \"<string>\",\n        \"dateRange\": {}\n      }\n    ],\n    \"order\": [\n      [\n        \"<string>\"\n      ]\n    ],\n    \"limit\": 123,\n    \"offset\": 123,\n    \"filters\": [\n      {\n        \"member\": \"<string>\",\n        \"operator\": \"<string>\",\n        \"values\": [\n          \"<string>\"\n        ]\n      }\n    ],\n    \"ungrouped\": true,\n    \"joinHints\": [\n      [\n        \"<string>\"\n      ]\n    ],\n    \"timezone\": \"<string>\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "<api-key>")
	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://{deployment}.{region}.cubecloudapp.dev/cubejs-api/v1/load")
  .header("Authorization", "<api-key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"queryType\": \"<string>\",\n  \"query\": {\n    \"measures\": [\n      \"<string>\"\n    ],\n    \"dimensions\": [\n      \"<string>\"\n    ],\n    \"segments\": [\n      \"<string>\"\n    ],\n    \"timeDimensions\": [\n      {\n        \"dimension\": \"<string>\",\n        \"granularity\": \"<string>\",\n        \"dateRange\": {}\n      }\n    ],\n    \"order\": [\n      [\n        \"<string>\"\n      ]\n    ],\n    \"limit\": 123,\n    \"offset\": 123,\n    \"filters\": [\n      {\n        \"member\": \"<string>\",\n        \"operator\": \"<string>\",\n        \"values\": [\n          \"<string>\"\n        ]\n      }\n    ],\n    \"ungrouped\": true,\n    \"joinHints\": [\n      [\n        \"<string>\"\n      ]\n    ],\n    \"timezone\": \"<string>\"\n  }\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://{deployment}.{region}.cubecloudapp.dev/cubejs-api/v1/load")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"queryType\": \"<string>\",\n  \"query\": {\n    \"measures\": [\n      \"<string>\"\n    ],\n    \"dimensions\": [\n      \"<string>\"\n    ],\n    \"segments\": [\n      \"<string>\"\n    ],\n    \"timeDimensions\": [\n      {\n        \"dimension\": \"<string>\",\n        \"granularity\": \"<string>\",\n        \"dateRange\": {}\n      }\n    ],\n    \"order\": [\n      [\n        \"<string>\"\n      ]\n    ],\n    \"limit\": 123,\n    \"offset\": 123,\n    \"filters\": [\n      {\n        \"member\": \"<string>\",\n        \"operator\": \"<string>\",\n        \"values\": [\n          \"<string>\"\n        ]\n      }\n    ],\n    \"ungrouped\": true,\n    \"joinHints\": [\n      [\n        \"<string>\"\n      ]\n    ],\n    \"timezone\": \"<string>\"\n  }\n}"

response = http.request(request)
puts response.read_body
{
  "results": [
    {
      "annotation": {
        "measures": {},
        "dimensions": {},
        "segments": {},
        "timeDimensions": {}
      },
      "data": [
        {}
      ],
      "dataSource": "<string>",
      "refreshKeyValues": [
        {}
      ],
      "lastRefreshTime": "<string>",
      "external": true,
      "usedPreAggregations": {}
    }
  ],
  "pivotQuery": {},
  "slowQuery": true,
  "queryType": "<string>"
}
{
  "error": "<string>"
}
{
  "error": "<string>"
}
POST
/
v1
/
load
JSON query
curl --request POST \
  --url https://{deployment}.{region}.cubecloudapp.dev/cubejs-api/v1/load \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "queryType": "<string>",
  "query": {
    "measures": [
      "<string>"
    ],
    "dimensions": [
      "<string>"
    ],
    "segments": [
      "<string>"
    ],
    "timeDimensions": [
      {
        "dimension": "<string>",
        "granularity": "<string>",
        "dateRange": {}
      }
    ],
    "order": [
      [
        "<string>"
      ]
    ],
    "limit": 123,
    "offset": 123,
    "filters": [
      {
        "member": "<string>",
        "operator": "<string>",
        "values": [
          "<string>"
        ]
      }
    ],
    "ungrouped": true,
    "joinHints": [
      [
        "<string>"
      ]
    ],
    "timezone": "<string>"
  }
}
'
import requests

url = "https://{deployment}.{region}.cubecloudapp.dev/cubejs-api/v1/load"

payload = {
    "queryType": "<string>",
    "query": {
        "measures": ["<string>"],
        "dimensions": ["<string>"],
        "segments": ["<string>"],
        "timeDimensions": [
            {
                "dimension": "<string>",
                "granularity": "<string>",
                "dateRange": {}
            }
        ],
        "order": [["<string>"]],
        "limit": 123,
        "offset": 123,
        "filters": [
            {
                "member": "<string>",
                "operator": "<string>",
                "values": ["<string>"]
            }
        ],
        "ungrouped": True,
        "joinHints": [["<string>"]],
        "timezone": "<string>"
    }
}
headers = {
    "Authorization": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    queryType: '<string>',
    query: {
      measures: ['<string>'],
      dimensions: ['<string>'],
      segments: ['<string>'],
      timeDimensions: [{dimension: '<string>', granularity: '<string>', dateRange: {}}],
      order: [['<string>']],
      limit: 123,
      offset: 123,
      filters: [{member: '<string>', operator: '<string>', values: ['<string>']}],
      ungrouped: true,
      joinHints: [['<string>']],
      timezone: '<string>'
    }
  })
};

fetch('https://{deployment}.{region}.cubecloudapp.dev/cubejs-api/v1/load', 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://{deployment}.{region}.cubecloudapp.dev/cubejs-api/v1/load",
  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([
    'queryType' => '<string>',
    'query' => [
        'measures' => [
                '<string>'
        ],
        'dimensions' => [
                '<string>'
        ],
        'segments' => [
                '<string>'
        ],
        'timeDimensions' => [
                [
                                'dimension' => '<string>',
                                'granularity' => '<string>',
                                'dateRange' => [
                                                                
                                ]
                ]
        ],
        'order' => [
                [
                                '<string>'
                ]
        ],
        'limit' => 123,
        'offset' => 123,
        'filters' => [
                [
                                'member' => '<string>',
                                'operator' => '<string>',
                                'values' => [
                                                                '<string>'
                                ]
                ]
        ],
        'ungrouped' => true,
        'joinHints' => [
                [
                                '<string>'
                ]
        ],
        'timezone' => '<string>'
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: <api-key>",
    "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://{deployment}.{region}.cubecloudapp.dev/cubejs-api/v1/load"

	payload := strings.NewReader("{\n  \"queryType\": \"<string>\",\n  \"query\": {\n    \"measures\": [\n      \"<string>\"\n    ],\n    \"dimensions\": [\n      \"<string>\"\n    ],\n    \"segments\": [\n      \"<string>\"\n    ],\n    \"timeDimensions\": [\n      {\n        \"dimension\": \"<string>\",\n        \"granularity\": \"<string>\",\n        \"dateRange\": {}\n      }\n    ],\n    \"order\": [\n      [\n        \"<string>\"\n      ]\n    ],\n    \"limit\": 123,\n    \"offset\": 123,\n    \"filters\": [\n      {\n        \"member\": \"<string>\",\n        \"operator\": \"<string>\",\n        \"values\": [\n          \"<string>\"\n        ]\n      }\n    ],\n    \"ungrouped\": true,\n    \"joinHints\": [\n      [\n        \"<string>\"\n      ]\n    ],\n    \"timezone\": \"<string>\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "<api-key>")
	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://{deployment}.{region}.cubecloudapp.dev/cubejs-api/v1/load")
  .header("Authorization", "<api-key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"queryType\": \"<string>\",\n  \"query\": {\n    \"measures\": [\n      \"<string>\"\n    ],\n    \"dimensions\": [\n      \"<string>\"\n    ],\n    \"segments\": [\n      \"<string>\"\n    ],\n    \"timeDimensions\": [\n      {\n        \"dimension\": \"<string>\",\n        \"granularity\": \"<string>\",\n        \"dateRange\": {}\n      }\n    ],\n    \"order\": [\n      [\n        \"<string>\"\n      ]\n    ],\n    \"limit\": 123,\n    \"offset\": 123,\n    \"filters\": [\n      {\n        \"member\": \"<string>\",\n        \"operator\": \"<string>\",\n        \"values\": [\n          \"<string>\"\n        ]\n      }\n    ],\n    \"ungrouped\": true,\n    \"joinHints\": [\n      [\n        \"<string>\"\n      ]\n    ],\n    \"timezone\": \"<string>\"\n  }\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://{deployment}.{region}.cubecloudapp.dev/cubejs-api/v1/load")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"queryType\": \"<string>\",\n  \"query\": {\n    \"measures\": [\n      \"<string>\"\n    ],\n    \"dimensions\": [\n      \"<string>\"\n    ],\n    \"segments\": [\n      \"<string>\"\n    ],\n    \"timeDimensions\": [\n      {\n        \"dimension\": \"<string>\",\n        \"granularity\": \"<string>\",\n        \"dateRange\": {}\n      }\n    ],\n    \"order\": [\n      [\n        \"<string>\"\n      ]\n    ],\n    \"limit\": 123,\n    \"offset\": 123,\n    \"filters\": [\n      {\n        \"member\": \"<string>\",\n        \"operator\": \"<string>\",\n        \"values\": [\n          \"<string>\"\n        ]\n      }\n    ],\n    \"ungrouped\": true,\n    \"joinHints\": [\n      [\n        \"<string>\"\n      ]\n    ],\n    \"timezone\": \"<string>\"\n  }\n}"

response = http.request(request)
puts response.read_body
{
  "results": [
    {
      "annotation": {
        "measures": {},
        "dimensions": {},
        "segments": {},
        "timeDimensions": {}
      },
      "data": [
        {}
      ],
      "dataSource": "<string>",
      "refreshKeyValues": [
        {}
      ],
      "lastRefreshTime": "<string>",
      "external": true,
      "usedPreAggregations": {}
    }
  ],
  "pivotQuery": {},
  "slowQuery": true,
  "queryType": "<string>"
}
{
  "error": "<string>"
}
{
  "error": "<string>"
}

Authorizations

​
Authorization
string
header
required

Cube API token (a JWT). Sent directly in the Authorization header, e.g. Authorization: <CUBE_API_TOKEN> (no "Bearer" prefix).

Headers

​
x-request-id
string

Request id for tracing; for security, it must be unique and unpredictable, e.g., a random UUID. A request with an invalid id is rejected with 400. Generated when neither this header nor traceparent is sent.

Required string length: 1 - 128
Pattern: ^[A-Za-z0-9+/=._:@~-]+$
​
traceparent
string

W3C trace context header, used as the request id when x-request-id is absent. Same rules as x-request-id.

Required string length: 1 - 128
Pattern: ^[A-Za-z0-9+/=._:@~-]+$

Body

application/json
​
queryType
string
​
cache
enum<string>
Available options:
stale-if-slow,
stale-while-revalidate,
must-revalidate,
no-cache
​
query
object

Show child attributes

Response

successful operation

​
results
object[]
required

Show child attributes

​
pivotQuery
object
​
slowQuery
boolean
​
queryType
string
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.