Update Catalog Items via the GonnaOrder API

GonnaOrder supports several API calls for updating catalog items. This allows you to update catalog items individually or in bulk using the API. You can do partial or full updates on the catalog items, where:

  • A partial update API changes only the catalog item fields they support and leave other fields unchanged.
  • The full update is different: its body represents the complete item, so fields that are omitted can be emptied or reset.

Use the right update type for the fields you need to change. This guide explains the five available ways to update an item and what happens to fields that you leave out.

Here is a quick summary of fields used and the API update type

  • If you wish to change stock or availability, use a partial update.
  • To change price, use the update by external ID.
  • If you wish to change characteristics, nutrition or translations, use the content update.
  • Use the full update only when you are sending the complete item.

On this Page


Choose the Right Update API

Use the following table to decide which API to call.

If you need to change Use Update type
Stock or availability for one item Quick status update Partial
Stock or availability for several items Bulk status update Partial
Stock, availability or price when you know your own product code Update by external ID Partial
Price, discount, VAT, schedule or position Update by external ID Partial
Characteristics or nutrition Content update Partial
Translations, image or characteristics Content update Partial
Everything on an item, or fields not covered by a partial update Full update Complete item

Do not use the full update to change only stock or price. If you send an older copy of an item through the full update, values in that copy can overwrite changes made since you fetched it. For example, do not fetch an item in the morning and repeatedly send the same copy back throughout the day. Only send an update when a value changes on your side.

Note When Updating Variants and Options

Variants and options are items too. Therefore, they use the same update APIs with their own item IDs.


Authentication and Base URLs

All admin endpoints require authentication. See API Authentication and Getting Access for information about authentication.

Environment Base URL
Production https://admin.gonnaorder.com
Staging https://admin.wannaorder.net

The examples in this guide use:

  • storeId = 12345
  • catalogId = 678
  • offerId = 5001
  • contentItemId = 7001
  • externalId = POS-12345

Replace these values with the identifiers for your store and item.


Quick Status Update API

Use the quick status update when you need to change stock or availability for one item and you know its item ID. You can always find the item ID on the Item link as shown below.

Find the Item ID
Find the Item ID

Endpoint

PATCH: /api/v1/stores/{storeId}/catalog/{catalogId}/offer/{offerId}/lite

Request Parameters

Parameter Type / Location Required Description
storeId long, path Yes The store identifier.
catalogId long, path Yes The catalog identifier.
offerId long, path Yes The item identifier (ID).

Request Body

All body fields are optional. However, if a field is not included in the body, it keeps its current value.

Field Description
isOrderable Whether the item can be ordered.
sellable Whether the item is sellable.
stockLevel Stock level. Must be between 0 and 100000.
isStockCheckEnabled Whether stock checking is enabled.
itemType Orderable, Reservable or Inactive.

When itemType is included, it also determines whether the item can be ordered. Inactive means that the item cannot be ordered. Therefore, when itemType is included, the isOrderable value in the same request is ignored.

Note

Besides the listed fields, the quick status change API cannot change any other item fields.

Example Request

PATCH: /api/v1/stores/12345/catalog/678/offer/5001/lite

Body

{
  "stockLevel": 25,
  "isStockCheckEnabled": true
}

Response

The API returns HTTP 200 OK with the updated item.

Who Can Call This API?

  • Store administrators
  • Store managers
  • Store operators

Bulk Status Update API

Unlike the quick status update API, the bulk status update API allows you to apply the same stock or availability values but to multiple items in one request.

Endpoint

PATCH: /api/v1/stores/{storeId}/catalog/{catalogId}/offer/changeStatus

Request Parameters

Parameter Type / Location Required Description
storeId long, path Yes The store identifier.
catalogId long, path Yes The catalog identifier.

Request Body

The body accepts the same status fields as the quick status update, plus offerIds. Here is a table showing all the fields accepted in the bulk status update API.

Field Description
offerIds List of item IDs to update.
isOrderable Whether the items can be ordered.
sellable Whether the items are sellable.
stockLevel Stock level. Must be between 0 and 100000.
isStockCheckEnabled Whether stock checking is enabled.
itemType Orderable, Reservable or Inactive.

Every listed item receives the same values. Therefore, you should confirm that the offerIds provided are correct to avoid updating the incorrect items. Also, note the a field that is not included in the body keeps its current value on each item.

Example Request

Here is an example of the bulk status update API call

