Get custom field options or ticket fields translations
Hi, I'm struggling with the api to understand how to achieve the following : I'd like to have access, with the api, to the translations agents created for all my fields and all custom options set.
Basically I'm manipulating ticket_fields I do receive from a ticket_form request.
{
"id": 123456789,
"type": "tagger",
"raw_title": "My fancy title in english",
"custom_field_options": [
{
"id": 987654321,
"name": "Some value::in english",
"raw_name": "{{dc.some_value}}::{{dc.in_english}}"
}
]
}
I don't understand how my ticket_field_id (123456789) is linked to what I receive from /api/v2/dynamic_content/items. Is there a way to easily find the associated translation for this title ?
Same question for the custom field options, I know they are present in the dynamic_content/items results, but I couldn't find a handy way to get those.
In short, ticket_field have their ids, and dynamic_content other ids, but nothing seems to exist in order to make them match. Or I'm missing someting...
Any help appreciated, thanks.
-
Hi Maxime Lagache,
To show a single item from /api/v2/dynamic_content/items, you need its integer id. Obviously, you do not get that from the custom field endpoint. You will only get the placeholder.
However, you can utilise the /api/v2/dynamic_content/items/show_many endpoint and query using identifiers instead of the item's integer id. The documentation is a bit vague about what identifiers are, but when I tested, it seems to be the unique part of the placeholder: {{dc.<identifier>}}
You will need to parse the raw_name for each option and use regex match to extract the identifier(s).
Hope that helps.
-
Hi Maxime,
The placeholders you referenced (some_value
,in_english
, etc) are the dynamic content item names. The translation-specific content tied to those items are dynamic content item variants. The variants can be retrieved via API. We have a full breakdown of this data structure in our Dynamic Content API docs.
Please sign in to leave a comment.
2 Comments