Hello,
Good day,
Steps(OS reactive):
1. I have uploaded a PNG image to the server.
2. And I'm trying to get that image via API(not exposed from OutSystems).
3. Passing Document id and getting "text" response with "Application/Octet-stream" content type.
4. The API response is like this,
5. I've tried to convert this text to binary and tried to download it.
6. I can able to download it with the same size(just 2kb) which I've uploaded.
7. But when i trying to open that, I couldn't and showing the below popup,
8. Note: This issue is not only for PNG, This is for all like PDF,XLSX,PPT,...
9. And even i've tried in JS way as well,
But, even i'm getting the same issue, i couldn't open those files.
Note : This is the 3rd party API, and It is working as expected in .Net, i'm facing this issue only on OS.
Anyone has any idea about it?
Thanks in advance.
Kind regards,
Stuart
Hello Stuart,
As you told, API's return data type is "Text" and that's why i've converted that from text to Binary. But now i've tried this too while assigning,
But this time also i'm getting same, i can able to download the file but can't read/view the file.
What should i do now.
Tried:
1. Did "TextToBinary"
2. Did "TextToBinarydata" while variable assignment.
3. Passed text upto the client action and played with JS Blob as well, but that time file size increased and even i cant view/read it.
Any idea.
Hi @thanigaiarasu arumugam,
try to get the external address for the image from the 3rd party API, as we use into the image widget for external link
Hope this helps
Thanks
Prince
Hello Prince,
External url(Physical path) is not good here, because folder name can be change often. That's why we are trying to hit an API.
Thanks.
Hello thanigaiarasu,
I was looking at your explanation of the problem and a possible cause of not being able to access the binary of the images may have to do with the server sending the compressed package. It is a very common practice in APIs.
I suggest you visit the GZIP test page https://ruihmendes.outsystemscloud.com/Gzip/ this component allows you to decompress the package to access its content.
After confirming that it works in your case, you can install it on your server and mark it here on the forum as a solution for other members with similar problems to also find the solution.
Regards,
Hello Rui Mendes,
It's just 2KB file, even i can't able to view it. The problem is i can download the file with the same size, but can't view it.
Thank you
Hi thanigaiarasu arumugam
Can that text be provided in base64 format?
try this action
https://success.outsystems.com/documentation/11/reference/outsystems_apis/binarydata_api/
Base64ToBinary
Converts Base64 Text into BinaryData.
Inputs
Base64Type: Text. Mandatory.
Base64 Text to convert to BinaryData.
Outputs
BinaryType: BinaryData.
Result of conversion from Base64 Text to BinaryData.
Hope that it helps you
Hello Alexandre Yip,
I've tried this "Base64 to Binary" as well. But this time i got an error like "this is not the base64 content". so it seams like the API response is not the base64 but the response's data type is text only. That's why i did text to binary. But unfortunately i can download the file with same size but cant read/view it.
I understand the response is set as Text, however according to the content type it is not text, it is binary. So there is no need to convert it from text to binary. The problem is the text type on the response is incorrect.
Could you clarify how the text type was set on the response? Have you tried changing the text type in the response to Binary Data? If so, what happened, was there an error message?