PATCH: /api/v1/stores/12345/catalog/678/offer/changeStatus

Body

{
  "offerIds": [5001, 5002, 5003],
  "stockLevel": 25,
  "isStockCheckEnabled": true
}

Response

The API returns a HTTP 200 OK with the updated items.

Who Can Call This API?

  • Store administrators
  • Store managers
  • Store operators

Update Items by External ID API

You can use the update by external ID when your integration identifies products by its own product code. This API updates every item with the specified external product ID in the store and its child stores. One request can therefore update the same product in several stores.

Endpoint

PATCH: /api/v1/stores/{storeId}/externalId/{externalId}

Request Parameters


Parameter Type / Location Required Description
storeId long, path Yes The store identifier.
externalId string, path Yes The product code used by your integration.

Request Body

The following fields are applied when they are included:

Field Description
price Item price.
discount Discount value.
discountType Discount type.
scheduleId Schedule assigned to the item.
isSellable Whether the item is sellable.
isOrderable Whether the item can be ordered.
hierarchyLevel Item hierarchy level.
stockLevel Stock level.
isStockCheckEnabled Whether stock checking is enabled.
vatPercentage VAT percentage.
position Item position.

A field that is not included keeps its current value. This also means that a value cannot be emptied through this API. Also, the request can contain the following fields, but this API ignores them:

  • name
  • shortDescription
  • longDescription
  • priceDescription
  • categoryId
  • parentOfferId
  • vatExternalId
  • externalProductId
  • visible

Including one of these fields does not cause an error, but it does not change the item.

Example Request

PATCH: /api/v1/stores/12345/externalId/POS-12345

Body

{
  "price": 12.50,
  "discount": 10,
  "discountType": "PERCENTAGE",
  "stockLevel": 25,
  "isSellable": true,
  "isStockCheckEnabled": true,
  "vatPercentage": 13
}

Response

The API returns HTTP 200 OK with an empty body. However, A 200 response does not prove that an item was updated. The same response is returned when no item matches the external ID.

Who Can Call This API?

  • Store administrators
  • Store managers

Full Update API

You can use the full update only when you are sending the complete item. Therefore, it should only be used to update everything on an item, or fields not covered by a partial update.

Endpoint

POST: /api/v1/stores/{storeId}/catalog/{catalogId}/offer/{offerId}

The same operation is also available under /api/v2:

POST: /api/v2/stores/{storeId}/catalog/{catalogId}/offer/{offerId}

The v1 and v2 full updates have the same behavior described in this section.

How the Full Update Works

The full update treats the request body as the complete item. Therefore, it is not a merge. Here is the the safest pattern to follow when using the full update API:

  1. Fetch the current item.
  2. Change the values you need to change.
  3. Send the complete, current item back.

Do not send an old copy of an item that you fetched earlier. Values in that old copy can overwrite changes made by the merchant or another integration since it was fetched.

What Happens When a Field Is Left Out?

Some fields are emptied or reset when they are omitted while others are kept. Here’s a table showing how various fields are affected when they are omitted.

Field When omitted
price Becomes empty.
sellable Becomes false.
scheduleId Schedule is removed.
discountScheduleId Schedule is removed.
loyaltyPointCollectType Reset/removed.
loyaltyPointCollectValue Reset/removed.
externalProductId Emptied.
vatExternalId Emptied.
vatPercentage Emptied.
itemType Reset/removed.
shortDescription Removed in the catalog’s default language.
longDescription Removed in the catalog’s default language.
priceDescription Removed in the catalog’s default language.

The following fields are kept when omitted:

Field When omitted
name Current value is kept.
isOrderable Current value is kept.
stockLevel Current value is kept.
isStockCheckEnabled Current value is kept.
position Current value is kept.
Image Current image is kept.
Translations in other languages Current translations are kept.

Category and Discount Fields

categoryId, discount and discountType are applied only when hierarchyLevel is sent and is not CHILD. When hierarchyLevel is sent and is not CHILD, omitting discountType empties the discount type. However, the hierarchy level of an existing item does not change.

Characteristics and Nutrition

Characteristics and nutrition are handled differently from most full-update fields. The attributeDtos list changes only the entries that you send. For example, if an item has several characteristics and you send one characteristic with false, only that characteristic is switched off. However, characteristics that are not included in the list keep their current values.

Leaving attributeDtos out, or sending an empty attributeDtos list, does not change any characteristics.

