Skip to content

Ad routes: update, delete

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

Reference for Ad, one group of Ad routes.

Ad.update

Changes the given properties of an Ad. Verb page.

Text
PATCH /{namespace}/ads/{id}

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

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the Ad.
formatstringOne of search, display, image, or video.
spendmoneyWhat it has cost so far.

Returns

OutputTypeRequiredDescription
adAdrequiredThe Ad.

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/ads/ad_yVW4IAmeOW \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"format":"search"}'
JSON
{
  "api": "https://api.sb/leaseline.app",
  "ad": {
    "$id": "https://api.sb/leaseline.app/ads/ad_yVW4IAmeOW",
    "$type": "Ad",
    "format": "search"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Ad.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}

Ad.delete

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

Text
DELETE /{namespace}/ads/{id}

Path: id. Emits Ad.deleted.

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the Ad.

Returns

OutputTypeRequiredDescription
adAdrequiredThe Ad.

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/ads/ad_yVW4IAmeOW \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
JSON
{
  "api": "https://api.sb/leaseline.app",
  "ad": {
    "$id": "https://api.sb/leaseline.app/ads/ad_yVW4IAmeOW",
    "$type": "Ad",
    "format": "search"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Ad.delete",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}