Endpoint
https://api.platform.easytranslate.com/strings-library/api/v1/teams/:team-name/libraries/:library-id/keys
In order to add a new translation key, you need to send a POST request.
You can use this endpoint to add new keys and its default translations from the source language. Even if the default translation can be left empty, it is recommended to have a default translation defined.
access token as its value.
Then, you need to add the following variables' values to your endpoint path:
-
- team_name:{{TEAM_NAME}}
Instead of {{TEAM_NAME}}, you need to provide the team_name of your team. It can be retrieved from the api/v1/user endpoint. -
library-id: {{LIBRARY_ID}}Instead of {{LIBRARY_ID}}, you need to provide the library_id of the library you wish to update by adding a new language.
- team_name:{{TEAM_NAME}}
Finally, you have to pass the following data in the body of your request:
{
"data": {
"type": "translation-key",
"attributes": {
"keys": [
{
"name": "your_title",
"text": "Mando"
},
{
"name": "your_squard",
"text": "The guild team"
}
]
}
}
}
-
- type: The value of this attribute needs to be set to "translation-key"
- keys: This attribute is an array, meaning you can add as many new keys as you need, you simply create a new object for each key you want to add.
- name: This attribute's value should be the name you wish to use for your new key.
- text: This value should be the default translation from your source language.
Request example
curl --location -g --request POST 'https://api.platform.easytranslate.com/strings-library/api/v1/teams/{{TEAM_NAME}}/libraries/{{LIBRARY_ID}}/keys' \ --data-raw '{ "data": { "type": "translation-key", "attributes": { "name": "weather.status", "text": "Your weather status of today" } } }'
Response example
{
"data": [
{
"type": "key",
"id": "614b109cedec011e42133db2",
"attributes": {
"name": "weather.status",
"library_id": "614b0fe15947196962726dd2",
"translations": [
{
"type": "string",
"id": "614b109cedec011e42133db3",
"attributes": {
"text": null,
"status": "pending",
"language_code": "de"
}
},
{
"type": "string",
"id": "614b109cedec011e42133db4",
"attributes": {
"text": null,
"status": "pending",
"language_code": "da"
}
},
{
"type": "string",
"id": "614b109cedec011e42133db5",
"attributes": {
"text": "Your weather status of today",
"status": "translated",
"language_code": "en"
}
}
],
"created_at": {
"date": "2021-09-22 11:16:44.145000",
"timezone_type": 1,
"timezone": "+00:00"
},
"modified_at": {
"date": "2021-09-22 11:16:44.145000",
"timezone_type": 1,
"timezone": "+00:00"
}
}
}
],
"meta": {
"copyright": "Copyright 2021 EasyTranslate A/S",
"environment": "testing"
}
}