Packs and a common storefront for products
Packs get their own API with images and a web view, products can be published to the web with prices with and without VAT, and invoices accept pack lines with the price charged.
Packs and the web storefront are now part of the public contract. They are available on every plan that includes products, from Esencial. Esencial keeps up to 5 packs per account that are not archived; the other plans have no cap.
- Packs have their own resource: composition, price, availability, images
(up to 5, with public and permanent URLs),
view=storefrontfor websites, conditional reads withETagand a price breakdown by price list, customer (client_id), date andchannel. - Products share the storefront contract:
channels.web,slug,summary,seo,sale_price{net, tax, gross},availabilityand imagealt,widthandheight. A bulk operation publishes or withdraws up to 50 products. - Document lines accept
{pack_id, quantity, sold_on, unit_price, prices_include_tax, print_mode}. A paid web sale is invoiced with the price charged, to the cent, even if the pack was archived later. - A pack prints the same way in every document: each product on its own line,
labelled with the pack, and the saving under the last one.
print_modeonly acceptsfull_breakdown. - Product lines with
unit_priceacceptprices_include_taxper line. - Webhooks add
pack.created,pack.updated,pack.archived,pack.restored,pack.deletedandproduct.deleted.
Read Packs and Your store with Factuarea.
Events
| Event | Change |
|---|---|
pack.created, pack.updated, pack.archived and pack.restored | New, with the pack in view=all |
pack.deleted | New, with {id, object: "pack", deleted: true} |
product.deleted | New, with {id, object: "product", deleted: true} |
product.updated | Also when a product is activated or deactivated, and when its gallery, content, slug, web channel, variants or availability status change |
New errors: pack_not_found, slug_already_exists, pack_in_use,
pack_composition_too_small, invalid_pack_component,
duplicate_pack_component, invalid_pack_pricing, pack_price_unreachable,
pack_price_allocation_impossible, invalid_pack_status_transition,
pack_not_sellable, pack_image_limit_reached, pack_snapshot_invalid,
pack_lines_must_be_expanded, pack_line_locked and
pack_print_mode_not_allowed.
Contract up to date
This publication also covers the final contract changes for packs, offers and price lists. The affected operations are in the list below.
- Packs.
sellable.codeis a stable, nullable code (archived,inactive,out_of_window,no_channel,component_unsellableorprice_unreachable), andnullwhen the pack can be sold. Changing or deleting the images of a pack that belongs to another company answers 404pack_not_found. - Price lists. Updating, deleting or touching the items of a price list from another company answers 404
price_list_not_found. Deleting an item that does not exist answers the new 404price_list_item_not_found, withparamitem_id. The domain errorsduplicate_price_list_name,invalid_price_list_item,inactive_price_listandprice_list_in_usecarry theircodeand theirparam. - Idempotency. The write operations of packs, offers and price lists (19 writes) answer 409
idempotency_key_in_usewhile another request with the sameIdempotency-Keyis still running. Retry after a few seconds with the same key and body. - Products. A
price[gte],price[lte]or similar filter with a non-numeric value answers 400parameter_invalid_format, withparam. - Plan cap. On the Esencial plan an account keeps up to 5 packs that are not archived, active or inactive, across its companies.
POST /v1/companies/{company}/packsandPOST /v1/companies/{company}/packs/{pack}/restoreanswer 402plan_limit_exceededwithdetails.resourcepacks,currentandlimitwhen the account is full, and save nothing. Archive or delete a pack to free a slot, or upgrade the plan. The other plans have no cap. - Modules. The v1
packsandpromotionsresources require theproductsmodule on every request and answer 403feature_not_available_in_planwhen it is missing.productsandprice-listsanswer as before. A pack line bypack_idin a document requires thepacksmodule. - Offers. The
labelaccepts 24 characters at most. - Documents. The line examples include
pack_group: null.
New endpoints12
| Endpoint | Description |
|---|---|
GET/v1/companies/{company}/packs | List all packs |
POST/v1/companies/{company}/packs | Create a pack |
GET/v1/companies/{company}/packs/{pack} | Retrieve a pack |
PATCH/v1/companies/{company}/packs/{pack} | Update a pack |
DEL/v1/companies/{company}/packs/{pack} | Delete a pack |
POST/v1/companies/{company}/packs/{pack}/archive | Archive a pack |
POST/v1/companies/{company}/packs/{pack}/restore | Restore a pack |
GET/v1/companies/{company}/packs/{pack}/price-breakdown | Get the price breakdown of a pack |
POST/v1/companies/{company}/packs/{pack}/images | Upload an image to a pack |
PATCH/v1/companies/{company}/packs/{pack}/images/{image} | Update a pack image |
DEL/v1/companies/{company}/packs/{pack}/images/{image} | Remove a pack image |
POST/v1/companies/{company}/products/bulk-channels | Bulk publish or withdraw products on the web |