Hello,
On our project, we are using Transifex API and recently did a migration from Transifex v2 to Transifex v3. The main change in Transifex downloading API in v3 is that the download action became asynchronous (whereas in APIv2 this was done synchronously). In V2 it was possible to download a resource file with just one single request from the Transifex endpoint.
In V3 it is required to have at least 3 requests with the implementation of a polling mechanism to check the “download” status. The final URL is received in “Location” header from 303 response:
Documentation - link
In case the upload job has been successful, you will receive a "303 - See Other" response and you can follow its Location to download the file that have been extracted from your file.
In our project in order to enable translations downloading during Continue Integration (CI) phase we need to whitelist the domains for requests. In v2 it was possible to whitelist the transifex domain. But in v3 the final URL is received from redirect URL so it can change dynamically.
Currently translations are downloaded from https://storage.svc.transifex.net.. Could you please advise on the following questions:
- Is this endpoint stable for translations source, so we can whitelist it to enable translations downloading?
- If this endpoint is dynamic: is there any pattern for translations source endpoint? For example, we can check if the endpoint URL includes the “transifex.net” substring.
Thanks for the support,
Best regards,
Tatsiana Helakhava
2 Likes
Hello Tatsiana,
Thank you for writing us,
Answering your questions (1) The URL structure will always be https://rest.api.transifex.com/resource_translations_async_downloads/{resource_translations_async_download_id}, where the last part of the URL {resource_translations_async_download_id} will a variable that contains the ID of the translation file download job, (2) this ID is a UUID, and its pattern will always be
^([0-9a-f]{32}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$
Also, I noticed you mentioned in V3 you need to have at least three requests to check the “download” status; you also have the option of setting a callback_url when you create the translation download action, this callback_URL will be called when the processing is completed, the notification you’ll get in this URL will be something like the following:
{
"data": {
"type": "resource_translations_async_downloads",
"id": "814ea826-c0a1-46fa-8c2f-837e22e28615",
"attributes": {
"location": "https://rest.api.transifex.com/resource_translations_async_downloads/814ea826-c0a1-46fa-8c2f-837e22e28615",
"status": "succeeded"
}
}
}
This way, you will not need to check the download status, and you will just wait to be notified that the download action is done.
I hope you find this answer helpful; let me know if you need anything else; I’m happy to help
Hi Sandy_DLR,
Sorry for the late reply.
Thanks a lot for looking into this question! Let me please add some details:
The URL structure will always be https://rest.api.transifex.com/resource_translations_async_downloads/{resource_translations_async_download_id} ,
This is the first request for the transifex URL that needs to be performed to start download action. But we also need to whitelist the final URL for the translation which we receive in the Location response header.
This URL can be dynamically changed, so in order to correctly whitelist the domain for the translation source we need to understand these points described in the initial question:
Currently translations are downloaded from https://storage.svc.transifex.net . . Could you please advise on the following questions:
- Is this endpoint stable for translations source, so we can whitelist it to enable translations downloading?
- If this endpoint is dynamic: is there any pattern for translations source endpoint? For example, we can check if the endpoint URL includes the “transifex.net” substring.
Thanks for your support!
1 Like
Hello Tatsiana_Helakhava,
Sorry for the confusion; Now answering your questions about the final translation download domain: https://storage.svc.transifex.net/; this is a stable URL; feel free to whitelist it.
Hi @Sandy_DLR ,
Thanks a lot for the confirmation and support with this question,
Best regards,
Tatsiana Helakhava
1 Like