SUNRISE sample data

Import sample data to your Project

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

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

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

Requirements

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

Node.js 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 commercetools 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.js on your computer.
  2. Go to the SUNRISE data GitHub page 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.

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").

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 GitHub.

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"
}
]
}

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"
}
]
}
}

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.

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" } ] }'

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
Developer Center
HTTP APIGraphQL APIPlatform Release NotesCustom ApplicationsBETASDKs & Client LibrariesImport & ExportSUNRISE Starter FrontendsTutorialsFAQ
Merchant Center
DocumentationRelease Notes
Sign upLog inTech BlogIntegrationsStatusSupportUser Research Program
Copyright © 2022 commercetools
Privacy PolicyImprint