Closed fllprbt closed 11 months ago
Hi @fllprbt, it appears Files API doc is wrong about having zipFileName
query parameter for download all translations
endpoint. We will fix the doc.
This param should be removed from the DownloadFileAllTranslationsParameters
. If you try to download without that param api will respond with application/zip;charset=UTF-8
response like:
curl --location 'https://api.smartling.com/files-api/v2/projects/<projectId>/locales/all/file/zip?fileUri=<fileName>.<fileExtension>' \
--header 'Authorization: Bearer ...'
PK��� nW���������������zh-CN/<fileName>.<fileExtension>��<?xml version="1.0" encoding="UTF-8"?>
<zh-CN file content here>
PKg�������PK��� nW���������������da-DK/<fileName>.<fileExtension>��<?xml version="1.0" encoding="UTF-8"?>
<da-DK file content here>
...
And then you probably can save it as you need (didn't dig deeper, I just checked this sdk method returns exactly the same content as curl/postman call)
Is writing non-raw responses supported atm?
For now, it supports receiving raw response body as response.text()
or parsed dtos from response json.
Hi All,
I didn't review the PR, but the zip
word caught my attention. I strongly recommend not using zip in integrations. Because TMS must prepare all translated files before actual download, downloading a zip file may increase response time. When the user interacts with TMS, using zip makes sense. However, for automation, robustness is the top priority. Tens of short HTTP requests (with predictable response time) are preferable to one request when response time can range from seconds to minutes.
P.S. @conall-smartling for visibility. There are a couple of related tickets #89, #92.
Hi @fllprbt, it appears Files API doc is wrong about having
zipFileName
query parameter fordownload all translations
endpoint. We will fix the doc.This param should be removed from the
DownloadFileAllTranslationsParameters
. If you try to download without that param api will respond withapplication/zip;charset=UTF-8
response like:curl --location 'https://api.smartling.com/files-api/v2/projects/<projectId>/locales/all/file/zip?fileUri=<fileName>.<fileExtension>' \ --header 'Authorization: Bearer ...' PK��������� nW����������������zh-CN/<fileName>.<fileExtension>�����<?xml version="1.0" encoding="UTF-8"?>se <zh-CN file content here> PK��g�����������PK��������� nW����������������da-DK/<fileName>.<fileExtension>�����<?xml version="1.0" encoding="UTF-8"?> <da-DK file content here> ...
And then you probably can save it as you need (didn't dig wdeeper, I just checked this sdk method returns exactly the same content as curl/postman
Right, i also had such glyphs back when i had tested it; had tried to parse it then as zip and failed but did not investigate it much...
@PavelLoparev could you review this MR please? Added also the list batches helper
done!
@fllprbt Sorry overlooked one thing. The list batches endpoint also receives query parameters. As I see list batches method only receives project id so it's not possible to get all the batches without pagination for now. I think parameters class with available pagination parameters and filters should be added.
Done.
Btw we would like eventually have something similar here: https://github.com/Smartling/api-sdk-nodejs/blob/master/api/jobs/index.ts#L57C63-L57C85
Since a params object can be passed, does it mean that we can use params.set
to set these manually in case the specific helpers do not exist?
Done.
Btw we would like eventually have something similar here: https://github.com/Smartling/api-sdk-nodejs/blob/master/api/jobs/index.ts#L57C63-L57C85
Since a params object can be passed, does it mean that we can use
params.set
to set these manually in case the specific helpers do not exist?
yes, you can use .set()
method but I would prefer to just to add anything that is missing/needed for you through the PRs.
2.4.0
is released
Hi, the setCallbackUrl
method was added without setCallBackMethod
that is mandatory otherwise an error occurs.
https://api-reference.smartling.com/#tag/Jobs/operation/addJob
Hi, the
setCallbackUrl
method was added withoutsetCallBackMethod
that is mandatory otherwise an error occurs. https://api-reference.smartling.com/#tag/Jobs/operation/addJob
Sorry, missed that from docs. Can fix myself this Friday if no anyone else does
Hi, the
setCallbackUrl
method was added withoutsetCallBackMethod
that is mandatory otherwise an error occurs. https://api-reference.smartling.com/#tag/Jobs/operation/addJobSorry, missed that from docs. Can fix myself this Friday if no anyone else does
I can do it but i'm stucked here https://github.com/Smartling/api-sdk-nodejs/issues/95
This is going to be addressed in https://github.com/Smartling/api-sdk-nodejs/pull/100
As for downloading zip: https://github.com/Smartling/api-sdk-nodejs/pull/117
@PavelLoparev regarding commit #2 (change endpoint to download all files translations): Even after the fix, I did not manage to write a
.zip
to my filesystem although I did not dig much into the code. Is writing non-raw responses supported atm? If not, do you have any plan of working on it in the near future?For now, I consider it out of this MR's scope (no time) and will fetch translations separately by locales.
Let me know, thanks!