Importing Content

Using APIs to import content

In this example, the PowerShell script reads through a folder structure and imports the found files onto the specified Content Catalyst site where the report containers already exist. 

 You can reference this example when creating your own integrations using our API.

 

Only 3 API endpoints are used in this script:

GET /authenticate

to get the authentication token required for the headers of the remaining calls.

POST ​/libraries​/reports​/products​/{productCode}​/imports

Uploads a file and makes it ready for processing.

GET ​/libraries​/reports​/products​/{productCode}​/imports​/{id}

To return the status of an import.

 

Avoiding "drafts"

Our APIs follow the same logic as our UI, such that if you import a Word document it goes into "draft" mode and you then have to "publish" the draft as detailed here.

🚨 If you are importing Word content entirely via the API and aren't expecting or do not want to have a human review and publish stage, you can change the report status to "disabled" before importing content to avoid entering into this draft mode.  PDF and PPT content do not have this draft mode.

 

The API calls (assuming the products already exist) would work as follows:

Use

PUT ​/libraries​/reports​/products​/{productCode}

To update the product metadata, setting

"isDisabled": true

Then import the Word document

POST ​/libraries​/reports​/products​/{productCode}​/imports

Check the status of the import

GET ​/libraries​/reports​/products​/{productCode}​/imports​/{id}

Once complete change the report status from disabled once more using

PUT ​/libraries​/reports​/products​/{productCode}

setting

"isDisabled": false