Skip to content

Deal routes: update, delete

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

Reference for Deal, one group of Deal routes.

Deal.update

Changes the given properties of a Deal. Verb page.

Text
PATCH /{namespace}/deals/{id}

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

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the Deal.
valuemoneyWhat the Deal is worth if won.
ownerWorkerThe Worker who runs it.
closesOndateThe date the buyer expects to decide.
nextSteptextThe next dated step agreed with the buyer.

Returns

OutputTypeRequiredDescription
dealDealrequiredThe Deal.

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/deals/deal_NgACZ6DcII \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"value":{"amount":29,"currency":"USD"}}'
JSON
{
  "api": "https://api.sb/leaseline.app",
  "deal": {
    "$id": "https://api.sb/leaseline.app/deals/deal_NgACZ6DcII",
    "$type": "Deal",
    "status": "Open",
    "value": {
      "amount": 29,
      "currency": "USD"
    }
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Deal.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}

Deal.delete

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

Text
DELETE /{namespace}/deals/{id}

Path: id. Emits Deal.deleted.

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the Deal.

Returns

OutputTypeRequiredDescription
dealDealrequiredThe Deal.

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/deals/deal_NgACZ6DcII \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
JSON
{
  "api": "https://api.sb/leaseline.app",
  "deal": {
    "$id": "https://api.sb/leaseline.app/deals/deal_NgACZ6DcII",
    "$type": "Deal",
    "status": "Open"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Deal.delete",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}