Get mappings for a company
curl --request GET \
--url https://api-dev.narrative.io/mappings/companies/{company_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-dev.narrative.io/mappings/companies/{company_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/mappings/companies/{company_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/mappings/companies/{company_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/mappings/companies/{company_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/mappings/companies/{company_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/mappings/companies/{company_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_body{
"records": [
{
"id": "ea9dddd2-e3ee-40b5-b03e-c3cd37c8a7f0",
"attribute_id": 1,
"created_at": "2021-12-10T00:00:00Z",
"dataset_id": 3,
"mapping": {
"type": "object_mapping",
"property_mappings": [
{
"path": "foo",
"expression": "upper(`US Kennel ID`)",
"dependencies": {
"properties": [
"US Kennel ID"
]
}
},
{
"path": "bar.baz.qux",
"expression": "weight * 10000",
"dependencies": {
"properties": [
"weight"
]
}
}
]
},
"status": "active",
"updated_at": "2021-12-10T00:00:01Z",
"created_by": 1,
"updated_by": 1,
"company_id": 100,
"scope": "global",
"source": "admin",
"derived_from": "ea9dddd2-e3ee-40b5-b03e-c3cd37c8a6f0"
},
{
"id": "ea9dddd2-e3ee-40b5-b03e-c3cd37c8a6f0",
"attribute_id": 1,
"created_at": "2021-12-10T00:00:00Z",
"dataset_id": 3,
"mapping": {
"type": "value_mapping",
"expression": "foo bar baz",
"dependencies": {
"properties": []
}
},
"status": "archived",
"updated_at": "2021-12-10T00:00:01Z",
"created_by": 1,
"updated_by": 2,
"company_id": 100,
"scope": "global",
"source": "admin",
"derived_from": null
}
]
}Mappings
Get mappings for a company
Return the mappings owned by a specific company based on its id. Optionally filter by attribute and/or dataset.
GET
/
mappings
/
companies
/
{company_id}
Get mappings for a company
curl --request GET \
--url https://api-dev.narrative.io/mappings/companies/{company_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-dev.narrative.io/mappings/companies/{company_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/mappings/companies/{company_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/mappings/companies/{company_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/mappings/companies/{company_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/mappings/companies/{company_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/mappings/companies/{company_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_body{
"records": [
{
"id": "ea9dddd2-e3ee-40b5-b03e-c3cd37c8a7f0",
"attribute_id": 1,
"created_at": "2021-12-10T00:00:00Z",
"dataset_id": 3,
"mapping": {
"type": "object_mapping",
"property_mappings": [
{
"path": "foo",
"expression": "upper(`US Kennel ID`)",
"dependencies": {
"properties": [
"US Kennel ID"
]
}
},
{
"path": "bar.baz.qux",
"expression": "weight * 10000",
"dependencies": {
"properties": [
"weight"
]
}
}
]
},
"status": "active",
"updated_at": "2021-12-10T00:00:01Z",
"created_by": 1,
"updated_by": 1,
"company_id": 100,
"scope": "global",
"source": "admin",
"derived_from": "ea9dddd2-e3ee-40b5-b03e-c3cd37c8a6f0"
},
{
"id": "ea9dddd2-e3ee-40b5-b03e-c3cd37c8a6f0",
"attribute_id": 1,
"created_at": "2021-12-10T00:00:00Z",
"dataset_id": 3,
"mapping": {
"type": "value_mapping",
"expression": "foo bar baz",
"dependencies": {
"properties": []
}
},
"status": "archived",
"updated_at": "2021-12-10T00:00:01Z",
"created_by": 1,
"updated_by": 2,
"company_id": 100,
"scope": "global",
"source": "admin",
"derived_from": null
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Unique identifier for a company
Query Parameters
Attribute identifier. Can be specified multiple times to retrieve mappings for multiple attributes.
Dataset identifier. Can be specified multiple times to retrieve mappings for multiple datasets.
Response
200 - application/json
Ok
Show child attributes
Show child attributes
Was this page helpful?
⌘I

