Een vertaling maken
Create a translation using exactly one source: JSON content for verbatim UTF-8 text, JSON file_url for an HTTPS download without redirects, JSON upload_id for a completed temporary upload on this same credential, or multipart/form-data with a file field for local binary bytes. Omit filename with upload_id; the session already owns its name. Repeating an upload_id returns the existing batch without changing its instruction. Otherwise filename is optional and inferred if absent. Include instruction to receive the verified plan, measured counts, credit cost and extraction preview; omit it to receive suggested_instructions. Check plan.not_included before approval. Creating and planning cost no credits. Per-format limits are on GET /v1/account. The translation appears in the web app.
POST/v1/batches
Vereist batches:create. Een vertaling maken kost niets: er worden pas credits gereserveerd wanneer je een plan goedkeurt.
Kies hoe je het bestand verstuurt
Kies de verzendmethode die past bij de opslaglocatie van het document en de mogelijkheden van je client.
| Transport | Geschikt voor | Opmerkingen |
|---|---|---|
JSON met upload_id | Een lokaal bestand dat via een tijdelijke uploadsessie is verstuurd | Gebruik dezelfde inloggegevens als voor het aanmaken van de sessie. Laat filename weg. Als je de vertaling opnieuw aanmaakt, krijg je de bestaande vertaling terug zonder dat de instructie verandert. |
JSON met content | Alle tekstformaten | De bestandsinhoud zelf, als UTF-8-tekst. De eenvoudigste optie voor een agent die de inhoud al in het geheugen heeft. |
JSON met file_url | Een bestand dat al online staat | Alleen HTTPS; het bestand wordt aan de serverzijde opgehaald. Omleidingen worden niet gevolgd, dus geef de uiteindelijke URL op. |
multipart/form-data | Lokale binaire bestanden, waaronder XLSX, DOCX, PPTX, PDF, IDML en ZIP | Verstuur de oorspronkelijke bytes in het veld file. Dit is de methode waarmee de CLI lokale bestanden verstuurt. |
filename is optioneel, maar wel handig om mee te sturen. De extensie bepaalt hoe het formaat wordt herkend. Zo worden identieke bytes anders verwerkt wanneer de bestandsnaam strings.xml is dan wanneer die export.csv is.
Wat gebeurt er daarna?
Het antwoord bevat een id, dat je in volgende paden gebruikt als batch_id. Daarna volg je altijd dezelfde stappen:
POST /v1/batches/{batch_id}/plan: beschrijf in je eigen woorden wat er vertaald moet worden.POST /v1/batches/{batch_id}/approve: gebruik credits en start de vertaling.GET /v1/batches/{batch_id}: vraag de status op tot de vertaling klaar is.GET /v1/batches/{batch_id}/result: haal het resultaat op. Je krijgt een ondertekende link, niet het bestand zelf.
Antwoord
Create a translation from a file
dataobjectrequiredrequest_idstringrequiredPossible codes: invalid_request, unknown_field, invalid_parameter, invalid_cursor
errorobjectrequiredrequest_idstringrequiredPossible codes: authentication_required, invalid_api_key, api_key_expired, api_key_revoked
errorobjectrequiredrequest_idstringrequiredPossible codes: insufficient_credits
errorobjectrequiredrequest_idstringrequiredPossible codes: insufficient_scope, feature_not_available, admin_required, file_retention_expired
errorobjectrequiredrequest_idstringrequiredPossible codes: batch_not_found, glossary_not_found, resource_not_found
errorobjectrequiredrequest_idstringrequiredPossible codes: glossary_already_exists, result_not_ready, batch_not_editable, no_plan_yet, plan_changed, batch_not_awaiting_approval
errorobjectrequiredrequest_idstringrequiredPossible codes: file_expired
errorobjectrequiredrequest_idstringrequiredPossible codes: request_too_large, file_too_large, result_too_large
errorobjectrequiredrequest_idstringrequiredPossible codes: language_not_supported, invalid_language_pair, glossary_term_limit_reached, glossary_limit_reached, invalid_glossary_terms, unsupported_format, file_fetch_failed, plan_invalid
errorobjectrequiredrequest_idstringrequiredPossible codes: rate_limited
errorobjectrequiredrequest_idstringrequiredPossible codes: internal_error
errorobjectrequiredrequest_idstringrequiredPossible codes: service_unavailable
errorobjectrequiredrequest_idstringrequired