Skip to content
This repository was archived by the owner on Aug 27, 2024. It is now read-only.

Development | Change store attributes

Paul Boeck edited this page Apr 8, 2020 · 3 revisions

How to alter custom types

Go to IMPEX (via Mercant Center) to the API Playground.

Create a custom type

Impex: Endpoint Types, Command Create

Payload (See https://docs.commercetools.com/http-api-projects-types#typedraft):

{
    "key": "channel-neighborhoods",
    "name": {
        "de-de": "Channel mit Kiezen",
        "en-us": "Channel with Neighborhoods"
    },
    "resourceTypeIds": [
        "channel" // what Objects should be using this custom type
    ],
    "fieldDefinitions": [
        // list of field definitions
    ]
}

Example field definitions

[{
    "type": {
        "name": "Set",
        "elementType": {
            "name": "String"
        }
    },
    "name": "neighborhood",
    "required": false,
    "label": {
        "de": "Kiez",
        "en": "Neighborhood"
    },
    "inputHint": "SingleLine"
},{
    "type": {
        "name": "String"
    },
    "name": "profileImageURL",
    "required": false,
    "label": {
        "de": "Profilbild",
        "en": "Profile picture"
    },
    "inputHint": "SingleLine"
}]

Update a custom type

Impex: Endpoint Types, Command Update, Ressource ID (Get by querying previous channels)

Payload (See https://docs.commercetools.com/http-api-projects-types#typedraft):

{
    "version": 6, // must match latest version. query channel
    "actions": [
        {
            "action": "addFieldDefinition",
            "fieldDefinition": {
                //..
            }
        },
        {
            "action": "addFieldDefinition",
            "fieldDefinition": {
                // ..
        }
    ]
}