Get mapping preview
curl --request GET \
--url https://api-dev.narrative.io/mappings/{mapping_id}/sample \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-dev.narrative.io/mappings/{mapping_id}/sample"
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/{mapping_id}/sample', 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}/sample",
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/{mapping_id}/sample"
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/{mapping_id}/sample")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/mappings/{mapping_id}/sample")
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": [
{
"input": {
"idType": "idType1",
"idValue": "idValue1"
},
"output": {
"unique_id_f7635d42_51ce_4535_ae8b_9ac64df85501": {
"type": "idType1",
"value": "idValue1"
}
}
},
{
"input": {
"idType": "idType2",
"idValue": "idValue2"
},
"output": {
"unique_id_f7635d42_51ce_4535_ae8b_9ac64df85501": {
"type": "idType2",
"value": "idValue2"
}
}
}
]
}Mappings
Get mapping preview
Returns sampled dataset after attribute mapping for a given mapping_id
This endpoint should be used when mapping exist.
A response is a list of JSON objects, where every object will have an input field, that represents the original key/value pairs from the dataset, and the output filed that will contain mapped fields where the key will be attribute name, and value will be JSON object of key/value pairs.
GET
/
mappings
/
{mapping_id}
/
sample
Get mapping preview
curl --request GET \
--url https://api-dev.narrative.io/mappings/{mapping_id}/sample \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-dev.narrative.io/mappings/{mapping_id}/sample"
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/{mapping_id}/sample', 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}/sample",
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/{mapping_id}/sample"
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/{mapping_id}/sample")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/mappings/{mapping_id}/sample")
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": [
{
"input": {
"idType": "idType1",
"idValue": "idValue1"
},
"output": {
"unique_id_f7635d42_51ce_4535_ae8b_9ac64df85501": {
"type": "idType1",
"value": "idValue1"
}
}
},
{
"input": {
"idType": "idType2",
"idValue": "idValue2"
},
"output": {
"unique_id_f7635d42_51ce_4535_ae8b_9ac64df85501": {
"type": "idType2",
"value": "idValue2"
}
}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Unique identifier for a mapping.
Query Parameters
The number of rows to sample from the dataset. Defaults to 100 when omitted.
Required range:
x <= 1000Response
200 - application/json
OK
Was this page helpful?

