Replace a stage of a deployment template
Sets one stage of the template, or hands it back to what it inherits, and writes the change through to every environment that follows that stage. Send dry_run true first: the answer's reach lists the environments the change would be written to and writes nothing. A change that reaches production environments is then saved with confirm_production, confirm_count and confirm_targets, and is refused reach_changed if the reach changed since.
- Needs
execas well: The save brings a command the saved stage does not hold (never for a dry run).
Path parameters
The id of a company you belong to or manage. Digits only. At least 1.
The platform the template is for, such as magento2, laravel or wordpress. The list answers the ones your company can have.
The configuration the stage belongs to.
productionuatThe stage to save. all is only for copying one configuration onto the other with copy_from_config.
builddatabasepost_deploysettingsallBody
The dry run's reach.production_count. At least 0.
True to confirm a change that reaches production environments.
The site_id of every production environment in the dry run's reach.production.
Answer the reach and write nothing.
The site_ids of environments that keep their own stage. Every environment the reach lists under cannot_take must be named.
For the production configuration only, make the same change to UAT.
With the stage all, copy every stage from the other configuration: the one that is not {config}. Not with mode, value or also_uat, and refused with any other stage.
productionuatinherit hands the stage back to the level above and takes no value; replace sets it to value, which it needs. Required for every stage but all.
inheritreplaceThe template revision you read. At least 0.
A stage's content, in the shape the site pipeline's stage and settings endpoints take. The database and after-deploy stages hold lines; the build stage holds mode with a preset or its own lines; the settings stage holds the pipeline's settings, each one optional.
Fields
Build only, with mode preset: each hook's own commands under the hook's name, given once, here or inside preset. An empty list in place of the object sets no hook. Up to 0 items.
Commands to save: a list with one line in each entry, or one string with a line break between lines. Lines are taken as sent. At most 200 commands, where a line that starts with # is a comment and is not counted, nor is an empty line; and at most 8,192 bytes a line, counting the spaces it starts with but not those at its end. More commands are refused too_many_lines, a longer line line_too_long. The patterns below count characters, so a line holding characters of more than one byte is refused sooner than they show.
Settings only, as each of the settings below.
when_neededalwaysoffBuild only.
presetcustomautooffnullDatabase only. How many of the lines run before the platform's own database step. At least 0.
Fields
Build only, with mode preset: each hook's own commands under the hook's name, given once, here or inside preset. An empty list in place of the object sets no hook. Up to 0 items.
On a WordPress template, what a repository connected from now on holds. It never changes a repository already connected. While site content repositories are paused, a save of site_content is refused feature_off: a 422, not the 404 a switched-off endpoint answers.
whole_sitesite_contentWhere in the site that content goes. Null is wp-content, or web/app on Bedrock.
Laravel only.
Settings only. Whole seconds for build, build_line, database_line and post_line, 60 to 3600 each, or null for the default. Any other key is refused invalid, and a number outside the bounds timeout_out_of_range. An empty list sets none. Up to 0 items.
autoonoffReturns
200 The template, with the reach of the change and, when it was saved, what was written.
Fields of the 200 answer
Fields
Whether you may save this template.
Why not, when you may not.
A sentence about the chains the template sits in, when there is more than one.
Fields
At least 1.
Present with compare_to. Each stage that differs between the two revisions, with its entry before and after.
Fields
The revision compared with.
By configuration, then by stage. An empty list when the two revisions hold the same content. Up to 0 items.
What the company's template sets, for production environments and for the others.
Fields
Fields
What the template sets for one stage.
Fields
inherit takes the stage from the level above; replace sets it to value.
inheritreplaceA stage's content, in the shape the site pipeline's stage and settings endpoints take. The database and after-deploy stages hold lines; the build stage holds mode with a preset or its own lines; the settings stage holds the pipeline's settings, each one optional.
Fields
Build only. Your own lines for each hook of a preset build, when they are not inside preset. An empty list when there are none.
The stage's commands, one a line, as a list or as one string.
Settings only, as each of the settings below.
when_neededalwaysoffBuild only.
presetcustomautooffnullDatabase only. How many of the lines run before the platform's own database step. At least 0.
Build only, with mode preset: platform, frontend (a preset or a list of them), their options and optional hooks.
On a WordPress template, what a repository connected from now on holds. It never changes a repository already connected. While site content repositories are paused, a save of site_content is refused feature_off: a 422, not the 404 a switched-off endpoint answers.
whole_sitesite_contentWhere in the site that content goes. Null is wp-content, or web/app on Bedrock.
Laravel only.
Whole seconds for a stage or line key (build, build_line, database_line, post_line), or null. A save takes 60 to 3600 for each and no other key. An empty list when none is set.
autoonoffWhat the template sets for one stage.
Fields
inherit takes the stage from the level above; replace sets it to value.
inheritreplaceA stage's content, in the shape the site pipeline's stage and settings endpoints take. The database and after-deploy stages hold lines; the build stage holds mode with a preset or its own lines; the settings stage holds the pipeline's settings, each one optional.
Fields
Build only. Your own lines for each hook of a preset build, when they are not inside preset. An empty list when there are none.
The stage's commands, one a line, as a list or as one string.
Settings only, as each of the settings below.
when_neededalwaysoffBuild only.
presetcustomautooffnullDatabase only. How many of the lines run before the platform's own database step. At least 0.
Build only, with mode preset: platform, frontend (a preset or a list of them), their options and optional hooks.
On a WordPress template, what a repository connected from now on holds. It never changes a repository already connected. While site content repositories are paused, a save of site_content is refused feature_off: a 422, not the 404 a switched-off endpoint answers.
whole_sitesite_contentWhere in the site that content goes. Null is wp-content, or web/app on Bedrock.
Laravel only.
Whole seconds for a stage or line key (build, build_line, database_line, post_line), or null. A save takes 60 to 3600 for each and no other key. An empty list when none is set.
autoonoffWhat the template sets for one stage.
Fields
inherit takes the stage from the level above; replace sets it to value.
inheritreplaceA stage's content, in the shape the site pipeline's stage and settings endpoints take. The database and after-deploy stages hold lines; the build stage holds mode with a preset or its own lines; the settings stage holds the pipeline's settings, each one optional.
Fields
Build only. Your own lines for each hook of a preset build, when they are not inside preset. An empty list when there are none.
The stage's commands, one a line, as a list or as one string.
Settings only, as each of the settings below.
when_neededalwaysoffBuild only.
presetcustomautooffnullDatabase only. How many of the lines run before the platform's own database step. At least 0.
Build only, with mode preset: platform, frontend (a preset or a list of them), their options and optional hooks.
On a WordPress template, what a repository connected from now on holds. It never changes a repository already connected. While site content repositories are paused, a save of site_content is refused feature_off: a 422, not the 404 a switched-off endpoint answers.
whole_sitesite_contentWhere in the site that content goes. Null is wp-content, or web/app on Bedrock.
Laravel only.
Whole seconds for a stage or line key (build, build_line, database_line, post_line), or null. A save takes 60 to 3600 for each and no other key. An empty list when none is set.
autoonoffWhat the template sets for one stage.
Fields
inherit takes the stage from the level above; replace sets it to value.
inheritreplaceA stage's content, in the shape the site pipeline's stage and settings endpoints take. The database and after-deploy stages hold lines; the build stage holds mode with a preset or its own lines; the settings stage holds the pipeline's settings, each one optional.
Fields
Build only. Your own lines for each hook of a preset build, when they are not inside preset. An empty list when there are none.
The stage's commands, one a line, as a list or as one string.
Settings only, as each of the settings below.
when_neededalwaysoffBuild only.
presetcustomautooffnullDatabase only. How many of the lines run before the platform's own database step. At least 0.
Build only, with mode preset: platform, frontend (a preset or a list of them), their options and optional hooks.
On a WordPress template, what a repository connected from now on holds. It never changes a repository already connected. While site content repositories are paused, a save of site_content is refused feature_off: a 422, not the 404 a switched-off endpoint answers.
whole_sitesite_contentWhere in the site that content goes. Null is wp-content, or web/app on Bedrock.
Laravel only.
Whole seconds for a stage or line key (build, build_line, database_line, post_line), or null. A save takes 60 to 3600 for each and no other key. An empty list when none is set.
autoonoffFields
What the template sets for one stage.
Fields
inherit takes the stage from the level above; replace sets it to value.
inheritreplaceA stage's content, in the shape the site pipeline's stage and settings endpoints take. The database and after-deploy stages hold lines; the build stage holds mode with a preset or its own lines; the settings stage holds the pipeline's settings, each one optional.
Fields
Build only. Your own lines for each hook of a preset build, when they are not inside preset. An empty list when there are none.
The stage's commands, one a line, as a list or as one string.
Settings only, as each of the settings below.
when_neededalwaysoffBuild only.
presetcustomautooffnullDatabase only. How many of the lines run before the platform's own database step. At least 0.
Build only, with mode preset: platform, frontend (a preset or a list of them), their options and optional hooks.
On a WordPress template, what a repository connected from now on holds. It never changes a repository already connected. While site content repositories are paused, a save of site_content is refused feature_off: a 422, not the 404 a switched-off endpoint answers.
whole_sitesite_contentWhere in the site that content goes. Null is wp-content, or web/app on Bedrock.
Laravel only.
Whole seconds for a stage or line key (build, build_line, database_line, post_line), or null. A save takes 60 to 3600 for each and no other key. An empty list when none is set.
autoonoffWhat the template sets for one stage.
Fields
inherit takes the stage from the level above; replace sets it to value.
inheritreplaceA stage's content, in the shape the site pipeline's stage and settings endpoints take. The database and after-deploy stages hold lines; the build stage holds mode with a preset or its own lines; the settings stage holds the pipeline's settings, each one optional.
Fields
Build only. Your own lines for each hook of a preset build, when they are not inside preset. An empty list when there are none.
The stage's commands, one a line, as a list or as one string.
Settings only, as each of the settings below.
when_neededalwaysoffBuild only.
presetcustomautooffnullDatabase only. How many of the lines run before the platform's own database step. At least 0.
Build only, with mode preset: platform, frontend (a preset or a list of them), their options and optional hooks.
On a WordPress template, what a repository connected from now on holds. It never changes a repository already connected. While site content repositories are paused, a save of site_content is refused feature_off: a 422, not the 404 a switched-off endpoint answers.
whole_sitesite_contentWhere in the site that content goes. Null is wp-content, or web/app on Bedrock.
Laravel only.
Whole seconds for a stage or line key (build, build_line, database_line, post_line), or null. A save takes 60 to 3600 for each and no other key. An empty list when none is set.
autoonoffWhat the template sets for one stage.
Fields
inherit takes the stage from the level above; replace sets it to value.
inheritreplaceA stage's content, in the shape the site pipeline's stage and settings endpoints take. The database and after-deploy stages hold lines; the build stage holds mode with a preset or its own lines; the settings stage holds the pipeline's settings, each one optional.
Fields
Build only. Your own lines for each hook of a preset build, when they are not inside preset. An empty list when there are none.
The stage's commands, one a line, as a list or as one string.
Settings only, as each of the settings below.
when_neededalwaysoffBuild only.
presetcustomautooffnullDatabase only. How many of the lines run before the platform's own database step. At least 0.
Build only, with mode preset: platform, frontend (a preset or a list of them), their options and optional hooks.
On a WordPress template, what a repository connected from now on holds. It never changes a repository already connected. While site content repositories are paused, a save of site_content is refused feature_off: a 422, not the 404 a switched-off endpoint answers.
whole_sitesite_contentWhere in the site that content goes. Null is wp-content, or web/app on Bedrock.
Laravel only.
Whole seconds for a stage or line key (build, build_line, database_line, post_line), or null. A save takes 60 to 3600 for each and no other key. An empty list when none is set.
autoonoffWhat the template sets for one stage.
Fields
inherit takes the stage from the level above; replace sets it to value.
inheritreplaceA stage's content, in the shape the site pipeline's stage and settings endpoints take. The database and after-deploy stages hold lines; the build stage holds mode with a preset or its own lines; the settings stage holds the pipeline's settings, each one optional.
Fields
Build only. Your own lines for each hook of a preset build, when they are not inside preset. An empty list when there are none.
The stage's commands, one a line, as a list or as one string.
Settings only, as each of the settings below.
when_neededalwaysoffBuild only.
presetcustomautooffnullDatabase only. How many of the lines run before the platform's own database step. At least 0.
Build only, with mode preset: platform, frontend (a preset or a list of them), their options and optional hooks.
On a WordPress template, what a repository connected from now on holds. It never changes a repository already connected. While site content repositories are paused, a save of site_content is refused feature_off: a 422, not the 404 a switched-off endpoint answers.
whole_sitesite_contentWhere in the site that content goes. Null is wp-content, or web/app on Bedrock.
Laravel only.
Whole seconds for a stage or line key (build, build_line, database_line, post_line), or null. A save takes 60 to 3600 for each and no other key. An empty list when none is set.
autoonoffSet while Corefinity has locked the template, so it cannot be edited. Null when it can.
Fields
Why, in Corefinity's words.
Fields
The build presets this platform offers.
Fields of each item
platformfrontendThe lowest Node.js major version the preset needs.
The lowest Node.js major version an option of the preset needs, by option.
Send this with a save or a restore.
What each stage inherits and what is in effect, once for each chain the template sits in: none for the company's own environments, and one for each agency that manages some of them.
Fields of each item
The levels a stage is inherited through, from Corefinity's default down to this company.
Fields of each item
Such as corefinity, agency or owner.
Fields
By configuration (production, uat), then by stage: inherited (the level, company and revision the stage comes from, with its value), effective (the content in effect) and differs_from_none.
none, or agency: and the id of the agency whose template sits above this one.
The environments the change reaches. Null when the request changes nothing in the template: a dry run then answers reach and written null, and a save answers reach null and written with zeros, leaving the revision as it was.
What was written. Null for a dry run.
If it is refused
| Status | Reason | What to do |
|---|---|---|
401 | none | Send a valid token as Authorization: Bearer <token>. |
403 | company_unavailable | Your company is unavailable. |
403 | scope_required | Use a token with the scope named in scope. |
403 | forbidden | The person is not allowed to do this. |
403 | two_factor_required | Turn on two-factor on your account, then send again. |
404 | feature_off | This feature is not on for your organisation yet. |
409 | reach_changed | The environments this change reaches have changed since you reviewed it. Review them again, then confirm. |
409 | stale | What you read has changed since you read it. Read it again, then send the change with its new version or quote. |
409 | template_locked | Corefinity has locked this template: Held while a change is reviewed. |
422 | confirm | The action needs an explicit confirmation field. Ask the person, then send it. |
422 | invalid | Fix the field named in field; errors says why. |
422 | feature_off | This feature is not on for your organisation yet. |
422 | timeout_out_of_range | Choose a timeout between 60 and 3600 seconds. |
422 | version_unavailable | This version is not available here. |
429 | rate_limited | Wait for the seconds in Retry-After. |
Reasons are listed by name in Errors and refusals.
The same task elsewhere
curl -X PUT https://manage.corefinity.com/api/corestack/companies/1204/deploy-templates/magento2/production/stages/post_deploy \
-H "Authorization: Bearer $COREFINITY_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"confirm_count": 1,
"confirm_production": true,
"confirm_targets": [
1042
],
"mode": "replace",
"revision": 2,
"value": {
"lines": [
"php bin/magento cache:flush",
"php bin/magento cron:install"
]
}
}'use Illuminate\Support\Facades\Http;
$response = Http::withToken(env('COREFINITY_TOKEN'))
->acceptJson()
->put('https://manage.corefinity.com/api/corestack/companies/1204/deploy-templates/magento2/production/stages/post_deploy', [
'confirm_count' => 1,
'confirm_production' => true,
'confirm_targets' => [
1042,
],
'mode' => 'replace',
'revision' => 2,
'value' => [
'lines' => [
'php bin/magento cache:flush',
'php bin/magento cron:install',
],
],
]);
$data = $response->json();const res = await fetch('https://manage.corefinity.com/api/corestack/companies/1204/deploy-templates/magento2/production/stages/post_deploy', {
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
confirm_count: 1,
confirm_production: true,
confirm_targets: [
1042,
],
mode: 'replace',
revision: 2,
value: {
lines: [
'php bin/magento cache:flush',
'php bin/magento cron:install',
],
},
}),
});
// An answer with no body (204) has nothing to parse.
const text = await res.text();
const data = text && JSON.parse(text);import os
import requests
res = requests.put(
"https://manage.corefinity.com/api/corestack/companies/1204/deploy-templates/magento2/production/stages/post_deploy",
headers={
"Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
"Accept": "application/json",
},
json={
"confirm_count": 1,
"confirm_production": True,
"confirm_targets": [
1042,
],
"mode": "replace",
"revision": 2,
"value": {
"lines": [
"php bin/magento cache:flush",
"php bin/magento cron:install",
],
},
},
)
data = res.json() if res.content else None{
"can": {
"edit": true,
"edit_reason": null
},
"chain_note": null,
"company": {
"id": 1180,
"name": "Northwind Digital"
},
"configs": {
"production": {
"build": {
"mode": "inherit"
},
"database": {
"mode": "inherit"
},
"post_deploy": {
"mode": "replace",
"value": {
"lines": [
"php bin/magento cache:flush",
"php bin/magento cron:install"
]
}
},
"settings": {
"mode": "inherit"
}
},
"uat": {
"build": {
"mode": "inherit"
},
"database": {
"mode": "inherit"
},
"post_deploy": {
"mode": "inherit"
},
"settings": {
"mode": "inherit"
}
}
},
"dry_run": false,
"locked": null,
"platform": "magento2",
"presets": {
"offered": []
},
"reach": {
"cannot_take": [],
"confirm": {
"count": 1,
"required": true
},
"digest": "3b50f766bb040794",
"environments": 1,
"in_flight": [],
"list_max": 50,
"not_reached": [],
"production": [
{
"binding_id": 2210,
"environment": {
"name": "Production",
"slug": "production"
},
"site": {
"domain": "harbourandfinch.example.com",
"id": 1042
},
"site_id": 1042,
"stages": [
"post_deploy"
]
}
],
"production_count": 1,
"tunnels": {
"access_update": [],
"runtime_needed": []
},
"uat": [],
"uat_count": 0,
"unchanged": 0
},
"revision": 3,
"template_id": 12,
"upstreams": [],
"written": {
"environments": 1,
"kept": 0,
"revisions": 1,
"tunnel_access_started": []
}
}{
"message": "Unauthenticated."
}{
"code": "company_unavailable",
"message": "Your company is unavailable.",
"reason": "company_unavailable"
}{
"code": "feature_off",
"message": "Not found.",
"reason": "feature_off"
}{
"code": "reach_changed",
"message": "The environments this change reaches have changed since you reviewed it. Review them again, then confirm.",
"reach": {
"cannot_take": [],
"confirm": {
"count": 1,
"required": true
},
"digest": "3b50f766bb040794",
"environments": 1,
"in_flight": [],
"list_max": 50,
"not_reached": [],
"production": [
{
"binding_id": 2210,
"environment": {
"name": "Production",
"slug": "production"
},
"site": {
"domain": "harbourandfinch.example.com",
"id": 1042
},
"site_id": 1042,
"stages": [
"post_deploy"
]
}
],
"production_count": 1,
"tunnels": {
"access_update": [],
"runtime_needed": []
},
"uat": [],
"uat_count": 0,
"unchanged": 0
},
"reason": "reach_changed"
}{
"code": "confirm",
"errors": {
"confirm_count": [
"Type the number of production environments to confirm the change."
]
},
"message": "Type the number of production environments to confirm the change.",
"reach": {
"cannot_take": [],
"confirm": {
"count": 1,
"required": true
},
"digest": "3b50f766bb040794",
"environments": 1,
"in_flight": [],
"list_max": 50,
"not_reached": [],
"production": [
{
"binding_id": 2210,
"environment": {
"name": "Production",
"slug": "production"
},
"site": {
"domain": "harbourandfinch.example.com",
"id": 1042
},
"site_id": 1042,
"stages": [
"post_deploy"
]
}
],
"production_count": 1,
"tunnels": {
"access_update": [],
"runtime_needed": []
},
"uat": [],
"uat_count": 0,
"unchanged": 0
},
"reason": "confirm"
}{
"code": "rate_limited",
"message": "Too many requests. Try again in 60 seconds.",
"reason": "rate_limited",
"retry_after_seconds": 60
}Try it is off for this endpointIt overwrites data that cannot be brought back. Copy the request and run it yourself when you are sure.