curl --request GET \
--url https://api-dev.narrative.io/nql/{job_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-dev.narrative.io/nql/{job_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api-dev.narrative.io/nql/{job_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-dev.narrative.io/nql/{job_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: Bearer <token>"
],
]);
$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-dev.narrative.io/nql/{job_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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-dev.narrative.io/nql/{job_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/nql/{job_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyGet a forecast job
Poll a forecast job started by POST /nql/run with an EXPLAIN statement. result is null until
the job reaches completed or failed, then carries either the forecast or the failure message.
Only forecast jobs are served here. Statements run through POST /v1/nql/execute are workflow runs;
follow those through the workflows endpoints.
curl --request GET \
--url https://api-dev.narrative.io/nql/{job_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-dev.narrative.io/nql/{job_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api-dev.narrative.io/nql/{job_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-dev.narrative.io/nql/{job_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: Bearer <token>"
],
]);
$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-dev.narrative.io/nql/{job_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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-dev.narrative.io/nql/{job_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/nql/{job_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyAuthorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Unique identifier for a job.
Response
OK
A forecast job, started by an EXPLAIN statement.
Unique identifier for the job.
Company that ran the job.
345
The timestamp representing when the job was created.
causes of job failure
Show child attributes
Show child attributes
The unique ID associated with the job.
Who asked for the job. Discriminated by type: api_user for a job requested through the API on behalf
of a user, process for one enqueued by a Narrative process.
- Option 1
- Option 2
Show child attributes
Show child attributes
{ "type": "api_user", "company_id": 1, "user_id": 1248 }
Where a job is in its lifecycle.
pending— enqueued and waiting to be picked up.scheduled— claimed by an executor but not yet started.running— being executed.pending_cancellation— cancellation has been requested and the data plane has yet to stop the work.completed,cancelled,failed— terminal states.
pending, scheduled, running, pending_cancellation, completed, cancelled, failed The timestamp representing when the job was updated.
The query and its compiled SQL as sent to the executor.
Show child attributes
Show child attributes
When the job finished, or null while it is still pending or running.
The forecast once the job has completed, or the failure that ended it. Null while the job is pending or running.
- Option 1
- Option 2
Show child attributes
Show child attributes
Was this page helpful?

