WriteBuffer ( Data, Length ( Data )) finally Stream. Create ( FileName, fmCreate ) try if Data nil then Stream. SaveBytesToFile ( const Data : TBytes const FileName : string ) var Stream : TFileStream begin Stream := TFileStream. This is for the bytes to file conversion: □ the ultimate goal is to make it work haha You need the FallbackCharsetEncoding to 'raw' - this I'm not sure but I've read this from here: I'm not even sure if it made a difference but I lost track of it which ones is working and which one is not when I was doing my trial and error. This code result will return rawbytes which you need to convert to a file. Send ( 'AuthenticationProcess Result: ' + RESTRequest. Add ( JSONStr, ctAPPLICATION_JSON ) // RESTRequest.Resource := 'render' RESTRequest. AddItem ( 'x-graph-datasource-name', datasource, TRESTRequestParameterkind. AddItem ( 'x-graph-template-id', templateid, TRESTRequestParameterkind. AddItem ( 'authorization', Getauthorization, TRESTRequestParameterkind. ContentType := 'application/json' RESTRequest. FallbackCharsetEncoding := 'raw' RESTRequest. UserAgent := DatylonUserAgent RESTRequest. JSONStr - this is actually the JSON string that needs to be sent Templateid and datasource - these are datylon parameters that needs be followed based on Datylon documentation Getauthorization - a function that return the Basic authentication with username and password 64bit encoded, small letter 'a' in 'authorization' is from datylon documentation You just need to add some error handling. If anyone want to implements the API or something similar, the following code can be utilized. Although free account in Datylon doesn't work with this API integration. This integration is with the Datylon API & Delphi REST components which handles a PDF return type. After some trial and error again, was able to figure it out.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |