Skip to content
campaiDeveloper
campai.com

Sales · Products

POST/{organizationId}/{mandateId}/sales/productsWithVariants/{productId}

Update product with variants

Updates a product with variants and all its variants together, or turns a product into one: it keeps its id, stock and receipts as the first variant under a new product with variants, whose id is returned. Variants of removed values are deleted when never used, otherwise switched off and kept as products of their own

Permissions

Send an API key of the organization in the path, using the X-API-Key header.

Permission checks in detail
Required permissions
  • mandate.read
  • product.edit
Also checked, depending on the request and the records it touches
  • inventory.edit

Request

Path parameters

  • organizationIdidrequired
  • mandateIdidrequired
  • productIdidrequired

Body

Content-Type: application/json

  • numberstringrequired

    at most 32 characters

  • namestringrequired

    1–80 characters

  • descriptionstringrequired

    at most 2000 characters

  • categoryidrequirednullable
  • activebooleanrequired
  • imagesobject[]

    at most 8 items · default []

    3 properties
    • fileNamestring

      at most 128 characters

    • resourcestringrequired
    • idstring

      exactly 6 characters

  • unitobjectrequired
  • inventoryModestringrequired
    unlimited global salesPeriod
  • priceobjectrequired
    8 properties
    • isNetbooleanrequired
    • priceintegerrequired

      0–9999999999

    • taxCodestringrequirednullable

      1–5 characters

    • taxRatenumberrequirednullable

      at most 99

    • accountintegerrequired

      1–999999999

    • costCenter1numberrequirednullable

      1–99999999

    • costCenter2numberrequirednullable

      1–99999999

    • dimensionsobject[]required
      2 properties
      • dimensionIdidrequired
      • optionKeystringrequired

        1–64 characters

  • optionsobject[]required

    1–2 items

    3 properties
    • idstringrequired

      exactly 8 characters

    • namestringrequired

      1–40 characters

    • valuesobject[]required

      1–50 items

      2 properties
      • idstringrequired

        exactly 8 characters

      • namestringrequired

        1–20 characters

  • variantsobject[]required

    at most 50 items

    7 properties
    • _ididrequirednullable
    • valuesobject[]required

      1–2 items

      2 properties
      • optionstringrequired

        exactly 8 characters

      • valuestringrequired

        exactly 8 characters

    • numberstringrequired

      at most 32 characters

    • pricenumberrequirednullable

      at least 0

    • activebooleanrequired
    • initialCapacitynumber

      at least 0 · default 0

    • salesPeriodInitialCapacitynumber

      at least 0 · default 0

  • shopobject
    3 properties
    • listedbooleanrequired
    • textstringrequired

      at most 4000 characters

    • memberPricesobject[]required

      at most 10 items

      4 properties
      • idstringrequired

        exactly 8 characters

      • namestringrequired

        1–50 characters

      • amountintegerrequired

        0–9999999999

      • memberobjectrequired
        3 properties
        • tagsstring[]required

          at most 4 items · each 1–40 characters

        • tagsModestringrequired
          any all
        • allMandatesboolean

          default false

Request
curl --fail-with-body --silent --show-error --max-time 30 --globoff \
  --request POST 'https://cloud.campai.com/api/YOUR_ORGANIZATION_ID/YOUR_MANDATE_ID/sales/productsWithVariants/YOUR_PRODUCT_ID' \
  --header 'X-API-Key: YOUR_API_KEY'

No request that worked has been recorded yet, so the body is not shown.

Response

200 Successful response

Content-Type: application/json

  • _idid
Response200
{
  "_id": "000000000000000000000001"
}

Errors

No errors of its own are known for this endpoint.

Errors nearly every request can meet are listed under Errors.