Import a bundle
const url = 'https://api.ebitex.io/content/management/v1/import';const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
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/management/v1/import \ --header 'Authorization: Bearer <token>'Writes a bundle into the key’s environment. The server plans the import again itself, with the same identityMode and baseTokens you would send to /import-plan, and never trusts a plan you saw earlier.
items selects what is written, as { "kind", "id", "confirmOverwrite" } using the bundle’s own ids. Name every item the plan did not call identical. An item the plan calls new must be named, or the import is refused, because nothing else would create it. An item planned as conflict is written only with confirmOverwrite: true: that flag means “overwrite what is there”, so re-plan before reaching for it. Dependencies are still resolved across the whole bundle, so written items reference the right rows.
The import runs as a background job: this returns 202 with an operation id, and the content is not written when it returns. Poll GET /operations/{id} until the job succeeds or fails. A large bundle would otherwise hold one request open past the timeout of whatever proxy sits in front of the API.
The import is one transaction. If any selected item carries an invalid document, nothing is written and the job fails with an error listing every invalid item and its failing fields, so you can fix them all and resubmit once. If the items the import would create would take the organization past a plan limit on components, pages or categories, nothing is written and the job fails with error: "quota_exceeded" and a quotas list giving each exceeded limit’s quotaKey, limit, current count and how many the import was adding. Only created items count, so an import that only updates existing content is never refused for this. Everything the server can refuse before starting — a blocked plan, an unconfirmed overwrite, an omitted new item, a malformed bundle — is still answered immediately, as an error status on this call rather than as a failed job.
The key acts as its role. Contracts, templates, adapters, streams and categories each need the role to hold that kind’s manage permission (content.contracts.manage, content.templates.manage, content.adapters.manage, content.streams.manage, content.taxonomy.manage), and components and page nodes are subject to the branch access rules. Only the items items selects are checked, because only they are written: importing a component does not need content.contracts.manage unless its contract is selected too. A component needs edit both where it is now and in the folder the bundle files it in, since an import that changes its folder moves it. A page node needs edit on itself and on the parent it is filed under.
Key: a management key with content.management.write.
Authorizations
Section titled “Authorizations”Responses
Section titled “ Responses ”{ "id", "status" }. The finished job’s result is { "items": [ { "kind", "id", "imported", "error" } ] }.
validation_failed: no body, bundle is not a bundle document, or identityMode is unknown. required_item_omitted: items the plan calls new are missing from items; the response names them. unsupported_format_version: the bundle’s formatVersion is not one this server accepts; the response gives supplied and supported. unknown_property: the body has a property this API does not recognize; the response names it in property. invalid_json: the body is not valid JSON.
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.
permission_denied: a selected item is of a kind the key’s role cannot manage; permission names the permission it lacks. access_denied: the key’s role cannot edit a folder or page node a selected item is in or would be filed under.
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.
A selected item is in, or would be filed under, a folder or page node the key’s role cannot view.
import_blocked: the plan has blockers, listed in blockers; nothing is written, including items that are not blocked. confirm_overwrite_required: items differ from the environment and were not confirmed; they are listed in items. Re-plan before confirming.
Rate limit or quota exceeded; Retry-After says how long to wait. too_many_failed_authentications: too many bad keys from this address.