Paso 1. Enviar la solicitud de trabajo de IA
Punto final: POST - /api/v1/content/translate
| Atributo |
Tipo |
Obligatorio |
Descripción |
| contenido |
String |
Sí |
Proporciona el contenido a traducir. |
| idioma |
String |
No |
Especifica el idioma del contenido que necesita ser traducido. Ej. 'Alemán' |
| tono_voz |
String |
No |
Especifica el tono de voz de la salida. Puede ser adjetivos como divertido o alegre, o incluso el nombre de un escritor famoso. |
| contexto |
String |
No |
Proporciona contexto adicional al texto traducido, como ejemplos de uso o explicaciones adicionales. |
EJEMPLO DE SOLICITUD:
{
"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
}
EJEMPLO DE RESPUESTA:
{
"status_url": "https://sharpapi.com/api/v1/content/translate/job/status/5de4887a-0dfd-49b6-8edb-9280e468c210",
"job_id": "5de4887a-0dfd-49b6-8edb-9280e468c210"
}```
---
## Paso 2. Monitorear y obtener resultados del trabajo de IA
**Punto final:** `GET - /api/v1/content/translate/job/status/:uuid`
Un punto final se utiliza para verificar el progreso del trabajo de API solicitado.
**EJEMPLO DE RESULTADO:**
```json
{
"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"
}
}
}
}
``