Hello everybody,
I have tried to use API translation as advised by Shopware documentation (using localId).
- devdocs/index.md at master · shopware/devdocs · GitHub
- http://community.shopware.com/Shopware-4.2-Upgrade-Guide-fuer-Entwickler_detail_1436_454.html
- http://community.shopware.com/REST-API-Translation-Endpoint_detail_1704.html
- REST API - Translations Resource
To obtain the desired effect shopId should be used instead of localId.
Do you have experienced the same problem?
Or is it something due to the Shopware 5.1.1 installation on managed hosting?
I have searched inside http://forum.shopware.com/discussion/17396/rest-api-uebersetzungen but I didn’t find anything useful to me.
I have created a new thread because the link above is about Shopware 4.
localId is used as advised
if($method == 'post') {
// single test
$client->post('translations',
array( 'key' => 489,
'type' => 'article',
'localeId' => 136,
'data' => array(
'name' => 'Italian Dummy translation',)));
$client->get('translations');
}
Post (usling localId)
$client->put('translations/489',
array(
'Key' => '489',
'type' => 'article',
'localeId' => 136,
'data' => array(
'name' => 'Italian Dummy translation modified',)));
$client->get('translations');
PUT (using localId)
If it is used as explained in the links above (using localId) , API translations do not actually work.
They return as answer HTTP 200 and HTTP 201 but nothing is changed (200) or created (201) in the article translations.
POST
HTTP: 201
Success
Array
(
[id] = 25
[location] = http://mirifica.de/workingSW5/api/translations/25
)
-----
PUT
HTTP: 200
Success
Array
(
[id] = 26
[location] = http://mirifica.de/workingSW5/api/translations/26
)
The creation/change are happenning inside the s_articles_translations database’s table but they are not actually integrated within Shopware.
- Changes/creations are visible
- inside s_articles_translations database’s table
- Changes/creations are NOT visible
- in the Shopware backend or
- inside JSON answer/reply to REST API GET Translation.
shopId is used insted od locaId
if($method == 'post') {
// single test
$client->post('translations',
array( 'key' => 489,
'type' => 'article',
'shopId' => 5,
'data' => array(
'name' => 'Italian Dummy translation',)));
$client->get('translations');
}
POST (using shopId)
if($method == 'put') {
// single test
$client->put('translations/489',
array(
'Key' => '489',
'type' => 'article',
'shopId' => 5,
'data' => array(
'name' => 'Italian Dummy translation modified',)));
$client->get('translations');
}
PUT (using ShopId)
If shopId is used instead of localId, API translations do actually work.
They return exactly the same answer HTTP 200 and HTTP 201 as before.
POST
HTTP: 201
Success
Array
(
[id] = 27
[location] = http://mirifica.de/workingSW5/api/translations/27
)
-----
PUT
HTTP: 200
Success
Array
(
[id] = 28
[location] = http://mirifica.de/workingSW5/api/translations/28
)
The creation/change are happenning inside the s_articles_translations database’s table AND they are actually integrated within Shopware.
- Changes/creations are visible
- inside s_articles_translations database’s table
- Changes/creations are ALSO visible
- in the Shopware backend or
- inside JSON answer/reply to REST API GET Translation.