Bulk Upsert Documents
curl --request PUT \
--url https://{instance}.domo.com/api/datastores/v2/collections/{collectionId}/documents/bulk \
--header 'Content-Type: application/json' \
--header 'X-DOMO-Developer-Token: <api-key>' \
--data '
[
{
"id": "a8428d64-a01d-49b2-9144-ddeec001acf8",
"content": {
"campaignName": "Q2 Campaign",
"region": "West",
"status": "Inactive"
}
},
{
"content": {
"campaignName": "New Campaign",
"region": "North",
"status": "Active"
}
}
]
'import requests
url = "https://{instance}.domo.com/api/datastores/v2/collections/{collectionId}/documents/bulk"
payload = [{
"id": "a8428d64-a01d-49b2-9144-ddeec001acf8",
"content": {
"campaignName": "Q2 Campaign",
"region": "West",
"status": "Inactive"
}
}, { "content": {
"campaignName": "New Campaign",
"region": "North",
"status": "Active"
} }]
headers = {
"X-DOMO-Developer-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-DOMO-Developer-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{
id: 'a8428d64-a01d-49b2-9144-ddeec001acf8',
content: {campaignName: 'Q2 Campaign', region: 'West', status: 'Inactive'}
},
{content: {campaignName: 'New Campaign', region: 'North', status: 'Active'}}
])
};
fetch('https://{instance}.domo.com/api/datastores/v2/collections/{collectionId}/documents/bulk', 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://{instance}.domo.com/api/datastores/v2/collections/{collectionId}/documents/bulk",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
[
'id' => 'a8428d64-a01d-49b2-9144-ddeec001acf8',
'content' => [
'campaignName' => 'Q2 Campaign',
'region' => 'West',
'status' => 'Inactive'
]
],
[
'content' => [
'campaignName' => 'New Campaign',
'region' => 'North',
'status' => 'Active'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-DOMO-Developer-Token: <api-key>"
],
]);
$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://{instance}.domo.com/api/datastores/v2/collections/{collectionId}/documents/bulk"
payload := strings.NewReader("[\n {\n \"id\": \"a8428d64-a01d-49b2-9144-ddeec001acf8\",\n \"content\": {\n \"campaignName\": \"Q2 Campaign\",\n \"region\": \"West\",\n \"status\": \"Inactive\"\n }\n },\n {\n \"content\": {\n \"campaignName\": \"New Campaign\",\n \"region\": \"North\",\n \"status\": \"Active\"\n }\n }\n]")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-DOMO-Developer-Token", "<api-key>")
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.put("https://{instance}.domo.com/api/datastores/v2/collections/{collectionId}/documents/bulk")
.header("X-DOMO-Developer-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("[\n {\n \"id\": \"a8428d64-a01d-49b2-9144-ddeec001acf8\",\n \"content\": {\n \"campaignName\": \"Q2 Campaign\",\n \"region\": \"West\",\n \"status\": \"Inactive\"\n }\n },\n {\n \"content\": {\n \"campaignName\": \"New Campaign\",\n \"region\": \"North\",\n \"status\": \"Active\"\n }\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://{instance}.domo.com/api/datastores/v2/collections/{collectionId}/documents/bulk")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-DOMO-Developer-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"id\": \"a8428d64-a01d-49b2-9144-ddeec001acf8\",\n \"content\": {\n \"campaignName\": \"Q2 Campaign\",\n \"region\": \"West\",\n \"status\": \"Inactive\"\n }\n },\n {\n \"content\": {\n \"campaignName\": \"New Campaign\",\n \"region\": \"North\",\n \"status\": \"Active\"\n }\n }\n]"
response = http.request(request)
puts response.read_body{
"Updated": 1,
"Created": 1
}{
"message": "Cannot find permission from source [USER:870010733] to target [MAGNUM_COLLECTION:a3f7d891-bc24-4e56-9a12-c7e3b0f845d2]. Permission Service reports that one or both does not exist",
"status": 404,
"statusReason": "Not Found",
"toe": "RG3808D5LS-DHKE4-TG5EB"
}Bulk Upsert Documents
Insert or update multiple documents in a single request. Documents with a matching id are updated; documents without a matching id are created. Each document is limited to 2 MB.
PUT
/
api
/
datastores
/
v2
/
collections
/
{collectionId}
/
documents
/
bulk
Bulk Upsert Documents
curl --request PUT \
--url https://{instance}.domo.com/api/datastores/v2/collections/{collectionId}/documents/bulk \
--header 'Content-Type: application/json' \
--header 'X-DOMO-Developer-Token: <api-key>' \
--data '
[
{
"id": "a8428d64-a01d-49b2-9144-ddeec001acf8",
"content": {
"campaignName": "Q2 Campaign",
"region": "West",
"status": "Inactive"
}
},
{
"content": {
"campaignName": "New Campaign",
"region": "North",
"status": "Active"
}
}
]
'import requests
url = "https://{instance}.domo.com/api/datastores/v2/collections/{collectionId}/documents/bulk"
payload = [{
"id": "a8428d64-a01d-49b2-9144-ddeec001acf8",
"content": {
"campaignName": "Q2 Campaign",
"region": "West",
"status": "Inactive"
}
}, { "content": {
"campaignName": "New Campaign",
"region": "North",
"status": "Active"
} }]
headers = {
"X-DOMO-Developer-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-DOMO-Developer-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{
id: 'a8428d64-a01d-49b2-9144-ddeec001acf8',
content: {campaignName: 'Q2 Campaign', region: 'West', status: 'Inactive'}
},
{content: {campaignName: 'New Campaign', region: 'North', status: 'Active'}}
])
};
fetch('https://{instance}.domo.com/api/datastores/v2/collections/{collectionId}/documents/bulk', 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://{instance}.domo.com/api/datastores/v2/collections/{collectionId}/documents/bulk",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
[
'id' => 'a8428d64-a01d-49b2-9144-ddeec001acf8',
'content' => [
'campaignName' => 'Q2 Campaign',
'region' => 'West',
'status' => 'Inactive'
]
],
[
'content' => [
'campaignName' => 'New Campaign',
'region' => 'North',
'status' => 'Active'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-DOMO-Developer-Token: <api-key>"
],
]);
$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://{instance}.domo.com/api/datastores/v2/collections/{collectionId}/documents/bulk"
payload := strings.NewReader("[\n {\n \"id\": \"a8428d64-a01d-49b2-9144-ddeec001acf8\",\n \"content\": {\n \"campaignName\": \"Q2 Campaign\",\n \"region\": \"West\",\n \"status\": \"Inactive\"\n }\n },\n {\n \"content\": {\n \"campaignName\": \"New Campaign\",\n \"region\": \"North\",\n \"status\": \"Active\"\n }\n }\n]")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-DOMO-Developer-Token", "<api-key>")
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.put("https://{instance}.domo.com/api/datastores/v2/collections/{collectionId}/documents/bulk")
.header("X-DOMO-Developer-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("[\n {\n \"id\": \"a8428d64-a01d-49b2-9144-ddeec001acf8\",\n \"content\": {\n \"campaignName\": \"Q2 Campaign\",\n \"region\": \"West\",\n \"status\": \"Inactive\"\n }\n },\n {\n \"content\": {\n \"campaignName\": \"New Campaign\",\n \"region\": \"North\",\n \"status\": \"Active\"\n }\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://{instance}.domo.com/api/datastores/v2/collections/{collectionId}/documents/bulk")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-DOMO-Developer-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"id\": \"a8428d64-a01d-49b2-9144-ddeec001acf8\",\n \"content\": {\n \"campaignName\": \"Q2 Campaign\",\n \"region\": \"West\",\n \"status\": \"Inactive\"\n }\n },\n {\n \"content\": {\n \"campaignName\": \"New Campaign\",\n \"region\": \"North\",\n \"status\": \"Active\"\n }\n }\n]"
response = http.request(request)
puts response.read_body{
"Updated": 1,
"Created": 1
}{
"message": "Cannot find permission from source [USER:870010733] to target [MAGNUM_COLLECTION:a3f7d891-bc24-4e56-9a12-c7e3b0f845d2]. Permission Service reports that one or both does not exist",
"status": 404,
"statusReason": "Not Found",
"toe": "RG3808D5LS-DHKE4-TG5EB"
}Authorizations
Domo Developer Token for authentication.
Path Parameters
The ID of the collection.
Body
application/json