Template routes: extend, promote, upgrade
The Template Verbs extend, promote, upgrade as api.sb routes, with inputs, result, refusals and an example.
Reference for Template, one group of Template routes.
Template.extend
Extend adds a Template to a Startup’s bases, pinned to a Version, so the Startup inherits its definition. Verb page.
POST /{namespace}/ templates/ {template}/ extendPath: template. Body, as JSON: the other inputs. Emits Template.extended.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
template | Template | required | The Template to inherit. |
startup | Startup | required | The Startup that extends it. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
startup | Startup | required | The Startup with the Template among its bases. |
template | Template | required | The Template extended. |
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. |
| The record is not in a state that allows this Verb, so the call is refused. | refused | Read the record, run the Verb that moves it to an allowed state, then retry. | None. |
| A clash between two bases until the Startup settles it | refused | Clear what the check names, then call it again. | None. |
Example
curl -X POST https: //api.sb/ leaseline.app/ templates/ template_THRQF1h9uX/ extend \
-H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
-H "Content-Type: application/ json" \
-d '{"startup": "startup_l3hr1EnUGY"}'{
"api": "https: //api.sb/ leaseline.app",
"startup": {
"$id": "https: //api.sb/ leaseline.app/ startups/ startup_l3hr1EnUGY",
"$type": "Startup",
"name": "Leaseline"
},
"template": {
"$id": "https: //api.sb/ leaseline.app/ templates/ template_THRQF1h9uX",
"$type": "Template",
"body": "Example body"
},
"action": {
"$id": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG",
"operation": "Template.extend",
"status": "done"
},
"links": {
"self": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG"
}
}Template.promote
Promote moves one Startup’s refinement into a Template, so every Startup that extends the Template inherits it. Verb page.
POST /{namespace}/ templates/ {template}/ promotePath: template. Body, as JSON: the other inputs. Emits Template.promoted.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
template | Template | required | The Template that receives the refinement. |
startup | Startup | required | The Startup that holds the refinement. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
change | Change | required | The Change against the Template. |
template | Template | required | The Template that received the refinement. |
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. |
| The record is not in a state that allows this Verb, so the call is refused. | refused | Read the record, run the Verb that moves it to an allowed state, then retry. | None. |
Example
curl -X POST https: //api.sb/ leaseline.app/ templates/ template_THRQF1h9uX/ promote \
-H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
-H "Content-Type: application/ json" \
-d '{"startup": "startup_l3hr1EnUGY"}'{
"api": "https: //api.sb/ leaseline.app",
"change": {
"$id": "https: //api.sb/ leaseline.app/ changes/ change_3Ex8uVSOyQ",
"$type": "Change",
"status": "Open",
"base": "version_4HTEMs14G4"
},
"template": {
"$id": "https: //api.sb/ leaseline.app/ templates/ template_THRQF1h9uX",
"$type": "Template",
"body": "Example body"
},
"action": {
"$id": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG",
"operation": "Template.promote",
"status": "done"
},
"links": {
"self": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG"
}
}Template.upgrade
Upgrade moves a Startup to a newer Version of a Template it extends, through a Change it can review. Verb page.
POST /{namespace}/ templates/ {template}/ upgradePath: template. Body, as JSON: the other inputs. Emits Template.upgraded.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
template | Template | required | The Template to upgrade. |
startup | Startup | required | The Startup that extends it. |
version | Version | The target Version. Defaults to the latest. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
change | Change | required | The Change that moves the pin. |
template | Template | required | The Template upgraded to. |
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. |
| The record is not in a state that allows this Verb, so the call is refused. | refused | Read the record, run the Verb that moves it to an allowed state, then retry. | None. |
Example
curl -X POST https: //api.sb/ leaseline.app/ templates/ template_THRQF1h9uX/ upgrade \
-H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
-H "Content-Type: application/ json" \
-d '{"startup": "startup_l3hr1EnUGY"}'{
"api": "https: //api.sb/ leaseline.app",
"change": {
"$id": "https: //api.sb/ leaseline.app/ changes/ change_3Ex8uVSOyQ",
"$type": "Change",
"status": "Open",
"base": "version_4HTEMs14G4"
},
"template": {
"$id": "https: //api.sb/ leaseline.app/ templates/ template_THRQF1h9uX",
"$type": "Template",
"body": "Example body"
},
"action": {
"$id": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG",
"operation": "Template.upgrade",
"status": "done"
},
"links": {
"self": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG"
}
}