Get subscriptions
curl --request GET \
--url https://api-dev.narrative.io/data-shops/subscriptions \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-dev.narrative.io/data-shops/subscriptions"
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/data-shops/subscriptions', 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/data-shops/subscriptions",
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/data-shops/subscriptions"
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/data-shops/subscriptions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/data-shops/subscriptions")
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{
"records": [
[
{
"id": "f82ac0d3-9391-45f5-b524-4905c383fec7",
"cancelled_at": "2022-08-10T12:00:00Z",
"company_id": 123,
"created_at": "2021-12-10T00:12:23Z",
"budget": {
"amount": {
"value": 100.23,
"currency": "USD"
},
"period": {
"type": "calendar_monthly"
}
},
"details": {
"type": "marketplace",
"company_constraint": {
"type": "inclusion",
"company_ids": [
1,
2,
3
]
},
"data_rules": {
"attributes": [
{
"attribute_id": 321,
"fields": [
{
"field": "foo",
"filter": {
"recency": "P30D",
"from": {
"type": "inclusive",
"value": "2021-12-10 12:00:00"
}
},
"exported": false
},
{
"field": "bar",
"exported": true
}
],
"optional": true
},
{
"attribute_id": 123,
"fields": [
{
"field": "baz",
"exported": false
},
{
"field": "qux",
"exported": true
}
],
"optional": false
}
],
"deduplication": {
"period": "P180D",
"attribute_references": [
{
"attribute_id": 321,
"column_names": [
"baz"
]
}
]
},
"frequency_filter": {
"attribute_references": [
{
"attribute_id": 321,
"column_names": [
"baz"
]
}
],
"min_inclusive": 2,
"max_inclusive": 5
}
},
"pricing": {
"micro_cents_usd": 123321
}
},
"description": "subscriptiondescription",
"name": "subscription name",
"output": {
"dataset_id": 42
},
"cadence": "daily",
"status": "cancelled",
"updated_at": "2021-12-20T00:00:00Z"
},
{
"id": "9b3fd441-9add-41d8-b58a-a6ce6b0c9972",
"company_id": 123,
"created_at": "2021-12-10T00:12:23Z",
"budget": {
"amount": {
"value": 100.23,
"currency": "USD"
},
"period": {
"type": "calendar_monthly"
}
},
"details": {
"type": "data_stream",
"data_rules": {
"column_sets": [
{
"dataset_id": 123,
"fields": [
{
"field": "col1",
"exported": true
},
{
"field": "col2",
"filter": "include_all_values_including_nulls_filter",
"exported": true
},
{
"field": "col3",
"filter": "include_only_if_not_null_filter",
"exported": true
},
{
"field": "col4",
"filter": {
"type": "include",
"list": [
"this",
"that",
"that too",
"some more"
]
},
"exported": true
},
{
"field": "col5",
"filter": {
"type": "exclude",
"list": [
"this",
"that",
"that too",
"some more"
]
},
"exported": true
},
{
"field": "col6",
"filter": {
"min": {
"type": "inclusive",
"value": "-100"
},
"max": {
"type": "inclusive",
"value": "100"
}
},
"exported": true
},
{
"field": "col6",
"filter": {
"max": {
"type": "exclusive",
"value": "timestamp01"
}
},
"exported": false
},
{
"field": "col7",
"filter": {
"recency": "P30D",
"from": {
"type": "inclusive",
"value": "2021-12-10 12:00:00"
}
},
"exported": false
},
{
"field": "col8",
"filter": {
"expressions": [
"col8 > 10"
]
},
"exported": true
}
]
}
],
"deduplication": {
"period": "P90D",
"column_references": [
{
"dataset_id": 123,
"column_names": [
"col2",
"col4"
]
}
]
},
"frequency_filter": {
"column_references": [
{
"dataset_id": 123,
"column_names": [
"col2"
]
}
],
"min_inclusive": 2,
"max_inclusive": 5
}
},
"data_stream_company_id": 3742,
"data_stream_content": {
"description": "description is required"
},
"data_stream_id": "d00b2d0d-6d42-4e56-9116-c7dd8ccf638f",
"data_stream_name": "the data stream name",
"data_stream_slug": "a_data_product",
"offer": {
"id": "3f7c2ef3-17cc-4d37-ba1c-74bb2a287e13",
"channel": "data_streams_market",
"licensing": {
"period": "P90D",
"license": {
"name": "narrative opendata license"
}
},
"pricing": {
"type": "per_record",
"micro_cents_usd": 70000
}
}
},
"description": "subscription description",
"name": "subscription name",
"cadence": "weekly",
"status": "active",
"updated_at": "2021-12-20T00:00:00Z"
}
]
]
}Subscriptions
Get subscriptions
Return all subscriptions belonging to the authenticated company.
GET
/
data-shops
/
subscriptions
Get subscriptions
curl --request GET \
--url https://api-dev.narrative.io/data-shops/subscriptions \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-dev.narrative.io/data-shops/subscriptions"
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/data-shops/subscriptions', 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/data-shops/subscriptions",
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/data-shops/subscriptions"
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/data-shops/subscriptions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/data-shops/subscriptions")
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{
"records": [
[
{
"id": "f82ac0d3-9391-45f5-b524-4905c383fec7",
"cancelled_at": "2022-08-10T12:00:00Z",
"company_id": 123,
"created_at": "2021-12-10T00:12:23Z",
"budget": {
"amount": {
"value": 100.23,
"currency": "USD"
},
"period": {
"type": "calendar_monthly"
}
},
"details": {
"type": "marketplace",
"company_constraint": {
"type": "inclusion",
"company_ids": [
1,
2,
3
]
},
"data_rules": {
"attributes": [
{
"attribute_id": 321,
"fields": [
{
"field": "foo",
"filter": {
"recency": "P30D",
"from": {
"type": "inclusive",
"value": "2021-12-10 12:00:00"
}
},
"exported": false
},
{
"field": "bar",
"exported": true
}
],
"optional": true
},
{
"attribute_id": 123,
"fields": [
{
"field": "baz",
"exported": false
},
{
"field": "qux",
"exported": true
}
],
"optional": false
}
],
"deduplication": {
"period": "P180D",
"attribute_references": [
{
"attribute_id": 321,
"column_names": [
"baz"
]
}
]
},
"frequency_filter": {
"attribute_references": [
{
"attribute_id": 321,
"column_names": [
"baz"
]
}
],
"min_inclusive": 2,
"max_inclusive": 5
}
},
"pricing": {
"micro_cents_usd": 123321
}
},
"description": "subscriptiondescription",
"name": "subscription name",
"output": {
"dataset_id": 42
},
"cadence": "daily",
"status": "cancelled",
"updated_at": "2021-12-20T00:00:00Z"
},
{
"id": "9b3fd441-9add-41d8-b58a-a6ce6b0c9972",
"company_id": 123,
"created_at": "2021-12-10T00:12:23Z",
"budget": {
"amount": {
"value": 100.23,
"currency": "USD"
},
"period": {
"type": "calendar_monthly"
}
},
"details": {
"type": "data_stream",
"data_rules": {
"column_sets": [
{
"dataset_id": 123,
"fields": [
{
"field": "col1",
"exported": true
},
{
"field": "col2",
"filter": "include_all_values_including_nulls_filter",
"exported": true
},
{
"field": "col3",
"filter": "include_only_if_not_null_filter",
"exported": true
},
{
"field": "col4",
"filter": {
"type": "include",
"list": [
"this",
"that",
"that too",
"some more"
]
},
"exported": true
},
{
"field": "col5",
"filter": {
"type": "exclude",
"list": [
"this",
"that",
"that too",
"some more"
]
},
"exported": true
},
{
"field": "col6",
"filter": {
"min": {
"type": "inclusive",
"value": "-100"
},
"max": {
"type": "inclusive",
"value": "100"
}
},
"exported": true
},
{
"field": "col6",
"filter": {
"max": {
"type": "exclusive",
"value": "timestamp01"
}
},
"exported": false
},
{
"field": "col7",
"filter": {
"recency": "P30D",
"from": {
"type": "inclusive",
"value": "2021-12-10 12:00:00"
}
},
"exported": false
},
{
"field": "col8",
"filter": {
"expressions": [
"col8 > 10"
]
},
"exported": true
}
]
}
],
"deduplication": {
"period": "P90D",
"column_references": [
{
"dataset_id": 123,
"column_names": [
"col2",
"col4"
]
}
]
},
"frequency_filter": {
"column_references": [
{
"dataset_id": 123,
"column_names": [
"col2"
]
}
],
"min_inclusive": 2,
"max_inclusive": 5
}
},
"data_stream_company_id": 3742,
"data_stream_content": {
"description": "description is required"
},
"data_stream_id": "d00b2d0d-6d42-4e56-9116-c7dd8ccf638f",
"data_stream_name": "the data stream name",
"data_stream_slug": "a_data_product",
"offer": {
"id": "3f7c2ef3-17cc-4d37-ba1c-74bb2a287e13",
"channel": "data_streams_market",
"licensing": {
"period": "P90D",
"license": {
"name": "narrative opendata license"
}
},
"pricing": {
"type": "per_record",
"micro_cents_usd": 70000
}
}
},
"description": "subscription description",
"name": "subscription name",
"cadence": "weekly",
"status": "active",
"updated_at": "2021-12-20T00:00:00Z"
}
]
]
}Was this page helpful?
⌘I

