Mike, U R A STAR
Following code is working for me. How can I get the SAS token dynamically? Any suggestions?
httpclient lnv_HttpClient
restclient lnv_restclient
integer li_rc, li_fp
blob lblob_content, lblob_resp
string ls_sastoken
string ls_url
li_fp = FileOpen("C:\myfile.pdf", StreamMode!)
FileReadEx(li_fp, lblob_content)
fileclose( li_fp)
lnv_HttpClient = Create HttpClient
lnv_restclient = create restclient
ls_url = "https://mydomain.blob.core.windows.net/images/1.pdf?"
ls_sastoken = "SAS-TOKEN"
string ls_GMTformattedDate = "2023-02-02 05:36:33" // this.of_getutcformateddate( ) //get this from database or from win32 api call
string ls_contenttype = 'application/octet-stream'
lnv_HttpClient.SetRequestHeader("Accept", "*/*")
lnv_HttpClient.SetRequestHeader("Accept-Encoding", "gzip, deflate, br")
lnv_HttpClient.SetRequestHeader("Content-Length", string( len( lblob_content)))
lnv_HttpClient.SetRequestHeader("Content-Type", "application/pdf")
lnv_HttpClient.SetRequestHeader("x-ms-blob-type", "BlockBlob")
lnv_HttpClient.setrequestheader("x-ms-date", ls_GMTformattedDate)
// Not to read data automatically after sending request (default is true)
lnv_HttpClient.AutoReadData = false
// Send request using GET method
li_rc = lnv_HttpClient.SendRequest("PUT", ls_url + ls_sastoken, lblob_content)
lnv_httpclient.getresponsebody( lblob_resp)
// Receive large data
messagebox("Open from Azure failed!", lnv_httpclient.GetResponseStatusText())