curl --request PUT \
--url https://api-dev.narrative.io/mappings/{mapping_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"mapping": {
"type": "object_mapping",
"property_mappings": [
{
"expression": "<string>",
"path": "<string>"
}
]
},
"tags": [
"nio:rosetta"
]
}
'import requests
url = "https://api-dev.narrative.io/mappings/{mapping_id}"
payload = {
"mapping": {
"type": "object_mapping",
"property_mappings": [
{
"expression": "<string>",
"path": "<string>"
}
]
},
"tags": ["nio:rosetta"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
mapping: {
type: 'object_mapping',
property_mappings: [{expression: '<string>', path: '<string>'}]
},
tags: ['nio:rosetta']
})
};
fetch('https://api-dev.narrative.io/mappings/{mapping_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/{mapping_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'mapping' => [
'type' => 'object_mapping',
'property_mappings' => [
[
'expression' => '<string>',
'path' => '<string>'
]
]
],
'tags' => [
'nio:rosetta'
]
]),
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/mappings/{mapping_id}"
payload := strings.NewReader("{\n \"mapping\": {\n \"type\": \"object_mapping\",\n \"property_mappings\": [\n {\n \"expression\": \"<string>\",\n \"path\": \"<string>\"\n }\n ]\n },\n \"tags\": [\n \"nio:rosetta\"\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api-dev.narrative.io/mappings/{mapping_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"mapping\": {\n \"type\": \"object_mapping\",\n \"property_mappings\": [\n {\n \"expression\": \"<string>\",\n \"path\": \"<string>\"\n }\n ]\n },\n \"tags\": [\n \"nio:rosetta\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/mappings/{mapping_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"mapping\": {\n \"type\": \"object_mapping\",\n \"property_mappings\": [\n {\n \"expression\": \"<string>\",\n \"path\": \"<string>\"\n }\n ]\n },\n \"tags\": [\n \"nio:rosetta\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"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"
}Update a mapping
Update the definition of a mapping between an attribute and a dataset.
Note: the attribute and dataset with which a mapping is associated cannot be updated.
curl --request PUT \
--url https://api-dev.narrative.io/mappings/{mapping_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"mapping": {
"type": "object_mapping",
"property_mappings": [
{
"expression": "<string>",
"path": "<string>"
}
]
},
"tags": [
"nio:rosetta"
]
}
'import requests
url = "https://api-dev.narrative.io/mappings/{mapping_id}"
payload = {
"mapping": {
"type": "object_mapping",
"property_mappings": [
{
"expression": "<string>",
"path": "<string>"
}
]
},
"tags": ["nio:rosetta"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
mapping: {
type: 'object_mapping',
property_mappings: [{expression: '<string>', path: '<string>'}]
},
tags: ['nio:rosetta']
})
};
fetch('https://api-dev.narrative.io/mappings/{mapping_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/{mapping_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'mapping' => [
'type' => 'object_mapping',
'property_mappings' => [
[
'expression' => '<string>',
'path' => '<string>'
]
]
],
'tags' => [
'nio:rosetta'
]
]),
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/mappings/{mapping_id}"
payload := strings.NewReader("{\n \"mapping\": {\n \"type\": \"object_mapping\",\n \"property_mappings\": [\n {\n \"expression\": \"<string>\",\n \"path\": \"<string>\"\n }\n ]\n },\n \"tags\": [\n \"nio:rosetta\"\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api-dev.narrative.io/mappings/{mapping_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"mapping\": {\n \"type\": \"object_mapping\",\n \"property_mappings\": [\n {\n \"expression\": \"<string>\",\n \"path\": \"<string>\"\n }\n ]\n },\n \"tags\": [\n \"nio:rosetta\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/mappings/{mapping_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"mapping\": {\n \"type\": \"object_mapping\",\n \"property_mappings\": [\n {\n \"expression\": \"<string>\",\n \"path\": \"<string>\"\n }\n ]\n },\n \"tags\": [\n \"nio:rosetta\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"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"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Unique identifier for a mapping.
Query Parameters
Skip validation of the mapping expressions against the query engine. Structural validation of the request still runs. The flag is enabled by being present; any value is ignored.
Body
Mapping definition for create/update requests. Dependencies are computed server-side and not provided by the client.
- Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes
Free-form labels on the mapping. Null and an empty array both mean no tags; nio:-prefixed tags
are reserved for Narrative.
["nio:rosetta"]
Response
OK
Unique identifier for a mapping.
"ea9dddd2-e3ee-40b5-b03e-c3cd37c8a6f0"
The target attribute's ID.
ISO-8601 timestamp indicating when the mapping was created.
"2021-08-26T21:06:07.710357Z"
The source dataset's ID.
- Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes
The status of the mapping.
active- Active mappings can be usedarchived- Archived/Deleted mappings - mapping no longer in usepending- Pending mappings need to be accepted before they can be usedrejected- Proposed mappings the owner turned down. Can still be accepted later
active, archived, pending, rejected ISO-8601 timestamp indicating when the mapping was last updated.
"2021-08-26T21:06:07.710357Z"
Unique id from a user who created it.
20
Unique id from a user who updated it.
20
The scope of the mapping.
global- Mappings available to allprivate- Company private mappings
global, private The source of the mapping.
company- Company private mappingadmin- Admin created/promoted mappingsystem- System (Automated/ML) mappingslineage- Lineage-derived mappings (editable without admin)rosetta_stone- Rosetta Stone mappings (editable without admin)derived- Mappings produced by a derivation rule
company, admin, system, lineage, rosetta_stone, derived The company that owns the mapping. Null for platform-wide mappings.
345
Free-form labels on the mapping. Null and an empty array both mean no tags; nio:-prefixed tags
are reserved for Narrative.
["nio:rosetta"]
The mapping this one was derived from. Null when the mapping was authored directly.
"ea9dddd2-e3ee-40b5-b03e-c3cd37c8a6f0"
Was this page helpful?

