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.
PATCH /{namespace}/ products/ {id}Path: id. Body, as JSON: the other inputs. Emits Product.updated.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
id | string | required | The id of the Product. |
name | string | The name of the Product. | |
promise | text | What the Customer can rely on. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
product | Product | required | The Product. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
Example
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"}'{
"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.
DELETE /{namespace}/ products/ {id}Path: id. Emits Product.deleted.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
id | string | required | The id of the Product. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
product | Product | required | The Product. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
Example
curl -X DELETE https: //api.sb/ leaseline.app/ products/ prod_MJmgS5dysq \
-H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"{
"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"
}
}