Execute a promotion
const url = 'https://api.ebitex.io/content/deployment/v1/promotions/execute';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"root":{"kind":"example","id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"},"items":[{"kind":"example","id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","confirmOverwrite":true}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.ebitex.io/content/deployment/v1/promotions/execute \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "root": { "kind": "example", "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" }, "items": [ { "kind": "example", "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "confirmOverwrite": true } ] }'Promotes one item, and everything it depends on, from the key’s source environment to its target.
Send root (the same { kind, id } you planned) and items, the list of explicit items to write. Items the plan marked implicit always come along. The server plans again itself and never trusts an earlier plan, so a change between planning and executing is caught.
Overwriting. An item the plan marked diverged has been changed in the target since the last promotion. It is promoted only when two things are both true: the item carries confirmOverwrite: true in items, and the key was created with overwriting allowed. Otherwise the whole request is refused and nothing is written. A pipeline that should never replace edits made in the target needs no extra care: that is how keys are created by default.
The key is checked as the role it acts as, against the source environment, as when a person promotes. Each execute counts against the organization’s daily write allowance.
Key: content.deployment.execute
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Examplegenerated
{ "root": { "kind": "example", "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" }, "items": [ { "kind": "example", "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "confirmOverwrite": true } ]}Responses
Section titled “ Responses ”{ "items": [ { "kind", "id", "promoted", "error" } ] }, one entry for each item written.
not_a_promotion_target: the key’s edge is no longer in the organization’s topology. promotion_root_required: the request has no root.
missing_api_key or invalid_api_key: no key was sent, or it is unknown, revoked or expired.
scope_denied: the key does not hold content.deployment.execute. permission_denied: the role may not promote this item.
scope_denied: the key lacks this route’s scope. origin_denied or ip_denied: a browser-safe key was used from an origin or address outside its restrictions. app_not_available: Content is not enabled for the organization.
promotion_conflict: one or more diverged items were not both confirmed and allowed. The body lists them as items. Nothing was written. promotion_blocked_by_ancestor_realms: the promotion needs items owned by a realm above the key’s own that the target lacks or has behind; they are listed as blockedByAncestorRealms. Nothing was written.
promotion_blocked: the plan has blockers. They are listed as blockers.
Quota exceeded; Retry-After says how long to wait. too_many_failed_authentications: too many bad keys from this address.