curl --request POST \
--url https://api-dev.narrative.io/mappings/{mapping_id}/accept \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-dev.narrative.io/mappings/{mapping_id}/accept"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api-dev.narrative.io/mappings/{mapping_id}/accept', 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}/accept",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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/{mapping_id}/accept"
req, _ := http.NewRequest("POST", 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.post("https://api-dev.narrative.io/mappings/{mapping_id}/accept")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/mappings/{mapping_id}/accept")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
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"
}Accept a mapping
Accept a proposed mapping, i.e. move it from a status of pending or rejected to active.
Fails with a conflict if an active global mapping already exists for the same attribute and
dataset.
Both owners (users belonging to the company the mapping belongs to) and admins can accept a mapping.
curl --request POST \
--url https://api-dev.narrative.io/mappings/{mapping_id}/accept \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-dev.narrative.io/mappings/{mapping_id}/accept"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api-dev.narrative.io/mappings/{mapping_id}/accept', 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}/accept",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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/{mapping_id}/accept"
req, _ := http.NewRequest("POST", 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.post("https://api-dev.narrative.io/mappings/{mapping_id}/accept")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/mappings/{mapping_id}/accept")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
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.
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?

