Skip to content
APIProductWhat you sellProduct

Product routes: update, delete

The Product Verbs update, delete as api.sb routes, with inputs, result, refusals and an example.

Reference for Product, one group of Product routes.

Product.update

Changes the given properties of a Product. Verb page.

Text
PATCH /{namespace}/products/{id}

Path: id. Body, as JSON: the other inputs. Emits Product.updated.

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the Product.
namestringThe name of the Product.
promisetextWhat the Customer can rely on.

Returns

OutputTypeRequiredDescription
productProductrequiredThe Product.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
curl -X PATCH https://api.sb/leaseline.app/products/prod_MJmgS5dysq \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Leaseline"}'
JSON
{
  "api": "https://api.sb/leaseline.app",
  "product": {
    "$id": "https://api.sb/leaseline.app/products/prod_MJmgS5dysq",
    "$type": "Product",
    "name": "Leaseline",
    "promise": "No renewal slips past its date.",
    "status": "draft"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Product.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}

Product.delete

Deletes a Product: a soft delete that keeps its history, undone by Thing.restore. Verb page.

Text
DELETE /{namespace}/products/{id}

Path: id. Emits Product.deleted.

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the Product.

Returns

OutputTypeRequiredDescription
productProductrequiredThe Product.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
curl -X DELETE https://api.sb/leaseline.app/products/prod_MJmgS5dysq \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
JSON
{
  "api": "https://api.sb/leaseline.app",
  "product": {
    "$id": "https://api.sb/leaseline.app/products/prod_MJmgS5dysq",
    "$type": "Product",
    "name": "Leaseline",
    "promise": "No renewal slips past its date.",
    "status": "draft"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Product.delete",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}