Skip to content

Request and response examples ​

Three interactions between the Store Deputy API and a store module, taken verbatim from the generated examples file of the accepted contract (contracts/module/operations.json, decision 004). They specify behaviour to implement, not what any module does today: the OpenCart 3 module still answers the removed catalog.* operations in the old shape. Every request carries the headers below and every answer is signed the same way (signing); the body is what is shown.

Operation shape · Operation approval · Module Protocol 1

http
POST /storedeputy.php HTTP/1.1
Host: shop.example
Content-Type: application/json; charset=utf-8
X-SD-Connection: <paired-connection-id>
X-SD-Timestamp: <unix-seconds>
X-SD-Nonce: <fresh-random-nonce>
X-SD-Signature: v1=<computed-hmac>

product.search returns every match for every input and never picks one: the duplicated SKU gives two products, the unknown barcode an empty list, and the third SKU belongs to a variant of product 310 (only a module that declares variant.read answers variant matches).

Module request

json
{
  "protocol": "1.0",
  "id": "0f8e2d6c-4b1a-4c3e-9d7f-1a2b3c4d5e6f",
  "op": "product.search",
  "params": {
    "identifiers": [
      {
        "type": "sku",
        "value": "SD-DUP"
      },
      {
        "type": "gtin",
        "value": "4006381333931"
      },
      {
        "type": "sku",
        "value": "TEE-RED-L"
      }
    ]
  }
}

Module response · HTTP 200

json
{
  "protocol": "1.0",
  "id": "0f8e2d6c-4b1a-4c3e-9d7f-1a2b3c4d5e6f",
  "ok": true,
  "result": {
    "results": [
      {
        "input": {
          "type": "sku",
          "value": "SD-DUP"
        },
        "matches": [
          {
            "resource": "product",
            "id": "42",
            "parentId": null
          },
          {
            "resource": "product",
            "id": "57",
            "parentId": null
          }
        ]
      },
      {
        "input": {
          "type": "gtin",
          "value": "4006381333931"
        },
        "matches": []
      },
      {
        "input": {
          "type": "sku",
          "value": "TEE-RED-L"
        },
        "matches": [
          {
            "resource": "variant",
            "id": "312",
            "parentId": "310"
          }
        ]
      }
    ]
  }
}

2. Read products by id ​

product.get returns the neutral product with its price rules, categories and manufacturer; an id that does not exist is listed in missing, never returned as a product with a zero price. Platform-only columns stay under extensions.opencart.

Module request

json
{
  "protocol": "1.0",
  "id": "0f8e2d6c-4b1a-4c3e-9d7f-1a2b3c4d5e6f",
  "op": "product.get",
  "params": {
    "ids": [
      "42",
      "999"
    ]
  }
}

Module response · HTTP 200

json
{
  "protocol": "1.0",
  "id": "0f8e2d6c-4b1a-4c3e-9d7f-1a2b3c4d5e6f",
  "ok": true,
  "result": {
    "items": [
      {
        "id": "42",
        "code": "AB-100",
        "sku": "AB-100",
        "gtin": "4006381333931",
        "gtins": [
          "4006381333931"
        ],
        "mpn": null,
        "name": "Example kettle",
        "status": "enabled",
        "stock": {
          "quantity": 12,
          "tracked": true
        },
        "price": {
          "amount": "19.9900",
          "currency": "EUR",
          "includesTax": false
        },
        "priceRules": [],
        "variantPricing": "none",
        "storefrontIds": [
          "0"
        ],
        "categoryIds": [
          "20",
          "24"
        ],
        "manufacturerId": "8",
        "updatedAt": "2026-09-30T11:12:00Z",
        "extensions": {
          "opencart": {
            "taxClass": "Taxable Goods",
            "upc": "",
            "ean": "4006381333931",
            "jan": "",
            "isbn": ""
          }
        }
      }
    ],
    "missing": [
      "999"
    ]
  }
}

3. Conditional price change ​

After the owner approved the change on the Store Deputy site, the API's worker sends product.apply. Each item names the value it expects and the value to set; the module changes the price only if the current value still equals expected, reads it back and fires the platform's product-saved notification. ok: true means the batch was processed, not that every item was written: the API checks every outcome, and a conflict needs a fresh read and a new approval, never a blind retry.

Module request

json
{
  "protocol": "1.0",
  "id": "0f8e2d6c-4b1a-4c3e-9d7f-1a2b3c4d5e6f",
  "op": "product.apply",
  "params": {
    "items": [
      {
        "id": "42",
        "expected": {
          "price": "19.9900"
        },
        "set": {
          "price": "21.5000"
        }
      },
      {
        "id": "57",
        "expected": {
          "price": "18.0000"
        },
        "set": {
          "price": "19.0000"
        }
      },
      {
        "id": "61",
        "expected": {
          "status": "enabled"
        },
        "set": {
          "status": "disabled"
        }
      }
    ]
  }
}

Module response · HTTP 200

json
{
  "protocol": "1.0",
  "id": "0f8e2d6c-4b1a-4c3e-9d7f-1a2b3c4d5e6f",
  "ok": true,
  "result": {
    "items": [
      {
        "id": "42",
        "outcome": "applied",
        "before": {
          "price": "19.9900"
        },
        "after": {
          "price": "21.5000"
        },
        "event": "fired"
      },
      {
        "id": "57",
        "outcome": "conflict",
        "current": {
          "price": "18.5000"
        }
      },
      {
        "id": "61",
        "outcome": "applied",
        "before": {
          "status": "enabled"
        },
        "after": {
          "status": "disabled"
        },
        "event": "fired"
      }
    ]
  }
}

The examples file holds 33 pairs in all, including the other product.apply cases ("a price applied, a price conflict, a product disabled", "a variable product needs a variant; a missing product", "a field the shop cannot write") and the variant, category, manufacturer, order, customer and coupon operations.