Merge entities in bulk from a spreadsheet
curl --request POST \
--url https://api.mentionlab.io/api/entities/import/merge \
--header 'Content-Type: application/json' \
--header 'x-project-id: <x-project-id>' \
--data '
{
"edges": [
{
"id": "019daf29-0000-7000-8000-0000000000b1",
"mergedIntoId": "019daf29-0000-7000-8000-0000000000a1"
}
],
"dryRun": true
}
'import requests
url = "https://api.mentionlab.io/api/entities/import/merge"
payload = {
"edges": [
{
"id": "019daf29-0000-7000-8000-0000000000b1",
"mergedIntoId": "019daf29-0000-7000-8000-0000000000a1"
}
],
"dryRun": True
}
headers = {
"x-project-id": "<x-project-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-project-id': '<x-project-id>', 'Content-Type': 'application/json'},
body: JSON.stringify({
edges: [
{
id: '019daf29-0000-7000-8000-0000000000b1',
mergedIntoId: '019daf29-0000-7000-8000-0000000000a1'
}
],
dryRun: true
})
};
fetch('https://api.mentionlab.io/api/entities/import/merge', 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.mentionlab.io/api/entities/import/merge",
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([
'edges' => [
[
'id' => '019daf29-0000-7000-8000-0000000000b1',
'mergedIntoId' => '019daf29-0000-7000-8000-0000000000a1'
]
],
'dryRun' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-project-id: <x-project-id>"
],
]);
$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.mentionlab.io/api/entities/import/merge"
payload := strings.NewReader("{\n \"edges\": [\n {\n \"id\": \"019daf29-0000-7000-8000-0000000000b1\",\n \"mergedIntoId\": \"019daf29-0000-7000-8000-0000000000a1\"\n }\n ],\n \"dryRun\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-project-id", "<x-project-id>")
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.mentionlab.io/api/entities/import/merge")
.header("x-project-id", "<x-project-id>")
.header("Content-Type", "application/json")
.body("{\n \"edges\": [\n {\n \"id\": \"019daf29-0000-7000-8000-0000000000b1\",\n \"mergedIntoId\": \"019daf29-0000-7000-8000-0000000000a1\"\n }\n ],\n \"dryRun\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mentionlab.io/api/entities/import/merge")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-project-id"] = '<x-project-id>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"edges\": [\n {\n \"id\": \"019daf29-0000-7000-8000-0000000000b1\",\n \"mergedIntoId\": \"019daf29-0000-7000-8000-0000000000a1\"\n }\n ],\n \"dryRun\": true\n}"
response = http.request(request)
puts response.read_body{
"dryRun": false,
"merged": 42,
"unchanged": 3,
"failed": 1,
"survivors": 7,
"results": [
{
"index": 0,
"action": "merged",
"resolvedParentId": "019daf29-0000-7000-8000-0000000000a1",
"error": "self-reference",
"detail": "b1 → a1 closes a loop"
}
]
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}Entities
Merge entities in bulk from a spreadsheet
Applies the mergedIntoId column of an entity import, merging each entity into the one its id names. Send the whole file in one request: chains and cycles are resolved across the entire edge set, so a partial batch resolves differently. Bad edges fail their own row and leave the rest to apply.
POST
/
api
/
entities
/
import
/
merge
Merge entities in bulk from a spreadsheet
curl --request POST \
--url https://api.mentionlab.io/api/entities/import/merge \
--header 'Content-Type: application/json' \
--header 'x-project-id: <x-project-id>' \
--data '
{
"edges": [
{
"id": "019daf29-0000-7000-8000-0000000000b1",
"mergedIntoId": "019daf29-0000-7000-8000-0000000000a1"
}
],
"dryRun": true
}
'import requests
url = "https://api.mentionlab.io/api/entities/import/merge"
payload = {
"edges": [
{
"id": "019daf29-0000-7000-8000-0000000000b1",
"mergedIntoId": "019daf29-0000-7000-8000-0000000000a1"
}
],
"dryRun": True
}
headers = {
"x-project-id": "<x-project-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-project-id': '<x-project-id>', 'Content-Type': 'application/json'},
body: JSON.stringify({
edges: [
{
id: '019daf29-0000-7000-8000-0000000000b1',
mergedIntoId: '019daf29-0000-7000-8000-0000000000a1'
}
],
dryRun: true
})
};
fetch('https://api.mentionlab.io/api/entities/import/merge', 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.mentionlab.io/api/entities/import/merge",
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([
'edges' => [
[
'id' => '019daf29-0000-7000-8000-0000000000b1',
'mergedIntoId' => '019daf29-0000-7000-8000-0000000000a1'
]
],
'dryRun' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-project-id: <x-project-id>"
],
]);
$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.mentionlab.io/api/entities/import/merge"
payload := strings.NewReader("{\n \"edges\": [\n {\n \"id\": \"019daf29-0000-7000-8000-0000000000b1\",\n \"mergedIntoId\": \"019daf29-0000-7000-8000-0000000000a1\"\n }\n ],\n \"dryRun\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-project-id", "<x-project-id>")
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.mentionlab.io/api/entities/import/merge")
.header("x-project-id", "<x-project-id>")
.header("Content-Type", "application/json")
.body("{\n \"edges\": [\n {\n \"id\": \"019daf29-0000-7000-8000-0000000000b1\",\n \"mergedIntoId\": \"019daf29-0000-7000-8000-0000000000a1\"\n }\n ],\n \"dryRun\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mentionlab.io/api/entities/import/merge")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-project-id"] = '<x-project-id>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"edges\": [\n {\n \"id\": \"019daf29-0000-7000-8000-0000000000b1\",\n \"mergedIntoId\": \"019daf29-0000-7000-8000-0000000000a1\"\n }\n ],\n \"dryRun\": true\n}"
response = http.request(request)
puts response.read_body{
"dryRun": false,
"merged": 42,
"unchanged": 3,
"failed": 1,
"survivors": 7,
"results": [
{
"index": 0,
"action": "merged",
"resolvedParentId": "019daf29-0000-7000-8000-0000000000a1",
"error": "self-reference",
"detail": "b1 → a1 closes a loop"
}
]
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}Body
application/json