Plan an import
const url = 'https://api.ebitex.io/content/management/v1/import-plan';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-plan \ --header 'Authorization: Bearer <token>'Compares a bundle with the key’s environment and reports, per item, what an import would do. It writes nothing, so it is safe to run from a pull-request check with a read-only key.
identityMode says how bundle items are matched to what is already there: externalId (the default) matches on each item’s own natural key, which is what a content model kept in source control needs; preserve matches on the bundle’s ids; fresh treats every item as new.
Each item’s state is new, identical, update or conflict. A differing item is update only when you prove the environment has not changed since you last saw it: record each item’s stateToken under its naturalKey, and send that map back as baseTokens next time. Without a matching token every differing item is a conflict. blockers lists anything that would make /import refuse. A clean plan does not promise a valid import: document validation happens at import. Plan again before every import; a plan is only true of the environment as it was when it ran.
Key: a management key with content.management.read.
Authorizations
Section titled “Authorizations”Responses
Section titled “ Responses ”{ "items": [ { "kind", "id", "externalId", "naturalKey", "name", "implicit", "state", "stateToken" } ], "warnings": [ … ], "blockers": [ … ] }. implicit marks an item that is present only as another item’s dependency.
validation_failed: no body, bundle is not a bundle document, or identityMode is unknown. 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.
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.
Rate limit or quota exceeded; Retry-After says how long to wait. too_many_failed_authentications: too many bad keys from this address.