Exporting a Large Number of Entities from Sitecore Content Hub
Introduction
Sitecore Content Hub allows to export of its entities into an Excel spreadsheet, which is super helpful in various migration scenarios when Content Hub content needs to be transferred to another system.
This documentation article describes the process of selecting and importing content items, such as Assets, into an Excel spreadsheet.
However, there is a limit of 2000 items for selection, which can be problematic when exporting larger sets. Additionally, this approach requires the necessary UI components to be set up, which may require some development work, even if it is a no-code kind of effort.
I would like to share an easy way to export any number of entities of any kind. This involves the following steps:
- Extend the Content Hub export profile (refer to this post for details on extending the Content Hub export profile)
- Authenticate with Content Hub
- Update the JSON request body of the POST request below and send it to your Content Hub instance
- Give Content Hub time to process the export job created by this request. It may take hours to process. Content Hub displays the progress of all running jobs for a given user at
[your instance]/user/myjobs
, which can be accessed from the profile menu on the top right. - Once processing is done, download the resulting file.
Postman requests
Authenticate with Content Hub
See this documentation article for details on obtaining the access token from Content Hub
Create Download Request
Update the below request as needed.
- the
query
contains search/filtering criteria for which entities to be included. In this case, I m requesting download of all assets request_uri
is the host URL of your Content Hub instancefilename
is the name of the file to create, less file extension (it ll be an Excel file)userFriendlyColumnHeaders
, when set totrue
, will result in field display names to be put in the Excel column headers, and whenfalse
then the raw field names will be useduserFriendlyCellValues
, I usually set this tofalse
to avoid Excel changing values to make them look more human-friendly
URL: https://{{hostname}}/api/commands/portal/download.excel
Headers: X-Auth-Token: CH token
Body:
{
"query": "Definition.Name=='M.Asset'",
"cultures": [
"en-US"
],
"type": "Data",
"request_uri": "https://your-instance.sitecorecontenthub.cloud/",
"filename": "M.Asset.export",
"userFriendlyColumnHeaders": true,
"userFriendlyCellValues": false
}