Run a saved query now (a SQL warehouse or Pendo)
curl --request POST \
--url https://api.statisfy.com/v1/integrations/{key}/runs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query_id": "<string>",
"end_date": "<string>",
"start_date": "<string>"
}
'import requests
url = "https://api.statisfy.com/v1/integrations/{key}/runs"
payload = {
"query_id": "<string>",
"end_date": "<string>",
"start_date": "<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({query_id: '<string>', end_date: '<string>', start_date: '<string>'})
};
fetch('https://api.statisfy.com/v1/integrations/{key}/runs', 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.statisfy.com/v1/integrations/{key}/runs",
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([
'query_id' => '<string>',
'end_date' => '<string>',
'start_date' => '<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.statisfy.com/v1/integrations/{key}/runs"
payload := strings.NewReader("{\n \"query_id\": \"<string>\",\n \"end_date\": \"<string>\",\n \"start_date\": \"<string>\"\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.statisfy.com/v1/integrations/{key}/runs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query_id\": \"<string>\",\n \"end_date\": \"<string>\",\n \"start_date\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.statisfy.com/v1/integrations/{key}/runs")
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 \"query_id\": \"<string>\",\n \"end_date\": \"<string>\",\n \"start_date\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"run_id": 123,
"started_at": "2023-11-07T05:31:56Z",
"status": "scheduled"
}{
"message": "<string>",
"run_id": 123,
"started_at": "2023-11-07T05:31:56Z",
"status": "scheduled"
}integrations
Run a saved query now (a SQL warehouse or Pendo)
Starts a run of one saved query (202), as Run now does in the app. A product_usage query can backfill a range (start_date and end_date; for pendo, at most 90 days). For pendo, the NPS survey job has no saved query: start it with POST /v1/integrations/pendo/surveys/runs. When a run of its subtype is already in flight, nothing starts and that run comes back (200, already_running). A 409 means the CRM has not synced yet, which every non-CRM integration waits for. Poll /runs/ for the outcome.
POST
/
v1
/
integrations
/
{key}
/
runs
Run a saved query now (a SQL warehouse or Pendo)
curl --request POST \
--url https://api.statisfy.com/v1/integrations/{key}/runs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query_id": "<string>",
"end_date": "<string>",
"start_date": "<string>"
}
'import requests
url = "https://api.statisfy.com/v1/integrations/{key}/runs"
payload = {
"query_id": "<string>",
"end_date": "<string>",
"start_date": "<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({query_id: '<string>', end_date: '<string>', start_date: '<string>'})
};
fetch('https://api.statisfy.com/v1/integrations/{key}/runs', 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.statisfy.com/v1/integrations/{key}/runs",
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([
'query_id' => '<string>',
'end_date' => '<string>',
'start_date' => '<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.statisfy.com/v1/integrations/{key}/runs"
payload := strings.NewReader("{\n \"query_id\": \"<string>\",\n \"end_date\": \"<string>\",\n \"start_date\": \"<string>\"\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.statisfy.com/v1/integrations/{key}/runs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query_id\": \"<string>\",\n \"end_date\": \"<string>\",\n \"start_date\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.statisfy.com/v1/integrations/{key}/runs")
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 \"query_id\": \"<string>\",\n \"end_date\": \"<string>\",\n \"start_date\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"run_id": 123,
"started_at": "2023-11-07T05:31:56Z",
"status": "scheduled"
}{
"message": "<string>",
"run_id": 123,
"started_at": "2023-11-07T05:31:56Z",
"status": "scheduled"
}Authorizations
An API key, sent as Authorization: Bearer stfy_live_…. See Authentication for how to get one and which scopes it needs.
Body
application/json
Response
Successful Response
Was this page helpful?