Hi - anyone tried ever to send a request from nets...
# suitescript
l
Hi - anyone tried ever to send a request from netsuite to an external api with multipart form and files inside? or maybe generally send files through http(s ) from NetSuite? I can do it but only for text files, for other files (which are base 64) I can't get it working. The main problem is the fact that base 64 file is not accepted and decoding from base64 seems to cause the file to be corrupted (request is succesfull, but file on the other server is corrupted ). When I compare I can see differences in content, which seems to me like encoding problems (files are very similar but some symbols are different)...
j
I've done multipart/form http request with one file without issues. It's a CSV file though, not base64 encoded
l
yeah, text files are working, but am trying to get PDF working...
j
In the part of the request that's for the file do you set Content-Transfer-Encoding:base64
c
e
You need to craft it to set the boundary
l
@cja @John Transfer encoding base64 is not accepted byt the API, so need to decode it, but seems that once you encode it from base64 content is wrong
c
I think that is my problem. Let's let each other know if we find a solution.
My best idea at the moment is to use SuiteTalk instead
l
@cja- you are trying to use suitetalk to retrieve content fo file which is not base64 encoded?
c
png files stored in the file cabinet
e
this seems to be working .
In the end we use a proxy on another server we manage that takes the string from a post reqest from netsuite (JSON) and forwards it to a provided url via Multipart. The proxy runs in nodeJS where it works how you would expect.