Import entities from a spreadsheet (create and update)
curl --request POST \
--url https://api.mentionlab.io/api/entities/import \
--header 'Content-Type: application/json' \
--header 'x-project-id: <x-project-id>' \
--data '
{
"rows": [
{
"name": "Samsung",
"isCompetitor": true,
"group": "Tech Companies"
}
],
"dryRun": false
}
'import requests
url = "https://api.mentionlab.io/api/entities/import"
payload = {
"rows": [
{
"name": "Samsung",
"isCompetitor": True,
"group": "Tech Companies"
}
],
"dryRun": False
}
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({
rows: [{name: 'Samsung', isCompetitor: true, group: 'Tech Companies'}],
dryRun: false
})
};
fetch('https://api.mentionlab.io/api/entities/import', 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",
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([
'rows' => [
[
'name' => 'Samsung',
'isCompetitor' => true,
'group' => 'Tech Companies'
]
],
'dryRun' => false
]),
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"
payload := strings.NewReader("{\n \"rows\": [\n {\n \"name\": \"Samsung\",\n \"isCompetitor\": true,\n \"group\": \"Tech Companies\"\n }\n ],\n \"dryRun\": false\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")
.header("x-project-id", "<x-project-id>")
.header("Content-Type", "application/json")
.body("{\n \"rows\": [\n {\n \"name\": \"Samsung\",\n \"isCompetitor\": true,\n \"group\": \"Tech Companies\"\n }\n ],\n \"dryRun\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mentionlab.io/api/entities/import")
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 \"rows\": [\n {\n \"name\": \"Samsung\",\n \"isCompetitor\": true,\n \"group\": \"Tech Companies\"\n }\n ],\n \"dryRun\": false\n}"
response = http.request(request)
puts response.read_body{
"dryRun": false,
"created": 3,
"updated": 118,
"unchanged": 12,
"failed": 1,
"results": [
{
"index": 0,
"action": "created",
"entityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"error": "no-identity",
"detail": "no group named \"Competitors UE\""
}
]
}{
"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
Import entities from a spreadsheet (create and update)
Creates or updates a batch of rows in one transaction, matching each by id or by name; omitted fields are left unchanged and aliases are only ever added. Use dryRun to preview the per-row outcome, and POST /entities/import/merge afterwards for the mergedIntoId column.
POST
/
api
/
entities
/
import
Import entities from a spreadsheet (create and update)
curl --request POST \
--url https://api.mentionlab.io/api/entities/import \
--header 'Content-Type: application/json' \
--header 'x-project-id: <x-project-id>' \
--data '
{
"rows": [
{
"name": "Samsung",
"isCompetitor": true,
"group": "Tech Companies"
}
],
"dryRun": false
}
'import requests
url = "https://api.mentionlab.io/api/entities/import"
payload = {
"rows": [
{
"name": "Samsung",
"isCompetitor": True,
"group": "Tech Companies"
}
],
"dryRun": False
}
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({
rows: [{name: 'Samsung', isCompetitor: true, group: 'Tech Companies'}],
dryRun: false
})
};
fetch('https://api.mentionlab.io/api/entities/import', 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",
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([
'rows' => [
[
'name' => 'Samsung',
'isCompetitor' => true,
'group' => 'Tech Companies'
]
],
'dryRun' => false
]),
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"
payload := strings.NewReader("{\n \"rows\": [\n {\n \"name\": \"Samsung\",\n \"isCompetitor\": true,\n \"group\": \"Tech Companies\"\n }\n ],\n \"dryRun\": false\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")
.header("x-project-id", "<x-project-id>")
.header("Content-Type", "application/json")
.body("{\n \"rows\": [\n {\n \"name\": \"Samsung\",\n \"isCompetitor\": true,\n \"group\": \"Tech Companies\"\n }\n ],\n \"dryRun\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mentionlab.io/api/entities/import")
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 \"rows\": [\n {\n \"name\": \"Samsung\",\n \"isCompetitor\": true,\n \"group\": \"Tech Companies\"\n }\n ],\n \"dryRun\": false\n}"
response = http.request(request)
puts response.read_body{
"dryRun": false,
"created": 3,
"updated": 118,
"unchanged": 12,
"failed": 1,
"results": [
{
"index": 0,
"action": "created",
"entityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"error": "no-identity",
"detail": "no group named \"Competitors UE\""
}
]
}{
"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