Step 1. Submit the AI Job request
Endpoint: POST - /api/v1/content/translate
Attribute |
Type |
Mandatory |
Description |
content |
String |
Yes |
Provide the content to translate. |
language |
String |
No |
Specify the language of the content which needs to be translated. Eg. 'German' |
voice_tone |
String |
No |
Specify the voice tone of the output. It can be adjectives like funny or joyous , or even the name of a famous writer . |
context |
String |
No |
Provide additional context to the translated text, such as use case examples or additional explanations. |
REQUEST EXAMPLE:
{
"content": "La montée du niveau de la mer menace d'engloutir les Maldives où l'eau douce commence déjà à manquer, mais le nouveau président de l'archipel de l'océan Indien refuse toute relocalisation de sa population à l'étranger. Dans un entretien à l'AFP, le président Mohamed Muizzu, un ingénieur du génie civil de 45 ans, formé au Royaume-Uni, promet au contraire un ambitieux programme de réhabilitation des terres et de surélévation des îles, que critiquent des organisations environnementales.",
"language": "English",
"voice_tone": "neutral",
"context": null
}
RESPONSE EXAMPLE:
{
"status_url": "https://sharpapi.com/api/v1/content/translate/job/status/5de4887a-0dfd-49b6-8edb-9280e468c210",
"job_id": "5de4887a-0dfd-49b6-8edb-9280e468c210"
}
Step 2. Monitor & Fetch AI Job Results
Endpoint: GET - /api/v1/content/translate/job/status/:uuid
An endpoint is used to check on the progress of the requested API job.
RESULT EXAMPLE:
{
"data": {
"type": "api_job_result",
"id": "5de4887a-0dfd-49b6-8edb-9280e468c210",
"attributes": {
"status": "success",
"type": "content_translate",
"result": {
"content": "The rise in sea levels threatens to engulf the Maldives where fresh water is already starting to run out, but the new president of the Indian Ocean archipelago refuses any relocation of its population abroad. In an interview with AFP, President Mohamed Muizzu, a 45-year-old civil engineering graduate trained in the United Kingdom, instead promises an ambitious program of land rehabilitation and island elevation, which environmental organizations criticize.",
"to_language": "English",
"from_language": "French"
}
}
}
}