curl --request GET \
--url https://api-dev.narrative.io/jobs \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-dev.narrative.io/jobs"
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/jobs', 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/jobs",
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/jobs"
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/jobs")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/jobs")
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_body{
"prev_page": null,
"current_page": 1,
"next_page": null,
"total_records": 1,
"total_pages": 1,
"records": [
{
"job_id": "2a5b9ad7-dc8f-47bb-8e62-843a38f8054c",
"company_id": 1,
"data_plane_id": "f79cbdae-4848-47ca-95e8-69588364d185",
"compute_pool_id": null,
"request_source": {
"type": "api_user",
"company_id": 1,
"user_id": 407
},
"state": "completed",
"type": "materialize-view",
"operator_type": "materialized-view-refresh",
"tags": [],
"input": {
"nql": "CREATE MATERIALIZED VIEW \"test_stats\" AS SELECT \"value\" FROM \"company_data\".\"10674\"",
"compiled_select": "SELECT\n `ds_10674`.`value`\nFROM\n narrative.datasets.ds_10674 `ds_10674`",
"create_as_view": null,
"dataset_id": 10736,
"billing_enabled": null,
"stats_enabled": true,
"contains_delta_syntax": null,
"first_run": false,
"merge": true,
"partitions": null,
"snowflake_create_table": null,
"snowflake_insert_statement": null,
"chunk_metadata": null,
"nio_last_modified_at": null,
"delta_dataset_bounds": null,
"write_mode": "append"
},
"executor": "job-executor-98e1f48e-bf54-4f11-bbd1-73c445120266",
"execution_cluster": "shared",
"idempotency_key": "10736:29329c64e7b8a4eda86aaabe04872b832ab456b5543d0c259c812525391f158c:669a5f8e4f373c2f907700decde47511aac6470f5698e2b856fb07f09160e5f2",
"result": {
"dataset_id": 10736,
"snapshot_id": 1724919539450264600,
"recalculation_id": "abf9a2ec-426b-4751-bd16-fcb435061925",
"row_stats": null
},
"dequeued_at": "2023-10-31T11:19:13.400498Z",
"created_at": "2023-10-31T11:19:13.400498Z",
"updated_at": "2023-10-31T11:25:08.327209Z",
"attempted_at": "2023-10-31T11:19:13.400498Z",
"attempt_version": 1,
"ended_at": "2023-10-31T11:25:08.327194Z",
"workflow_id": null,
"workflow_run_id": null
}
]
}{
"error": "Unauthorized",
"error_description": "You are not authorized to use this endpoint."
}Get jobs
Returns a list of jobs associated with the specified company, including job ID, job type, timestamp information, and results.
It returns a maximum of 500 jobs at a time to manage response size.
curl --request GET \
--url https://api-dev.narrative.io/jobs \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-dev.narrative.io/jobs"
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/jobs', 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/jobs",
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/jobs"
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/jobs")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/jobs")
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_body{
"prev_page": null,
"current_page": 1,
"next_page": null,
"total_records": 1,
"total_pages": 1,
"records": [
{
"job_id": "2a5b9ad7-dc8f-47bb-8e62-843a38f8054c",
"company_id": 1,
"data_plane_id": "f79cbdae-4848-47ca-95e8-69588364d185",
"compute_pool_id": null,
"request_source": {
"type": "api_user",
"company_id": 1,
"user_id": 407
},
"state": "completed",
"type": "materialize-view",
"operator_type": "materialized-view-refresh",
"tags": [],
"input": {
"nql": "CREATE MATERIALIZED VIEW \"test_stats\" AS SELECT \"value\" FROM \"company_data\".\"10674\"",
"compiled_select": "SELECT\n `ds_10674`.`value`\nFROM\n narrative.datasets.ds_10674 `ds_10674`",
"create_as_view": null,
"dataset_id": 10736,
"billing_enabled": null,
"stats_enabled": true,
"contains_delta_syntax": null,
"first_run": false,
"merge": true,
"partitions": null,
"snowflake_create_table": null,
"snowflake_insert_statement": null,
"chunk_metadata": null,
"nio_last_modified_at": null,
"delta_dataset_bounds": null,
"write_mode": "append"
},
"executor": "job-executor-98e1f48e-bf54-4f11-bbd1-73c445120266",
"execution_cluster": "shared",
"idempotency_key": "10736:29329c64e7b8a4eda86aaabe04872b832ab456b5543d0c259c812525391f158c:669a5f8e4f373c2f907700decde47511aac6470f5698e2b856fb07f09160e5f2",
"result": {
"dataset_id": 10736,
"snapshot_id": 1724919539450264600,
"recalculation_id": "abf9a2ec-426b-4751-bd16-fcb435061925",
"row_stats": null
},
"dequeued_at": "2023-10-31T11:19:13.400498Z",
"created_at": "2023-10-31T11:19:13.400498Z",
"updated_at": "2023-10-31T11:25:08.327209Z",
"attempted_at": "2023-10-31T11:19:13.400498Z",
"attempt_version": 1,
"ended_at": "2023-10-31T11:25:08.327194Z",
"workflow_id": null,
"workflow_run_id": null
}
]
}{
"error": "Unauthorized",
"error_description": "You are not authorized to use this endpoint."
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Filter jobs by data plane ID.
Filter jobs where the input has a dataset_id (such as materalized-view)
Number of records to skip (page_number * per_page).
Order the results by a specific field. By default, job are order by created_at in descending order.
created_at_asc, created_at_desc, updated_at_asc, updated_at_desc Number of records to return. Defaults to 500, which is also the maximum; larger values are rejected with a 400.
x <= 500Filter jobs by state. Repeat the parameter to match any of several states.
cancelled, completed, failed, pending, pending_cancellation, running, scheduled Filter jobs by tag. Repeat the parameter to filter by multiple tags (e.g. ?tag=workflow_enqueued&tag=workflow_id=<uuid>);
a job matches if it carries any of the supplied tags.
1 - 255Filter jobs by type. Repeat the parameter to match any of several types. Job types are free strings on the
server; see JobResponse for the ones this spec describes.
1 - 255Filter jobs by the id of the workflow that enqueued them. Only jobs enqueued by a workflow carry a workflow id.
Filter jobs by the id of the workflow run that enqueued them. Only jobs enqueued by a workflow run carry a workflow run id.
Response
OK
A paginated list of jobs.
A job. Every job carries the same envelope of fields — see JobBase — but input and result hold
job-type-specific payloads, so the response is a union over type: pick the branch whose type matches
and you get the typed input and result for that kind of job.
The union is open on purpose. Job types are free strings on the server, so a type this spec version does
not describe lands in OtherJobResponse, where both fields stay free-form. No branch closes itself to
extra properties, and new job types can appear without a spec change.
input and result are returned exactly as they were stored when the job was enqueued or completed. The
server never reshapes them, so a field a job type gained after a row was written is absent from that row
rather than null. The typed branches describe what the current code writes; fields that have not always
been written are left out of each branch's required list.
result is null in every branch until the job reaches a terminal state.
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
- Option 11
- Option 12
- Option 13
- Option 14
- Option 15
- Option 16
- Option 17
- Option 18
- Option 19
Show child attributes
Show child attributes
{
"job_id": "2a5b9ad7-dc8f-47bb-8e62-843a38f8054c",
"company_id": 1,
"data_plane_id": "f79cbdae-4848-47ca-95e8-69588364d185",
"compute_pool_id": null,
"request_source": {
"type": "api_user",
"company_id": 1,
"user_id": 407
},
"state": "completed",
"type": "materialize-view",
"operator_type": "materialized-view-refresh",
"tags": [],
"input": {
"nql": "CREATE MATERIALIZED VIEW \"test_stats\" AS SELECT \"value\" FROM \"company_data\".\"10674\"",
"compiled_select": "SELECT\n `ds_10674`.`value`\nFROM\n narrative.datasets.ds_10674 `ds_10674`",
"create_as_view": null,
"dataset_id": 10736,
"billing_enabled": null,
"stats_enabled": true,
"contains_delta_syntax": null,
"first_run": false,
"merge": true,
"partitions": null,
"snowflake_create_table": null,
"snowflake_insert_statement": null,
"chunk_metadata": null,
"nio_last_modified_at": null,
"delta_dataset_bounds": null,
"write_mode": "append"
},
"executor": "job-executor-98e1f48e-bf54-4f11-bbd1-73c445120266",
"execution_cluster": "shared",
"idempotency_key": "10736:29329c64e7b8a4eda86aaabe04872b832ab456b5543d0c259c812525391f158c:669a5f8e4f373c2f907700decde47511aac6470f5698e2b856fb07f09160e5f2",
"result": {
"dataset_id": 10736,
"snapshot_id": 1724919539450264600,
"recalculation_id": "abf9a2ec-426b-4751-bd16-fcb435061925",
"row_stats": null
},
"dequeued_at": "2023-10-31T11:19:13.400498Z",
"created_at": "2023-10-31T11:19:13.400498Z",
"updated_at": "2023-10-31T11:25:08.327209Z",
"attempted_at": "2023-10-31T11:19:13.400498Z",
"attempt_version": 1,
"ended_at": "2023-10-31T11:25:08.327194Z",
"workflow_id": null,
"workflow_run_id": null
}
The number of requested page.
1
Total amount of accessible Access Rules
15000
Total amount of pages.
10
The number of the previous page, or null on the first page. Can also refer to the latest existing page if a page beyond the last one was requested.
1
The number of the next page, or null on the last page.
42
Was this page helpful?

