PATCH /v2/translations/:id
Update a translation
PUT /v2/translations/:id
Update a translation
live_help Notes
assignment
This action requires one of theses roles:
Translater
settings Params
Param name | Description |
---|---|
id |
required
. Must be String
The requested id |
translation | optional , nil allowed . Must be a Hash |
translation[id] |
optional
, nil allowed
. Must be Fixnum
The id. |
translation[translatable_id] |
optional
. Must be Fixnum
The translatable id. |
translation[translatable_type] |
optional
, nil allowed
. Must be String
The translatable type. |
translation[language_id] |
optional
. Must be Fixnum
The language id. Must be unique in the scope of a given translatable type and translatable. |
translation[fields] |
optional
. Must be String
The fields. |
translation[created_at] |
optional
, nil allowed
. Must be DateTime
The created at. |
translation[updated_at] |
optional
, nil allowed
. Must be DateTime
The updated at. |
translation[user_id] |
optional
, nil allowed
. Must be Fixnum
The user id. |
translation[default] |
optional
, nil allowed
. Must be one of: true , false .
Is it default ? Default to false. |
translation[up_to_date] |
optional
, nil allowed
. Must be one of: true , false .
Is it up to date ? Default to true. |
translation[translations_structure_id] |
optional
, nil allowed
. Must be Fixnum
The translations structure id. |
translation[file] |
optional
, nil allowed
. Must be String
The file. |
Examples
PUT /v2/translations/3
{
"translation": {
"fields": "{\"description\":\"You passed the Piscine test. Welcome to 42!\"}",
"language_id": "1",
"translatable_id": "1",
"translatable_type": "Achievement"
}
}
204
curl -X PUT -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"translation":{"fields":"{\"description\":\"You passed the Piscine test. Welcome to 42!\"}","language_id":"1","translatable_id":"1","translatable_type":"Achievement"}}' "https://api.intra.42.fr/v2/translations/3"
require "oauth2"
UID = "Your application uid"
SECRET = "Your application secret"
client = OAuth2::Client.new(UID, SECRET, site: "https://api.intra.42.fr")
token = client.client_credentials.get_token
params = {translation: {fields: "{"description":"You passed the Piscine test. Welcome to 42!"}", language_id: "1", translatable_id: "1", translatable_type: "Achievement"}}
response = token.put("/v2/translations/3", params: params)
response.status
# => 204
response.parsed
# =>