Update Existing Items in a Catalog
curl --request PATCH \
--url https://api-{dc}.moengage.com/v1/catalog/{catalog_id}/items \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"id": "Existing_item_ID",
"attributes": {
"attribute_name": "updated_value"
}
},
{
"id": "test2",
"attributes": {
"price": 98
}
}
]
}
'import requests
url = "https://api-{dc}.moengage.com/v1/catalog/{catalog_id}/items"
payload = { "items": [
{
"id": "Existing_item_ID",
"attributes": { "attribute_name": "updated_value" }
},
{
"id": "test2",
"attributes": { "price": 98 }
}
] }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
items: [
{id: 'Existing_item_ID', attributes: {attribute_name: 'updated_value'}},
{id: 'test2', attributes: {price: 98}}
]
})
};
fetch('https://api-{dc}.moengage.com/v1/catalog/{catalog_id}/items', 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-{dc}.moengage.com/v1/catalog/{catalog_id}/items",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'items' => [
[
'id' => 'Existing_item_ID',
'attributes' => [
'attribute_name' => 'updated_value'
]
],
[
'id' => 'test2',
'attributes' => [
'price' => 98
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$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-{dc}.moengage.com/v1/catalog/{catalog_id}/items"
payload := strings.NewReader("{\n \"items\": [\n {\n \"id\": \"Existing_item_ID\",\n \"attributes\": {\n \"attribute_name\": \"updated_value\"\n }\n },\n {\n \"id\": \"test2\",\n \"attributes\": {\n \"price\": 98\n }\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.patch("https://api-{dc}.moengage.com/v1/catalog/{catalog_id}/items")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"items\": [\n {\n \"id\": \"Existing_item_ID\",\n \"attributes\": {\n \"attribute_name\": \"updated_value\"\n }\n },\n {\n \"id\": \"test2\",\n \"attributes\": {\n \"price\": 98\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-{dc}.moengage.com/v1/catalog/{catalog_id}/items")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"items\": [\n {\n \"id\": \"Existing_item_ID\",\n \"attributes\": {\n \"attribute_name\": \"updated_value\"\n }\n },\n {\n \"id\": \"test2\",\n \"attributes\": {\n \"price\": 98\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": {
"valid": {
"count": 1
},
"invalid": {
"count": 8,
"details": [
{
"error-id": "item-not-found",
"message": "Item with id %s not found in the catalog. Please check the item id and try again.",
"count": 1,
"document_ids": [
"567890"
]
},
{
"error-id": "invalid-attributes",
"message": "Some of the attributes are not defined in the catalog schema: (shipping_city)",
"count": 2,
"document_ids": [
"312",
"8291379"
]
}
]
}
}
}
Catalog
Update Existing Items in a Catalog
You can use this API to update items with new attribute values. Attributes must adhere to the data type defined and only 50 items are allowed to be updated in a single request.
PATCH
/
catalog
/
{catalog_id}
/
items
Update Existing Items in a Catalog
curl --request PATCH \
--url https://api-{dc}.moengage.com/v1/catalog/{catalog_id}/items \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"id": "Existing_item_ID",
"attributes": {
"attribute_name": "updated_value"
}
},
{
"id": "test2",
"attributes": {
"price": 98
}
}
]
}
'import requests
url = "https://api-{dc}.moengage.com/v1/catalog/{catalog_id}/items"
payload = { "items": [
{
"id": "Existing_item_ID",
"attributes": { "attribute_name": "updated_value" }
},
{
"id": "test2",
"attributes": { "price": 98 }
}
] }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
items: [
{id: 'Existing_item_ID', attributes: {attribute_name: 'updated_value'}},
{id: 'test2', attributes: {price: 98}}
]
})
};
fetch('https://api-{dc}.moengage.com/v1/catalog/{catalog_id}/items', 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-{dc}.moengage.com/v1/catalog/{catalog_id}/items",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'items' => [
[
'id' => 'Existing_item_ID',
'attributes' => [
'attribute_name' => 'updated_value'
]
],
[
'id' => 'test2',
'attributes' => [
'price' => 98
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$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-{dc}.moengage.com/v1/catalog/{catalog_id}/items"
payload := strings.NewReader("{\n \"items\": [\n {\n \"id\": \"Existing_item_ID\",\n \"attributes\": {\n \"attribute_name\": \"updated_value\"\n }\n },\n {\n \"id\": \"test2\",\n \"attributes\": {\n \"price\": 98\n }\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.patch("https://api-{dc}.moengage.com/v1/catalog/{catalog_id}/items")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"items\": [\n {\n \"id\": \"Existing_item_ID\",\n \"attributes\": {\n \"attribute_name\": \"updated_value\"\n }\n },\n {\n \"id\": \"test2\",\n \"attributes\": {\n \"price\": 98\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-{dc}.moengage.com/v1/catalog/{catalog_id}/items")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"items\": [\n {\n \"id\": \"Existing_item_ID\",\n \"attributes\": {\n \"attribute_name\": \"updated_value\"\n }\n },\n {\n \"id\": \"test2\",\n \"attributes\": {\n \"price\": 98\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": {
"valid": {
"count": 1
},
"invalid": {
"count": 8,
"details": [
{
"error-id": "item-not-found",
"message": "Item with id %s not found in the catalog. Please check the item id and try again.",
"count": 1,
"document_ids": [
"567890"
]
},
{
"error-id": "invalid-attributes",
"message": "Some of the attributes are not defined in the catalog schema: (shipping_city)",
"count": 2,
"document_ids": [
"312",
"8291379"
]
}
]
}
}
}
Rate Limit Information
Request limit: 100/min OR 1000/hr. You can update up to 50 items per request. Payload size limit: 5MB (only when Content-Length header is provided).Authorizations
Basic Authentication sends a Base64-encoded string containing your username and password.
You can obtain the username and password from the MoEngage Dashboard:
- Navigate to Settings > Account > APIs.
- Username: Copy the Workspace ID.
- Password: Copy the Catalog API key.
Path Parameters
The unique identifier for the catalog, obtained during catalog creation.
Body
application/json
An array of item updates. Each object must contain the item id and the attributes to update.
Maximum array length:
50Show child attributes
Show child attributes
Response
OK. The update request was processed. The response body contains details on valid and invalid item counts.
Show child attributes
Show child attributes
Was this page helpful?
⌘I