For nutrition, the supported entries include:

  • CALORIES
  • PROTEIN
  • NET_CARBS
  • TOTAL_FATS

Sending an empty value for a nutrition entry removes that nutrition value. On the other hand, an unknown characteristic or nutrition key (besides the above four) is rejected.

sellable and isSellable are Different Fields

Be careful when copying an item returned by the API into a full update. The item you fetch contains:

{
  "isSellable": true
}

However, the full update reads:

{
  "sellable": true
}

If you copy the fetched item back unchanged without changing the property name, sellable is missing from the full-update request. The full update then sets sellable to false.

The update by external ID uses isSellable, while the quick status update and full update use sellable. Therefore, you must use the correct property name for each API.

Example Request

The following example uses the full-update field name sellable, not isSellable.

API Call

POST: /api/v1/stores/12345/catalog/678/offer/5001

Body

{
  "name": "Margherita Pizza",
  "price": 12.50,
  "sellable": true,
  "isOrderable": true,
  "stockLevel": 25,
  "isStockCheckEnabled": true,
  "position": 1,
  "hierarchyLevel": "PARENT",
  "categoryId": 1001,
  "discount": 10,
  "discountType": "PERCENTAGE",
  "attributeDtos": [
    {
      "key": "EGG",
      "value": false
    }
  ]
}

Response

The API returns HTTP 201 Created with the updated item.

Note

The update by external ID uses isSellable, while the quick status update and full update use sellable. Therefore, you must use the correct property name for each API.

Who Can Call This API?

  • Store administrators
  • Store managers

Content Update API

The content update API allows you to change an item’s translations, image or characteristics without changing its price, stock or availability.

Endpoint

POST: /api/v1/stores/{storeId}/content-item/{contentItemId}

Request Parameters

Parameter Type / Location Required Description
storeId long, path Yes The store identifier.
contentItemId long, path Yes The content item identifier.

Request Body

The content update can change the following fields:

Field Description
Translations Item name, descriptions and price description by language.
Image Item image.
attributeDtos Characteristics and nutrition values.

Characteristics use the same per-entry behavior as the full update: only the entries included in attributeDtos are changed. Characteristics that are not included keep their current values.

This API does not change:

  • Price
  • Stock
  • Availability

Example Request

POST: /api/v1/stores/12345/content-item/7001

Body

{
  "translations": [
    {
      "language": "en",
      "name": "Moussaka",
      "shortDescription": "Traditional Greek moussaka"
    }
  ],
  "attributeDtos": [
    {
      "key": "EGG",
      "value": true
    },
    {
      "key": "MILK",
      "value": true
    }
  ]
}

Response

The content item is updated according to the fields supplied in the request.

Who Can Call This API?

  • Store administrators

Common Error Responses

Here are some of the most common errors that can occur when updating catalog items via the API.

HTTP status Cause / Situation
400 Bad Request A request contains an invalid value, such as a stock level above 100000, a negative VAT percentage, or an unknown characteristic key.
404 Not Found A single-item update addresses an item that does not belong to the store in the request path.

Check the response body for the specific validation error returned by the API.


Recommended Usage

Use the narrowest update API that covers the change you need.

Change Recommended API
Stock for one item Quick status update
Availability for one item Quick status update
Stock or availability for several items Bulk status update
Stock or availability by your own product code Update by external ID
Price by your own product code Update by external ID
Characteristics Content update
Nutrition Content update
Translations Content update
Image Content update
Several fields supported by the external ID update Update by external ID
Everything on an item Full update

Avoid Stale Full Updates

A full update can overwrite data that has changed since you last fetched the item. For example, suppose you fetch an item that has an allergy characteristic set to true. Later, a merchant changes that characteristic. If your integration sends the old item back through the full-update endpoint, the old characteristic value can be written again.

Note

The full update is not a merge. Treat it as a replacement of the item and do not use an old copy of an item as the source for repeated updates.

For this reason:

  • Do not repeatedly fetch and push the same item.
  • Do not use the full update just to change stock or price.
  • Send an update when a value changes on your side.
  • When using the full update, always send the complete and current item.

Child Stores

In a multi-store setup, use the update by external ID API as it applies to matching items in child stores. However, the other update APIs address an item in the specific store identified by the request path.

Items in the Catalog Hierarchy

Variants and option items are items and can be updated using the same APIs. Use the appropriate ID for the item you want to change.