Navigation

Commit Generation (POST)

Ensure only objects from a specified generation remain in the index by committing a previously marked generation.

Note This endpoint requires HMAC authentication. Refer to the Authentication documentation for details.

Overview

When synchronizing your catalog through periodic batch jobs, identifying objects that were deleted since the last sync can be difficult. Content Generations provide a straightforward way to remove this stale data.

By assigning a generation marker to all objects in your current batch, you can update your active catalog and then commit the generation. This tells Luigi's Box to delete any objects of the specified type that do not match the current generation marker.

Synchronization Workflow

  1. Mark: Add a shared generation attribute (e.g., 1534199032554) to all objects in your Content Update payload.
  2. Upload: Send the payload via the Content Update API. Existing objects are updated and new ones are created.
  3. Commit: Call this endpoint with the same generation marker and object type. All un-marked objects of this type will be deleted.

Committing is type-specific. If you use nested items, you must commit their respective types separately (e.g., commit for product, category, and brand individually).

Warning

Use with caution: To prevent unintentional deletes, the commit API makes sure that at least one object from the committed generation is present in the index. This is done to prevent simple mistakes or typos in generation markers and to prevent you from accidentally deleting all objects of a single type.

POST https://live.luigisbox.com/v1/content/commit

Send a Commit Request

This endpoint expects query parameters to specify the target type and the generation string. No JSON body is required.

Query Parameters

Parameter Type Required Description
type String Object type to commit the generation for (e.g., "item", "category", "article").
generation String The generation marker that was used during the Content Update (e.g., "1534199032554").

Authentication is required for all requests. You will need your dynamically generated HMAC signature.

Danger Your Private Key is a secret and should never be exposed in client-side code (like frontend JavaScript). It should only be used on a secure server.

Tip Your API Keys can be found in the Luigi's Box application under "General settings" > "Integration settings".

Example: Request URL via cURL

host="https://live.luigisbox.com"
path="/v1/content/commit?type=item&generation=1534199032554"
public_key="your_public_api_key"
private_key="your_private_api_key"
method="POST"
content_type="application/json; charset=utf-8"
date=$(date -u "+%a, %d %b %Y %H:%M:%S GMT")

string_to_sign="$(printf "${method}\n${content_type}\n${date}\n${path}")" signature=$(echo -n "${string_to_sign}" | openssl dgst -sha256 -hmac "${private_key}" -binary | base64)

curl -X ${method} "${host}${path}" \ -H "Content-Type: ${content_type}" \ -H "Date: ${date}" \ -H "Authorization: ApiAuth ${public_key}:${signature}"

Error Handling

HTTP Status Description
400 Bad Request The request structure is invalid, or the generation does not have any objects present in the index. Check response body for details.
403 Forbidden The request is not allowed for your site in Luigi's Box.
429 Too Many Requests The rate limit has been exceeded.