REST API - Examples using the translation resource

Introduction

In this article you can read more about using the translation resource. The following part will show you examples including provided data and data you need to provide if you want to use this resource. Please read the page covering the translation API resource if you did not yet, to get more information about the translation resource and the data it provides.

Example 1 - Creating a new translation

This example shows how to create a new article translation

POST /api/translations
{
    "key": 200,
    "type": "article",
    "shopId": 2,
    "data": {
        "name": "Dummy translation",
        "__attribute_attr1": "Dummy attribute translation"
    }
}

Example 2 - Updating a translation

PUT /api/translations/200
{
    "type": "article",
    "shopId": 2,
    "data": {
        "name": "Dummy translation",
        "__attribute_attr1": "Dummy attribute translation"
    }
}

Example 3 - Creating a property group translation

POST /api/translations
{
    "key": 6,
    "type": "propertygroup",
    "shopId": 2,
    "data": {
        "groupName": "Dummy translation"
    }
}

Example 4 - Updating a property group translation

POST /api/translations/6
{
    "type": "propertygroup",
    "shopId": 2,
    "data": {
        "groupName": "Dummy translation edited"
    }
}

Example 5 - Creating a property option translation

POST /api/translations
{
    "key": 1,
    "type": "propertyoption",
    "shopId": 2,
    "data": {
        "optionName": "Dummy translation"
    }
}

Example 6 - Updating a property option translation

POST /api/translations/1
{
    "type": "propertyoption",
    "shopId": 2,
    "data": {
        "optionName": "Dummy translation edited"
    }
}

Example 7 - Creating a property value translation

POST /api/translations
{
    "key": 166,
    "type": "propertyvalue",
    "shopId": 2,
    "data": {
        "optionValue": "Dummy translation"
    }
}

Example 8 - Updating a property value translation

POST /api/translations/166
{
    "type": "propertyvalue",
    "shopId": 2,
    "data": {
        "optionValue": "Dummy translation edited"
    }
}

Example 9 - Updating multiple translations (batch mode)

PUT /api/translations
[
    {
        "key": 177,
        "type": "propertyvalue",
        "shopId": 2,
        "data": {
            "optionValue": "Dummy translation edited"
        }
    },
    {
        "key": 178,
        "type": "propertyvalue",
        "shopId": 2,
        "data": {
            "optionValue": "Another dummy translation edited"
        }
    }
]
Top