Update a component
const url = 'https://api.ebitex.io/content/management/v1/components/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","document":{},"folderId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","repinToLatest":false,"rowVersion":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://api.ebitex.io/content/management/v1/components/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "document": {}, "folderId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "repinToLatest": false, "rowVersion": 1 }'Replaces a component’s name, folderId and document. This is a full replace: omitting folderId moves the component to the root. The document is validated against the component’s pinned contract version; send repinToLatest: true to validate against the contract’s latest version instead and, on success, move the pin there. The external id and the contract cannot be changed.
Send the rowVersion from your last read to make the update conditional: if the component changed in the meantime the write is refused with 409 concurrency_conflict and the current currentRowVersion. Without it, the last write wins.
The key needs edit on the component’s folder, and on the target folder too when moving it, which must also allow the component’s contract. When a workflow governs the component, it can only be edited in an editable workflow state. Components inherited from another environment are read-only here.
Key: a management key with content.management.authoring.
Authorizations
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
object
Responses
Section titled “ Responses ”OK
validation_failed: the document does not validate; errors names each failing field’s path. folder_contract_constraint_violation: the target folder does not allow components of this contract.
missing_api_key or invalid_api_key: no key was sent, or it is unknown, revoked or expired.
payment_required: the organization’s subscription needs attention.
access_denied: the key’s role may not edit the component’s folder or the target folder.
scope_denied: the key lacks this route’s scope. tier_required: the Content Management API needs the Pro plan or above. ip_denied: the caller’s address is outside the key’s allowed ranges. app_not_available: Content is not enabled for the organization.
No component has this id in the key’s environment, it is in a branch the key’s role cannot view, or folderId names no folder.
concurrency_conflict: the component changed since rowVersion was read; re-read it and retry. inherited_read_only: the component is inherited from another environment (sourceEnvironmentId); edit it there.
workflow_state_not_editable: the component’s workflow state (state, in definition) does not allow edits; move it to an editable state first.
Rate limit or quota exceeded; Retry-After says how long to wait. too_many_failed_authentications: too many bad keys from this address.