Get matches
curl --request POST \
--url https://api-dev.narrative.io/data-shops/subscriptions/matches \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"details": {
"type": "marketplace",
"company_constraint": {
"type": "inclusion",
"company_ids": [
1,
2,
3
]
},
"data_rules": {
"attributes": [
{
"attribute_id": 123,
"fields": [
{
"field": "example.timestamp",
"filter": {
"recency": "P30D",
"from": {
"type": "inclusive",
"value": "2021-12-10 12:00:00"
},
"to": null
},
"exported": false
},
{
"field": "example.string_field",
"filter": null,
"exported": true
}
],
"optional": true
}
]
},
"pricing": {
"micro_cents_usd": 1000000000
}
}
}
'import requests
url = "https://api-dev.narrative.io/data-shops/subscriptions/matches"
payload = { "details": {
"type": "marketplace",
"company_constraint": {
"type": "inclusion",
"company_ids": [1, 2, 3]
},
"data_rules": { "attributes": [
{
"attribute_id": 123,
"fields": [
{
"field": "example.timestamp",
"filter": {
"recency": "P30D",
"from": {
"type": "inclusive",
"value": "2021-12-10 12:00:00"
},
"to": None
},
"exported": False
},
{
"field": "example.string_field",
"filter": None,
"exported": True
}
],
"optional": True
}
] },
"pricing": { "micro_cents_usd": 1000000000 }
} }
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({
details: {
type: 'marketplace',
company_constraint: {type: 'inclusion', company_ids: [1, 2, 3]},
data_rules: {
attributes: [
{
attribute_id: 123,
fields: [
{
field: 'example.timestamp',
filter: {
recency: 'P30D',
from: {type: 'inclusive', value: '2021-12-10 12:00:00'},
to: null
},
exported: false
},
{field: 'example.string_field', filter: null, exported: true}
],
optional: true
}
]
},
pricing: {micro_cents_usd: 1000000000}
}
})
};
fetch('https://api-dev.narrative.io/data-shops/subscriptions/matches', 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/matches",
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([
'details' => [
'type' => 'marketplace',
'company_constraint' => [
'type' => 'inclusion',
'company_ids' => [
1,
2,
3
]
],
'data_rules' => [
'attributes' => [
[
'attribute_id' => 123,
'fields' => [
[
'field' => 'example.timestamp',
'filter' => [
'recency' => 'P30D',
'from' => [
'type' => 'inclusive',
'value' => '2021-12-10 12:00:00'
],
'to' => null
],
'exported' => false
],
[
'field' => 'example.string_field',
'filter' => null,
'exported' => true
]
],
'optional' => true
]
]
],
'pricing' => [
'micro_cents_usd' => 1000000000
]
]
]),
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-dev.narrative.io/data-shops/subscriptions/matches"
payload := strings.NewReader("{\n \"details\": {\n \"type\": \"marketplace\",\n \"company_constraint\": {\n \"type\": \"inclusion\",\n \"company_ids\": [\n 1,\n 2,\n 3\n ]\n },\n \"data_rules\": {\n \"attributes\": [\n {\n \"attribute_id\": 123,\n \"fields\": [\n {\n \"field\": \"example.timestamp\",\n \"filter\": {\n \"recency\": \"P30D\",\n \"from\": {\n \"type\": \"inclusive\",\n \"value\": \"2021-12-10 12:00:00\"\n },\n \"to\": null\n },\n \"exported\": false\n },\n {\n \"field\": \"example.string_field\",\n \"filter\": null,\n \"exported\": true\n }\n ],\n \"optional\": true\n }\n ]\n },\n \"pricing\": {\n \"micro_cents_usd\": 1000000000\n }\n }\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-dev.narrative.io/data-shops/subscriptions/matches")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"details\": {\n \"type\": \"marketplace\",\n \"company_constraint\": {\n \"type\": \"inclusion\",\n \"company_ids\": [\n 1,\n 2,\n 3\n ]\n },\n \"data_rules\": {\n \"attributes\": [\n {\n \"attribute_id\": 123,\n \"fields\": [\n {\n \"field\": \"example.timestamp\",\n \"filter\": {\n \"recency\": \"P30D\",\n \"from\": {\n \"type\": \"inclusive\",\n \"value\": \"2021-12-10 12:00:00\"\n },\n \"to\": null\n },\n \"exported\": false\n },\n {\n \"field\": \"example.string_field\",\n \"filter\": null,\n \"exported\": true\n }\n ],\n \"optional\": true\n }\n ]\n },\n \"pricing\": {\n \"micro_cents_usd\": 1000000000\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/data-shops/subscriptions/matches")
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 \"details\": {\n \"type\": \"marketplace\",\n \"company_constraint\": {\n \"type\": \"inclusion\",\n \"company_ids\": [\n 1,\n 2,\n 3\n ]\n },\n \"data_rules\": {\n \"attributes\": [\n {\n \"attribute_id\": 123,\n \"fields\": [\n {\n \"field\": \"example.timestamp\",\n \"filter\": {\n \"recency\": \"P30D\",\n \"from\": {\n \"type\": \"inclusive\",\n \"value\": \"2021-12-10 12:00:00\"\n },\n \"to\": null\n },\n \"exported\": false\n },\n {\n \"field\": \"example.string_field\",\n \"filter\": null,\n \"exported\": true\n }\n ],\n \"optional\": true\n }\n ]\n },\n \"pricing\": {\n \"micro_cents_usd\": 1000000000\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"records": [
{
"type": "attributes",
"attributes": [
{
"id": 123,
"name": "<string>"
}
],
"dataset": {
"id": 123,
"company_id": 123,
"name": "<string>",
"description": "<string>"
},
"matching_access_rules": [
{
"id": 123,
"constraints": [
"<string>"
],
"pricing": 123
}
],
"non_matching_access_rules": [
{
"id": 123,
"constraints": [
"<string>"
],
"pricing": 123
}
]
}
]
}Subscriptions
Get matches
Retrieve datasets matching a set of subscription constraints.
POST
/
data-shops
/
subscriptions
/
matches
Get matches
curl --request POST \
--url https://api-dev.narrative.io/data-shops/subscriptions/matches \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"details": {
"type": "marketplace",
"company_constraint": {
"type": "inclusion",
"company_ids": [
1,
2,
3
]
},
"data_rules": {
"attributes": [
{
"attribute_id": 123,
"fields": [
{
"field": "example.timestamp",
"filter": {
"recency": "P30D",
"from": {
"type": "inclusive",
"value": "2021-12-10 12:00:00"
},
"to": null
},
"exported": false
},
{
"field": "example.string_field",
"filter": null,
"exported": true
}
],
"optional": true
}
]
},
"pricing": {
"micro_cents_usd": 1000000000
}
}
}
'import requests
url = "https://api-dev.narrative.io/data-shops/subscriptions/matches"
payload = { "details": {
"type": "marketplace",
"company_constraint": {
"type": "inclusion",
"company_ids": [1, 2, 3]
},
"data_rules": { "attributes": [
{
"attribute_id": 123,
"fields": [
{
"field": "example.timestamp",
"filter": {
"recency": "P30D",
"from": {
"type": "inclusive",
"value": "2021-12-10 12:00:00"
},
"to": None
},
"exported": False
},
{
"field": "example.string_field",
"filter": None,
"exported": True
}
],
"optional": True
}
] },
"pricing": { "micro_cents_usd": 1000000000 }
} }
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({
details: {
type: 'marketplace',
company_constraint: {type: 'inclusion', company_ids: [1, 2, 3]},
data_rules: {
attributes: [
{
attribute_id: 123,
fields: [
{
field: 'example.timestamp',
filter: {
recency: 'P30D',
from: {type: 'inclusive', value: '2021-12-10 12:00:00'},
to: null
},
exported: false
},
{field: 'example.string_field', filter: null, exported: true}
],
optional: true
}
]
},
pricing: {micro_cents_usd: 1000000000}
}
})
};
fetch('https://api-dev.narrative.io/data-shops/subscriptions/matches', 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/matches",
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([
'details' => [
'type' => 'marketplace',
'company_constraint' => [
'type' => 'inclusion',
'company_ids' => [
1,
2,
3
]
],
'data_rules' => [
'attributes' => [
[
'attribute_id' => 123,
'fields' => [
[
'field' => 'example.timestamp',
'filter' => [
'recency' => 'P30D',
'from' => [
'type' => 'inclusive',
'value' => '2021-12-10 12:00:00'
],
'to' => null
],
'exported' => false
],
[
'field' => 'example.string_field',
'filter' => null,
'exported' => true
]
],
'optional' => true
]
]
],
'pricing' => [
'micro_cents_usd' => 1000000000
]
]
]),
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-dev.narrative.io/data-shops/subscriptions/matches"
payload := strings.NewReader("{\n \"details\": {\n \"type\": \"marketplace\",\n \"company_constraint\": {\n \"type\": \"inclusion\",\n \"company_ids\": [\n 1,\n 2,\n 3\n ]\n },\n \"data_rules\": {\n \"attributes\": [\n {\n \"attribute_id\": 123,\n \"fields\": [\n {\n \"field\": \"example.timestamp\",\n \"filter\": {\n \"recency\": \"P30D\",\n \"from\": {\n \"type\": \"inclusive\",\n \"value\": \"2021-12-10 12:00:00\"\n },\n \"to\": null\n },\n \"exported\": false\n },\n {\n \"field\": \"example.string_field\",\n \"filter\": null,\n \"exported\": true\n }\n ],\n \"optional\": true\n }\n ]\n },\n \"pricing\": {\n \"micro_cents_usd\": 1000000000\n }\n }\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-dev.narrative.io/data-shops/subscriptions/matches")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"details\": {\n \"type\": \"marketplace\",\n \"company_constraint\": {\n \"type\": \"inclusion\",\n \"company_ids\": [\n 1,\n 2,\n 3\n ]\n },\n \"data_rules\": {\n \"attributes\": [\n {\n \"attribute_id\": 123,\n \"fields\": [\n {\n \"field\": \"example.timestamp\",\n \"filter\": {\n \"recency\": \"P30D\",\n \"from\": {\n \"type\": \"inclusive\",\n \"value\": \"2021-12-10 12:00:00\"\n },\n \"to\": null\n },\n \"exported\": false\n },\n {\n \"field\": \"example.string_field\",\n \"filter\": null,\n \"exported\": true\n }\n ],\n \"optional\": true\n }\n ]\n },\n \"pricing\": {\n \"micro_cents_usd\": 1000000000\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/data-shops/subscriptions/matches")
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 \"details\": {\n \"type\": \"marketplace\",\n \"company_constraint\": {\n \"type\": \"inclusion\",\n \"company_ids\": [\n 1,\n 2,\n 3\n ]\n },\n \"data_rules\": {\n \"attributes\": [\n {\n \"attribute_id\": 123,\n \"fields\": [\n {\n \"field\": \"example.timestamp\",\n \"filter\": {\n \"recency\": \"P30D\",\n \"from\": {\n \"type\": \"inclusive\",\n \"value\": \"2021-12-10 12:00:00\"\n },\n \"to\": null\n },\n \"exported\": false\n },\n {\n \"field\": \"example.string_field\",\n \"filter\": null,\n \"exported\": true\n }\n ],\n \"optional\": true\n }\n ]\n },\n \"pricing\": {\n \"micro_cents_usd\": 1000000000\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"records": [
{
"type": "attributes",
"attributes": [
{
"id": 123,
"name": "<string>"
}
],
"dataset": {
"id": 123,
"company_id": 123,
"name": "<string>",
"description": "<string>"
},
"matching_access_rules": [
{
"id": 123,
"constraints": [
"<string>"
],
"pricing": 123
}
],
"non_matching_access_rules": [
{
"id": 123,
"constraints": [
"<string>"
],
"pricing": 123
}
]
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
A set of subscription constraints for which matches will be generated.
- Option 1
- Option 2
Show child attributes
Show child attributes
Response
200 - application/json
OK
- Option 1
- Option 2
Show child attributes
Show child attributes
Was this page helpful?
⌘I

