Skip to content
ShopentlyLearn

Updating store data

Use the API to change data in your store, such as a product’s description or price.

Change selected fields

You do not need to send all product data to change its description. In the PATCH request, include the fields you are changing and any other fields the operation requires. The rest of the product data stays unchanged.

Omitted field
Its value stays unchanged.
null
Sending null clears the value if the field allows it. Check the operation’s description.
Empty string
Sending "" means an empty string. It differs from null, and not every field accepts it.

This example removes the product description in German. The product name and descriptions in other languages stay unchanged.

PATCH/api/v1/products/example?locale=de

cURL request

curl --disable --globoff --fail-with-body --silent --show-error \
  --proto '=https' --connect-timeout 5 --max-time 30 \
  --request PATCH \
  --url 'https://shop.onshopently.com/api/v1/products/example?locale=de' \
  --header 'Authorization: Bearer EXAMPLE_ACCESS_TOKEN' \
  --header 'Idempotency-Key: example-product-clear-translation' \
  --header 'Content-Type: application/json' \
  --data-raw '{"description":null,"expected_version":1}'

Response

{
  "data": {
    "deleted": false,
    "id": "example",
    "version": 2
  },
  "meta": {
    "request_id": "example"
  }
}

If you receive no response

No response does not necessarily mean the change was not saved. The connection may have been interrupted after the change was made.

When saving data, add an Idempotency-Key header with a unique value. If you don’t receive a response and retry the same change, use the same key, URL, method and request body.

If the API already has a saved result for that request, it returns it without making the change again. Use a new key for a different change.

Reusing a key for a different request yields idempotency.key_reused.

If someone changes the same data

Fetch the current data before making a change. If the operation requires expected_version, enter the version you received in that field.

If someone changed the data in the meantime, the API rejects the update. Fetch it again and check whether your planned change is still appropriate. Only then send a new request with the current version.

Changing a price may also require the version of the price, variant or price list. Check the operation’s description for the fields you need.