Upsert catalog object
POST
/v2/catalog/object
Creates or updates the target CatalogObject.
Name | Description |
---|---|
idempotency_
Required
|
A value you specify that uniquely identifies this request among all your requests. A common way to create a valid idempotency key is to use a Universally unique identifier (UUID). If you're unsure whether a particular request was successful, you can reattempt it with the same idempotency key without worrying about creating duplicate objects. See Idempotency for more information. |
object
Required
|
A CatalogObject to be created or updated.
|
Response Fields
Name | Description |
---|---|
errors
|
Any errors that occurred during the request. |
catalog_
|
The successfully created or updated CatalogObject. |
id_
|
The mapping between client and server IDs for this upsert. |
Examples
Example:
POST
/v2/catalog/object
cURL
- cURL
- Ruby
- Python
- C#
- Java
- PHP
- Node.js
curl https://connect.squareup.com/v2/catalog/object \
-X POST \
-H 'Square-Version: 2020-12-16' \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"idempotency_key": "af3d1afc-7212-4300-b463-0bfc5314a5ae",
"object": {
"type": "ITEM",
"id": "#Cocoa",
"item_data": {
"name": "Cocoa",
"description": "Hot chocolate",
"abbreviation": "Ch"
}
}
}'
Response JSON
{
"catalog_object": {
"type": "ITEM",
"id": "7SB3ZQYJ5GDMVFL7JK46JCHT",
"updated_at": "2016-11-16T22:32:42.996Z",
"version": 1479335562996,
"is_deleted": false,
"item_data": {
"name": "Cocoa",
"description": "Hot chocolate",
"abbreviation": "Ch"
}
},
"id_mappings": [
{
"client_object_id": "#Cocoa",
"object_id": "7SB3ZQYJ5GDMVFL7JK46JCHT"
}
]
}