How can I read/save a file
Psst, it's based on the number 64
There's a few endpoints in the Billit API that return files, such as Order, Document and believe it or not File.
A File will consist of a FileID, Filename, MimeType and FileContent.
- The FileID can be used to retreive a file from the File endpoint
- The FileName can be the name
- The MimeType is always in the "type/subtype" form, more info about the types can be found here Basics of HTTP - MIME_types
- The FileContent is Base64 encoded
Example to save the filecontent as a pdf:
byte[] PDFDecoded = Convert.FromBase64String(base64Str);
File.WriteAllBytes(@"c:\pdfFromBillit.pdf", PDFDecoded);
Updated over 1 year ago