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.
PATCH /{namespace}/ ads/ {id}Path: id. Body, as JSON: the other inputs. Emits Ad.updated.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
id | string | required | The id of the Ad. |
format | string | One of search, display, image, or video. | |
spend | money | What it has cost so far. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
ad | Ad | required | The Ad. |
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/ ads/ ad_yVW4IAmeOW \
-H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
-H "Content-Type: application/ json" \
-d '{"format": "search"}'{
"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.
DELETE /{namespace}/ ads/ {id}Path: id. Emits Ad.deleted.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
id | string | required | The id of the Ad. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
ad | Ad | required | The Ad. |
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/ ads/ ad_yVW4IAmeOW \
-H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"{
"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"
}
}