Hi everyone, I sent a file from NetSuite to an ext...
# suitescript
s
Hi everyone, I sent a file from NetSuite to an external CRM (IRIS) using a REST API. When I tested sending the file via Postman with a binary body, it worked flawlessly. However, when I used
file.getContent()
in NetSuite to convert the file to a blob and sent it through the API, the format turned out incorrect. I also tried converting it to an array buffer, but the issue persists. Does anyone have any insights on how to resolve this? Your help would be greatly appreciated.
s
I remember facing a similar issue a long time ago. I wanted to send a pdf buffer from NetSuite, but if I remember correctly, the api by default returns base64 encoded content when using file.getcontent for .pdf files. You may check if your receiver supports that content-type application/pdf with a base64 encoded blob
If the issue is that it’s altered on receipt slightly then it could very well be the conversion. I had no luck with using external libraries and trying to convert to binary inside NetSuite
s
Thankyou @SimonC, Receiver accept "application/octet-stream" "Request Body schema: application/octet-stream string binary ". I have talked to receiver support they are not really helpful.
s
The challenge still remains obtaining the correct pdf binary from the file stored in file cabinet
s
Ohh Understood, I also tried many different ways.