SUNRISE sample data

Import sample data to your Project

Warning icon

Installing this sample data removes all existing data from your Project. Do not run it in a non-test Project.

When Projects are created, they are completely empty by default. To add sample data to your Project, you can import the SUNRISE dataExternal link icon.

SUNRISE data includes Products, Categories, Customers, and other demonstration data that can assist developers and Merchant Center users with learning how commercetools Composable Commerce works.

Requirements

Importing the SUNRISE data requires you to create an API Client with commercetools Composable Commerce and a small import app that you can clone and build from GitHub.

Node.jsExternal link icon must be installed to set up and run the import app.

Installation guide

Below are two guides: one suitable for developers and the other for non-developers. Following either guide will import the same SUNRISE data to your Project.

Developer guide

  1. Clone the SUNRISE data Git repository:
    https://github.com/commercetools/commercetools-SUNRISE-data.git
    This creates a folder named commercetools-SUNRISE-data.
  2. Follow the instructions in our Getting started guide to create an API Client and download your environment variables (.env) file.
  3. Copy your .env file into commercetools-SUNRISE-data. The contents of the commercetools-sunrise-data folder in Visual Studio Code
  4. Open commercetools-SUNRISE-data in your terminal and use the command npm install to install required dependencies.
  5. Use the command npm run start to start importing the SUNRISE data.

Non-developer guide

  1. Install Node.jsExternal link icon on your computer.
  2. Go to the SUNRISE data GitHub pageExternal link icon and click Code > Download ZIP. This downloads a file named commercetools-sunrise-data-master.zip. Download the zip file from the GitHub repository
  3. Extract the folder commercetools-sunrise-data-master from this file.
  4. Follow the instructions in our Getting started guide to create an API Client and download your environment variables (.env) file.
  5. Copy your .env file into commercetools-sunrise-data-master. The .env file in the folder commercetools-sunrise-data-master
  6. Open commercetools-sunrise-data-master in your terminal.
Information icon

If you are using Windows, open commercetools-sunrise-data-master and click File > Open Windows PowerShell. Opening the folder in Windows PowerShell

If you are using macOS: right click the commercetools-sunrise-data-master folder and select New Terminal at Folder. Opening the folder in macOS Terminal

  1. In your terminal, use the command npm install. This installs software and plugins required for the import app to run (also known as "dependencies").
Information icon

If you receive the error npm: command not found or npm : The term 'npm' is not recognized as the name of a cmdlet, function, script file, or operable program. then Node.js is not installed on your computer.

  1. Use the command npm run start. This runs the import app and starts importing the SUNRISE data.

Accessing your SUNRISE data

While the import app is running you can view the import progress in the terminal.

You do not have to wait for the process to complete before viewing the data in your Project. You can continue using the Merchant Center as normal during this time.

Once finished, you will have a complete sample data set ready to use.

A screenshot of a full Product list

More information

Further information for the SUNRISE data and extra commands for the import app can be found at GitHubExternal link icon.

How to handle the "A value is required for field 'baseId'." error when creating Products

After installing the SUNRISE data you may receive the following error when creating a Product:

{
"statusCode": 400,
"message": "A value is required for field 'baseId'.",
"errors": [
{
"code": "RequiredField",
"message": "A value is required for field 'baseId'.",
"field": "baseId"
}
]
}
Clipboard icon

SUNRISE data includes a ProductType named main with the required Attribute baseId. This error is returned if a value for baseId is not included with your ProductDraft.

Within the context of an example data set, baseId can reference an external identifier for a Product. For example if Product information is stored/referenced in another system or database.

To handle this error, use one of the following actions.

Include a baseId value with your ProductDraft

This example ProductDraft demonstrates how to include a value for baseId. Ensure that you change the highlighted Product Type id and Attribute value.

{
"name": {
"de": "German language product name",
"en": "English language product name"
},
"productType": {
"id": "Replace with your ProductType id"
},
"slug": {
"de": "german-language-slug",
"en": "english-language-slug"
},
"masterVariant": {
"attributes": [
{
"name": "baseId",
"value": "Enter a value here"
}
]
}
}
Clipboard icon

Remove the baseId Attribute

If you have no need for the baseId Attribute it can be removed using the API or in the Merchant Center.

Using the API

Attributes are removed using the Remove AttributeDefinition update action. The following example cURL command removes the baseId Attribute from a specified Product Type.

Information icon

Replace {region}, {projectKey}, and {productTypeID} with your Project's values and ${BEARER_TOKEN} with your access token.

curl -X POST https://api.{region}.commercetools.com/{projectKey}/product-types/{productTypeID} -H "Authorization: Bearer ${BEARER_TOKEN}" --data '{ "version": 1, "actions": [ { "action": "removeAttributeDefinition", "name": "baseId" } ] }'
Clipboard icon

Using the Merchant Center

  1. Open the Merchant Center.
  2. Go to Settings > Product types and attributes > main.
  3. Click the delete icon on the baseId row. A screenshot of how to delete baseId