Fetch Data
curl --request POST \
--url https://pivot-table.sightx.io/v1/pivotTable/fetchData \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"projectId": "{{projectId}}",
"fromDate": "",
"toDate": "",
"filter": [],
"measures": {
"0": {
"aggregationType": 1,
"label": "Count",
"questionId": ""
},
"1": {
"aggregationType": 1
}
},
"dimensions": {
"0": "60e320e3ffcabb005be2af25",
"1": "60e320e3ffcabb005be2af24"
},
"groups": {
"60e320e3ffcabb005be2af23": [
"60e320e3ffcabb005be2af23"
],
"60e320e3ffcabb005be2af24": [
"60e320e3ffcabb005be2af24"
],
"60e320e3ffcabb005be2af25": [
"60e320e3ffcabb005be2af25"
],
"60e320e3ffcabb005be2af26": [
"60e320e3ffcabb005be2af26"
]
},
"batches": [],
"conceptAsDimesion": "",
"columns": [
"60e320e3ffcabb005be2af25-1",
"60e320e3ffcabb005be2af25-2",
"60e320e3ffcabb005be2af25-3",
"60e320e3ffcabb005be2af25-4"
],
"rows": [
"60e320e3ffcabb005be2af24-1",
"60e320e3ffcabb005be2af24-2",
"60e320e3ffcabb005be2af24-3",
"60e320e3ffcabb005be2af24-4",
"60e320e3ffcabb005be2af24-5",
"60e320e3ffcabb005be2af24-6",
"60e320e3ffcabb005be2af24-7"
]
}
'import requests
url = "https://pivot-table.sightx.io/v1/pivotTable/fetchData"
payload = {
"projectId": "{{projectId}}",
"fromDate": "",
"toDate": "",
"filter": [],
"measures": {
"0": {
"aggregationType": 1,
"label": "Count",
"questionId": ""
},
"1": { "aggregationType": 1 }
},
"dimensions": {
"0": "60e320e3ffcabb005be2af25",
"1": "60e320e3ffcabb005be2af24"
},
"groups": {
"60e320e3ffcabb005be2af23": ["60e320e3ffcabb005be2af23"],
"60e320e3ffcabb005be2af24": ["60e320e3ffcabb005be2af24"],
"60e320e3ffcabb005be2af25": ["60e320e3ffcabb005be2af25"],
"60e320e3ffcabb005be2af26": ["60e320e3ffcabb005be2af26"]
},
"batches": [],
"conceptAsDimesion": "",
"columns": ["60e320e3ffcabb005be2af25-1", "60e320e3ffcabb005be2af25-2", "60e320e3ffcabb005be2af25-3", "60e320e3ffcabb005be2af25-4"],
"rows": ["60e320e3ffcabb005be2af24-1", "60e320e3ffcabb005be2af24-2", "60e320e3ffcabb005be2af24-3", "60e320e3ffcabb005be2af24-4", "60e320e3ffcabb005be2af24-5", "60e320e3ffcabb005be2af24-6", "60e320e3ffcabb005be2af24-7"]
}
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({
projectId: '{{projectId}}',
fromDate: '',
toDate: '',
filter: [],
measures: {
'0': {aggregationType: 1, label: 'Count', questionId: ''},
'1': {aggregationType: 1}
},
dimensions: {'0': '60e320e3ffcabb005be2af25', '1': '60e320e3ffcabb005be2af24'},
groups: {
'60e320e3ffcabb005be2af23': ['60e320e3ffcabb005be2af23'],
'60e320e3ffcabb005be2af24': ['60e320e3ffcabb005be2af24'],
'60e320e3ffcabb005be2af25': ['60e320e3ffcabb005be2af25'],
'60e320e3ffcabb005be2af26': ['60e320e3ffcabb005be2af26']
},
batches: [],
conceptAsDimesion: '',
columns: [
'60e320e3ffcabb005be2af25-1',
'60e320e3ffcabb005be2af25-2',
'60e320e3ffcabb005be2af25-3',
'60e320e3ffcabb005be2af25-4'
],
rows: [
'60e320e3ffcabb005be2af24-1',
'60e320e3ffcabb005be2af24-2',
'60e320e3ffcabb005be2af24-3',
'60e320e3ffcabb005be2af24-4',
'60e320e3ffcabb005be2af24-5',
'60e320e3ffcabb005be2af24-6',
'60e320e3ffcabb005be2af24-7'
]
})
};
fetch('https://pivot-table.sightx.io/v1/pivotTable/fetchData', 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://pivot-table.sightx.io/v1/pivotTable/fetchData",
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([
'projectId' => '{{projectId}}',
'fromDate' => '',
'toDate' => '',
'filter' => [
],
'measures' => [
'0' => [
'aggregationType' => 1,
'label' => 'Count',
'questionId' => ''
],
'1' => [
'aggregationType' => 1
]
],
'dimensions' => [
'0' => '60e320e3ffcabb005be2af25',
'1' => '60e320e3ffcabb005be2af24'
],
'groups' => [
'60e320e3ffcabb005be2af23' => [
'60e320e3ffcabb005be2af23'
],
'60e320e3ffcabb005be2af24' => [
'60e320e3ffcabb005be2af24'
],
'60e320e3ffcabb005be2af25' => [
'60e320e3ffcabb005be2af25'
],
'60e320e3ffcabb005be2af26' => [
'60e320e3ffcabb005be2af26'
]
],
'batches' => [
],
'conceptAsDimesion' => '',
'columns' => [
'60e320e3ffcabb005be2af25-1',
'60e320e3ffcabb005be2af25-2',
'60e320e3ffcabb005be2af25-3',
'60e320e3ffcabb005be2af25-4'
],
'rows' => [
'60e320e3ffcabb005be2af24-1',
'60e320e3ffcabb005be2af24-2',
'60e320e3ffcabb005be2af24-3',
'60e320e3ffcabb005be2af24-4',
'60e320e3ffcabb005be2af24-5',
'60e320e3ffcabb005be2af24-6',
'60e320e3ffcabb005be2af24-7'
]
]),
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://pivot-table.sightx.io/v1/pivotTable/fetchData"
payload := strings.NewReader("{\n \"projectId\": \"{{projectId}}\",\n \"fromDate\": \"\",\n \"toDate\": \"\",\n \"filter\": [],\n \"measures\": {\n \"0\": {\n \"aggregationType\": 1,\n \"label\": \"Count\",\n \"questionId\": \"\"\n },\n \"1\": {\n \"aggregationType\": 1\n }\n },\n \"dimensions\": {\n \"0\": \"60e320e3ffcabb005be2af25\",\n \"1\": \"60e320e3ffcabb005be2af24\"\n },\n \"groups\": {\n \"60e320e3ffcabb005be2af23\": [\n \"60e320e3ffcabb005be2af23\"\n ],\n \"60e320e3ffcabb005be2af24\": [\n \"60e320e3ffcabb005be2af24\"\n ],\n \"60e320e3ffcabb005be2af25\": [\n \"60e320e3ffcabb005be2af25\"\n ],\n \"60e320e3ffcabb005be2af26\": [\n \"60e320e3ffcabb005be2af26\"\n ]\n },\n \"batches\": [],\n \"conceptAsDimesion\": \"\",\n \"columns\": [\n \"60e320e3ffcabb005be2af25-1\",\n \"60e320e3ffcabb005be2af25-2\",\n \"60e320e3ffcabb005be2af25-3\",\n \"60e320e3ffcabb005be2af25-4\"\n ],\n \"rows\": [\n \"60e320e3ffcabb005be2af24-1\",\n \"60e320e3ffcabb005be2af24-2\",\n \"60e320e3ffcabb005be2af24-3\",\n \"60e320e3ffcabb005be2af24-4\",\n \"60e320e3ffcabb005be2af24-5\",\n \"60e320e3ffcabb005be2af24-6\",\n \"60e320e3ffcabb005be2af24-7\"\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://pivot-table.sightx.io/v1/pivotTable/fetchData")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"projectId\": \"{{projectId}}\",\n \"fromDate\": \"\",\n \"toDate\": \"\",\n \"filter\": [],\n \"measures\": {\n \"0\": {\n \"aggregationType\": 1,\n \"label\": \"Count\",\n \"questionId\": \"\"\n },\n \"1\": {\n \"aggregationType\": 1\n }\n },\n \"dimensions\": {\n \"0\": \"60e320e3ffcabb005be2af25\",\n \"1\": \"60e320e3ffcabb005be2af24\"\n },\n \"groups\": {\n \"60e320e3ffcabb005be2af23\": [\n \"60e320e3ffcabb005be2af23\"\n ],\n \"60e320e3ffcabb005be2af24\": [\n \"60e320e3ffcabb005be2af24\"\n ],\n \"60e320e3ffcabb005be2af25\": [\n \"60e320e3ffcabb005be2af25\"\n ],\n \"60e320e3ffcabb005be2af26\": [\n \"60e320e3ffcabb005be2af26\"\n ]\n },\n \"batches\": [],\n \"conceptAsDimesion\": \"\",\n \"columns\": [\n \"60e320e3ffcabb005be2af25-1\",\n \"60e320e3ffcabb005be2af25-2\",\n \"60e320e3ffcabb005be2af25-3\",\n \"60e320e3ffcabb005be2af25-4\"\n ],\n \"rows\": [\n \"60e320e3ffcabb005be2af24-1\",\n \"60e320e3ffcabb005be2af24-2\",\n \"60e320e3ffcabb005be2af24-3\",\n \"60e320e3ffcabb005be2af24-4\",\n \"60e320e3ffcabb005be2af24-5\",\n \"60e320e3ffcabb005be2af24-6\",\n \"60e320e3ffcabb005be2af24-7\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pivot-table.sightx.io/v1/pivotTable/fetchData")
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 \"projectId\": \"{{projectId}}\",\n \"fromDate\": \"\",\n \"toDate\": \"\",\n \"filter\": [],\n \"measures\": {\n \"0\": {\n \"aggregationType\": 1,\n \"label\": \"Count\",\n \"questionId\": \"\"\n },\n \"1\": {\n \"aggregationType\": 1\n }\n },\n \"dimensions\": {\n \"0\": \"60e320e3ffcabb005be2af25\",\n \"1\": \"60e320e3ffcabb005be2af24\"\n },\n \"groups\": {\n \"60e320e3ffcabb005be2af23\": [\n \"60e320e3ffcabb005be2af23\"\n ],\n \"60e320e3ffcabb005be2af24\": [\n \"60e320e3ffcabb005be2af24\"\n ],\n \"60e320e3ffcabb005be2af25\": [\n \"60e320e3ffcabb005be2af25\"\n ],\n \"60e320e3ffcabb005be2af26\": [\n \"60e320e3ffcabb005be2af26\"\n ]\n },\n \"batches\": [],\n \"conceptAsDimesion\": \"\",\n \"columns\": [\n \"60e320e3ffcabb005be2af25-1\",\n \"60e320e3ffcabb005be2af25-2\",\n \"60e320e3ffcabb005be2af25-3\",\n \"60e320e3ffcabb005be2af25-4\"\n ],\n \"rows\": [\n \"60e320e3ffcabb005be2af24-1\",\n \"60e320e3ffcabb005be2af24-2\",\n \"60e320e3ffcabb005be2af24-3\",\n \"60e320e3ffcabb005be2af24-4\",\n \"60e320e3ffcabb005be2af24-5\",\n \"60e320e3ffcabb005be2af24-6\",\n \"60e320e3ffcabb005be2af24-7\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"chiSquare": {
"tableChiSquare": {
"pValue": null
},
"pairwiseChiSquare": {
"byCols": [
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
]
],
"byRows": [
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
]
]
}
},
"matrix": [
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
]
]
}Analysis / Pivot table
Fetch Data
Description
Get pivot table data based on measures and dimensions passed through request’s body.
Payload
{
"projectId": string,
"fromDate": string,
"toDate": string,
"filter": array,
"dimensions": object,
"measures": object,
"groups": array,
"rows": array,
"columns": array,
"conceptAsDimesion": string,
"batches": array
}
where:
projectId: Id of the project to look for. (Required).fromDate: Starting date to filter responses.toDate: End date to filter responses.filter: List of filters to apply to the pivot table data.dimensions: Ids of questions used for this pivot tablemeasures: Measure values to show in the pivot tablerows: List of rows to show on the tablecolumns: List of columns to show on the tableconceptAsDimesion: Id of the concept test used as dimension in the pivot table.
Measures
Measure values to show in the pivot table
{
"aggregationType": number,
"label": string,
"questionId": string
}
Where:
aggregationType: Type of aggregator format for the value. Could be:- 1: count
- 2: min
- 3: max
- 4: sum
- 5: average
label: Name of the aggregation typequestionId: Id of the question selected for this measurement
Response
200 OK
{
"matrix": array,
"chiSquare": object,
}
where:
matrix: Matrix containing the values used for the pivot table.chiSquare
Chi Square
{
"pairwiseChiSquare": object,
"tableChiSquare": object
}
Where:
pairwiseChiSquare: Critical value, df and pValue by columns and rowstableChiSquare: Critical value, df and pValue of the table.
401 Unauthorized
Invalid authorization.
404 Not Found
Resource not found.
500 Internal Server Error
Error occurred in the service.
POST
/
v1
/
pivotTable
/
fetchData
Fetch Data
curl --request POST \
--url https://pivot-table.sightx.io/v1/pivotTable/fetchData \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"projectId": "{{projectId}}",
"fromDate": "",
"toDate": "",
"filter": [],
"measures": {
"0": {
"aggregationType": 1,
"label": "Count",
"questionId": ""
},
"1": {
"aggregationType": 1
}
},
"dimensions": {
"0": "60e320e3ffcabb005be2af25",
"1": "60e320e3ffcabb005be2af24"
},
"groups": {
"60e320e3ffcabb005be2af23": [
"60e320e3ffcabb005be2af23"
],
"60e320e3ffcabb005be2af24": [
"60e320e3ffcabb005be2af24"
],
"60e320e3ffcabb005be2af25": [
"60e320e3ffcabb005be2af25"
],
"60e320e3ffcabb005be2af26": [
"60e320e3ffcabb005be2af26"
]
},
"batches": [],
"conceptAsDimesion": "",
"columns": [
"60e320e3ffcabb005be2af25-1",
"60e320e3ffcabb005be2af25-2",
"60e320e3ffcabb005be2af25-3",
"60e320e3ffcabb005be2af25-4"
],
"rows": [
"60e320e3ffcabb005be2af24-1",
"60e320e3ffcabb005be2af24-2",
"60e320e3ffcabb005be2af24-3",
"60e320e3ffcabb005be2af24-4",
"60e320e3ffcabb005be2af24-5",
"60e320e3ffcabb005be2af24-6",
"60e320e3ffcabb005be2af24-7"
]
}
'import requests
url = "https://pivot-table.sightx.io/v1/pivotTable/fetchData"
payload = {
"projectId": "{{projectId}}",
"fromDate": "",
"toDate": "",
"filter": [],
"measures": {
"0": {
"aggregationType": 1,
"label": "Count",
"questionId": ""
},
"1": { "aggregationType": 1 }
},
"dimensions": {
"0": "60e320e3ffcabb005be2af25",
"1": "60e320e3ffcabb005be2af24"
},
"groups": {
"60e320e3ffcabb005be2af23": ["60e320e3ffcabb005be2af23"],
"60e320e3ffcabb005be2af24": ["60e320e3ffcabb005be2af24"],
"60e320e3ffcabb005be2af25": ["60e320e3ffcabb005be2af25"],
"60e320e3ffcabb005be2af26": ["60e320e3ffcabb005be2af26"]
},
"batches": [],
"conceptAsDimesion": "",
"columns": ["60e320e3ffcabb005be2af25-1", "60e320e3ffcabb005be2af25-2", "60e320e3ffcabb005be2af25-3", "60e320e3ffcabb005be2af25-4"],
"rows": ["60e320e3ffcabb005be2af24-1", "60e320e3ffcabb005be2af24-2", "60e320e3ffcabb005be2af24-3", "60e320e3ffcabb005be2af24-4", "60e320e3ffcabb005be2af24-5", "60e320e3ffcabb005be2af24-6", "60e320e3ffcabb005be2af24-7"]
}
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({
projectId: '{{projectId}}',
fromDate: '',
toDate: '',
filter: [],
measures: {
'0': {aggregationType: 1, label: 'Count', questionId: ''},
'1': {aggregationType: 1}
},
dimensions: {'0': '60e320e3ffcabb005be2af25', '1': '60e320e3ffcabb005be2af24'},
groups: {
'60e320e3ffcabb005be2af23': ['60e320e3ffcabb005be2af23'],
'60e320e3ffcabb005be2af24': ['60e320e3ffcabb005be2af24'],
'60e320e3ffcabb005be2af25': ['60e320e3ffcabb005be2af25'],
'60e320e3ffcabb005be2af26': ['60e320e3ffcabb005be2af26']
},
batches: [],
conceptAsDimesion: '',
columns: [
'60e320e3ffcabb005be2af25-1',
'60e320e3ffcabb005be2af25-2',
'60e320e3ffcabb005be2af25-3',
'60e320e3ffcabb005be2af25-4'
],
rows: [
'60e320e3ffcabb005be2af24-1',
'60e320e3ffcabb005be2af24-2',
'60e320e3ffcabb005be2af24-3',
'60e320e3ffcabb005be2af24-4',
'60e320e3ffcabb005be2af24-5',
'60e320e3ffcabb005be2af24-6',
'60e320e3ffcabb005be2af24-7'
]
})
};
fetch('https://pivot-table.sightx.io/v1/pivotTable/fetchData', 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://pivot-table.sightx.io/v1/pivotTable/fetchData",
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([
'projectId' => '{{projectId}}',
'fromDate' => '',
'toDate' => '',
'filter' => [
],
'measures' => [
'0' => [
'aggregationType' => 1,
'label' => 'Count',
'questionId' => ''
],
'1' => [
'aggregationType' => 1
]
],
'dimensions' => [
'0' => '60e320e3ffcabb005be2af25',
'1' => '60e320e3ffcabb005be2af24'
],
'groups' => [
'60e320e3ffcabb005be2af23' => [
'60e320e3ffcabb005be2af23'
],
'60e320e3ffcabb005be2af24' => [
'60e320e3ffcabb005be2af24'
],
'60e320e3ffcabb005be2af25' => [
'60e320e3ffcabb005be2af25'
],
'60e320e3ffcabb005be2af26' => [
'60e320e3ffcabb005be2af26'
]
],
'batches' => [
],
'conceptAsDimesion' => '',
'columns' => [
'60e320e3ffcabb005be2af25-1',
'60e320e3ffcabb005be2af25-2',
'60e320e3ffcabb005be2af25-3',
'60e320e3ffcabb005be2af25-4'
],
'rows' => [
'60e320e3ffcabb005be2af24-1',
'60e320e3ffcabb005be2af24-2',
'60e320e3ffcabb005be2af24-3',
'60e320e3ffcabb005be2af24-4',
'60e320e3ffcabb005be2af24-5',
'60e320e3ffcabb005be2af24-6',
'60e320e3ffcabb005be2af24-7'
]
]),
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://pivot-table.sightx.io/v1/pivotTable/fetchData"
payload := strings.NewReader("{\n \"projectId\": \"{{projectId}}\",\n \"fromDate\": \"\",\n \"toDate\": \"\",\n \"filter\": [],\n \"measures\": {\n \"0\": {\n \"aggregationType\": 1,\n \"label\": \"Count\",\n \"questionId\": \"\"\n },\n \"1\": {\n \"aggregationType\": 1\n }\n },\n \"dimensions\": {\n \"0\": \"60e320e3ffcabb005be2af25\",\n \"1\": \"60e320e3ffcabb005be2af24\"\n },\n \"groups\": {\n \"60e320e3ffcabb005be2af23\": [\n \"60e320e3ffcabb005be2af23\"\n ],\n \"60e320e3ffcabb005be2af24\": [\n \"60e320e3ffcabb005be2af24\"\n ],\n \"60e320e3ffcabb005be2af25\": [\n \"60e320e3ffcabb005be2af25\"\n ],\n \"60e320e3ffcabb005be2af26\": [\n \"60e320e3ffcabb005be2af26\"\n ]\n },\n \"batches\": [],\n \"conceptAsDimesion\": \"\",\n \"columns\": [\n \"60e320e3ffcabb005be2af25-1\",\n \"60e320e3ffcabb005be2af25-2\",\n \"60e320e3ffcabb005be2af25-3\",\n \"60e320e3ffcabb005be2af25-4\"\n ],\n \"rows\": [\n \"60e320e3ffcabb005be2af24-1\",\n \"60e320e3ffcabb005be2af24-2\",\n \"60e320e3ffcabb005be2af24-3\",\n \"60e320e3ffcabb005be2af24-4\",\n \"60e320e3ffcabb005be2af24-5\",\n \"60e320e3ffcabb005be2af24-6\",\n \"60e320e3ffcabb005be2af24-7\"\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://pivot-table.sightx.io/v1/pivotTable/fetchData")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"projectId\": \"{{projectId}}\",\n \"fromDate\": \"\",\n \"toDate\": \"\",\n \"filter\": [],\n \"measures\": {\n \"0\": {\n \"aggregationType\": 1,\n \"label\": \"Count\",\n \"questionId\": \"\"\n },\n \"1\": {\n \"aggregationType\": 1\n }\n },\n \"dimensions\": {\n \"0\": \"60e320e3ffcabb005be2af25\",\n \"1\": \"60e320e3ffcabb005be2af24\"\n },\n \"groups\": {\n \"60e320e3ffcabb005be2af23\": [\n \"60e320e3ffcabb005be2af23\"\n ],\n \"60e320e3ffcabb005be2af24\": [\n \"60e320e3ffcabb005be2af24\"\n ],\n \"60e320e3ffcabb005be2af25\": [\n \"60e320e3ffcabb005be2af25\"\n ],\n \"60e320e3ffcabb005be2af26\": [\n \"60e320e3ffcabb005be2af26\"\n ]\n },\n \"batches\": [],\n \"conceptAsDimesion\": \"\",\n \"columns\": [\n \"60e320e3ffcabb005be2af25-1\",\n \"60e320e3ffcabb005be2af25-2\",\n \"60e320e3ffcabb005be2af25-3\",\n \"60e320e3ffcabb005be2af25-4\"\n ],\n \"rows\": [\n \"60e320e3ffcabb005be2af24-1\",\n \"60e320e3ffcabb005be2af24-2\",\n \"60e320e3ffcabb005be2af24-3\",\n \"60e320e3ffcabb005be2af24-4\",\n \"60e320e3ffcabb005be2af24-5\",\n \"60e320e3ffcabb005be2af24-6\",\n \"60e320e3ffcabb005be2af24-7\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pivot-table.sightx.io/v1/pivotTable/fetchData")
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 \"projectId\": \"{{projectId}}\",\n \"fromDate\": \"\",\n \"toDate\": \"\",\n \"filter\": [],\n \"measures\": {\n \"0\": {\n \"aggregationType\": 1,\n \"label\": \"Count\",\n \"questionId\": \"\"\n },\n \"1\": {\n \"aggregationType\": 1\n }\n },\n \"dimensions\": {\n \"0\": \"60e320e3ffcabb005be2af25\",\n \"1\": \"60e320e3ffcabb005be2af24\"\n },\n \"groups\": {\n \"60e320e3ffcabb005be2af23\": [\n \"60e320e3ffcabb005be2af23\"\n ],\n \"60e320e3ffcabb005be2af24\": [\n \"60e320e3ffcabb005be2af24\"\n ],\n \"60e320e3ffcabb005be2af25\": [\n \"60e320e3ffcabb005be2af25\"\n ],\n \"60e320e3ffcabb005be2af26\": [\n \"60e320e3ffcabb005be2af26\"\n ]\n },\n \"batches\": [],\n \"conceptAsDimesion\": \"\",\n \"columns\": [\n \"60e320e3ffcabb005be2af25-1\",\n \"60e320e3ffcabb005be2af25-2\",\n \"60e320e3ffcabb005be2af25-3\",\n \"60e320e3ffcabb005be2af25-4\"\n ],\n \"rows\": [\n \"60e320e3ffcabb005be2af24-1\",\n \"60e320e3ffcabb005be2af24-2\",\n \"60e320e3ffcabb005be2af24-3\",\n \"60e320e3ffcabb005be2af24-4\",\n \"60e320e3ffcabb005be2af24-5\",\n \"60e320e3ffcabb005be2af24-6\",\n \"60e320e3ffcabb005be2af24-7\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"chiSquare": {
"tableChiSquare": {
"pValue": null
},
"pairwiseChiSquare": {
"byCols": [
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
]
],
"byRows": [
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
]
]
}
},
"matrix": [
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
],
[
{},
{},
{},
{}
]
]
}Description
Get pivot table data based on measures and dimensions passed through request’s body.Payload
{
"projectId": string,
"fromDate": string,
"toDate": string,
"filter": array,
"dimensions": object,
"measures": object,
"groups": array,
"rows": array,
"columns": array,
"conceptAsDimesion": string,
"batches": array
}
projectId: Id of the project to look for. (Required).fromDate: Starting date to filter responses.toDate: End date to filter responses.filter: List of filters to apply to the pivot table data.dimensions: Ids of questions used for this pivot tablemeasures: Measure values to show in the pivot tablerows: List of rows to show on the tablecolumns: List of columns to show on the tableconceptAsDimesion: Id of the concept test used as dimension in the pivot table.
Measures
Measure values to show in the pivot table{
"aggregationType": number,
"label": string,
"questionId": string
}
aggregationType: Type of aggregator format for the value. Could be:- 1: count
- 2: min
- 3: max
- 4: sum
- 5: average
label: Name of the aggregation typequestionId: Id of the question selected for this measurement
Response
200 OK
{
"matrix": array,
"chiSquare": object,
}
matrix: Matrix containing the values used for the pivot table.chiSquare
Chi Square
{
"pairwiseChiSquare": object,
"tableChiSquare": object
}
pairwiseChiSquare: Critical value, df and pValue by columns and rowstableChiSquare: Critical value, df and pValue of the table.
401 Unauthorized
Invalid authorization.
404 Not Found
Resource not found.
500 Internal Server Error
Error occurred in the service.
Was this page helpful?
⌘I