Merge entities into a target
curl --request POST \
--url https://api.mentionlab.io/api/entities/merge \
--header 'Content-Type: application/json' \
--header 'x-project-id: <x-project-id>' \
--data '
{
"targetId": "3f29c1a4-1b2c-4e7d-9a8b-0c1d2e3f4a5b",
"sourceIds": [
"a1b2c3d4-e5f6-4789-90ab-cdef12345678",
"b2c3d4e5-f6a7-4890-81bc-def234567890"
]
}
'import requests
url = "https://api.mentionlab.io/api/entities/merge"
payload = {
"targetId": "3f29c1a4-1b2c-4e7d-9a8b-0c1d2e3f4a5b",
"sourceIds": ["a1b2c3d4-e5f6-4789-90ab-cdef12345678", "b2c3d4e5-f6a7-4890-81bc-def234567890"]
}
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({
targetId: '3f29c1a4-1b2c-4e7d-9a8b-0c1d2e3f4a5b',
sourceIds: ['a1b2c3d4-e5f6-4789-90ab-cdef12345678', 'b2c3d4e5-f6a7-4890-81bc-def234567890']
})
};
fetch('https://api.mentionlab.io/api/entities/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/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([
'targetId' => '3f29c1a4-1b2c-4e7d-9a8b-0c1d2e3f4a5b',
'sourceIds' => [
'a1b2c3d4-e5f6-4789-90ab-cdef12345678',
'b2c3d4e5-f6a7-4890-81bc-def234567890'
]
]),
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/merge"
payload := strings.NewReader("{\n \"targetId\": \"3f29c1a4-1b2c-4e7d-9a8b-0c1d2e3f4a5b\",\n \"sourceIds\": [\n \"a1b2c3d4-e5f6-4789-90ab-cdef12345678\",\n \"b2c3d4e5-f6a7-4890-81bc-def234567890\"\n ]\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/merge")
.header("x-project-id", "<x-project-id>")
.header("Content-Type", "application/json")
.body("{\n \"targetId\": \"3f29c1a4-1b2c-4e7d-9a8b-0c1d2e3f4a5b\",\n \"sourceIds\": [\n \"a1b2c3d4-e5f6-4789-90ab-cdef12345678\",\n \"b2c3d4e5-f6a7-4890-81bc-def234567890\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mentionlab.io/api/entities/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 \"targetId\": \"3f29c1a4-1b2c-4e7d-9a8b-0c1d2e3f4a5b\",\n \"sourceIds\": [\n \"a1b2c3d4-e5f6-4789-90ab-cdef12345678\",\n \"b2c3d4e5-f6a7-4890-81bc-def234567890\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"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 into a target
Merges the source entities into the target so they report under it in analytics; the merge can be reversed via the unmerge endpoint, though conflicting alias variants dropped during the merge are not restored.
POST
/
api
/
entities
/
merge
Merge entities into a target
curl --request POST \
--url https://api.mentionlab.io/api/entities/merge \
--header 'Content-Type: application/json' \
--header 'x-project-id: <x-project-id>' \
--data '
{
"targetId": "3f29c1a4-1b2c-4e7d-9a8b-0c1d2e3f4a5b",
"sourceIds": [
"a1b2c3d4-e5f6-4789-90ab-cdef12345678",
"b2c3d4e5-f6a7-4890-81bc-def234567890"
]
}
'import requests
url = "https://api.mentionlab.io/api/entities/merge"
payload = {
"targetId": "3f29c1a4-1b2c-4e7d-9a8b-0c1d2e3f4a5b",
"sourceIds": ["a1b2c3d4-e5f6-4789-90ab-cdef12345678", "b2c3d4e5-f6a7-4890-81bc-def234567890"]
}
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({
targetId: '3f29c1a4-1b2c-4e7d-9a8b-0c1d2e3f4a5b',
sourceIds: ['a1b2c3d4-e5f6-4789-90ab-cdef12345678', 'b2c3d4e5-f6a7-4890-81bc-def234567890']
})
};
fetch('https://api.mentionlab.io/api/entities/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/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([
'targetId' => '3f29c1a4-1b2c-4e7d-9a8b-0c1d2e3f4a5b',
'sourceIds' => [
'a1b2c3d4-e5f6-4789-90ab-cdef12345678',
'b2c3d4e5-f6a7-4890-81bc-def234567890'
]
]),
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/merge"
payload := strings.NewReader("{\n \"targetId\": \"3f29c1a4-1b2c-4e7d-9a8b-0c1d2e3f4a5b\",\n \"sourceIds\": [\n \"a1b2c3d4-e5f6-4789-90ab-cdef12345678\",\n \"b2c3d4e5-f6a7-4890-81bc-def234567890\"\n ]\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/merge")
.header("x-project-id", "<x-project-id>")
.header("Content-Type", "application/json")
.body("{\n \"targetId\": \"3f29c1a4-1b2c-4e7d-9a8b-0c1d2e3f4a5b\",\n \"sourceIds\": [\n \"a1b2c3d4-e5f6-4789-90ab-cdef12345678\",\n \"b2c3d4e5-f6a7-4890-81bc-def234567890\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mentionlab.io/api/entities/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 \"targetId\": \"3f29c1a4-1b2c-4e7d-9a8b-0c1d2e3f4a5b\",\n \"sourceIds\": [\n \"a1b2c3d4-e5f6-4789-90ab-cdef12345678\",\n \"b2c3d4e5-f6a7-4890-81bc-def234567890\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}Headers
Project ID to specify the project context
Body
application/json
The entity ID to merge into (target).
Example:
"3f29c1a4-1b2c-4e7d-9a8b-0c1d2e3f4a5b"
Entity IDs to merge into the target (sources). The target id is ignored if present, and duplicates are collapsed.
Example:
[
"a1b2c3d4-e5f6-4789-90ab-cdef12345678",
"b2c3d4e5-f6a7-4890-81bc-def234567890"
]