Android Question HTTP Download (Get) Send data in body

Derek Jee

Active Member
Licensed User
Longtime User
Hi there

I need to send some data in the body of my request but it is a Job.Download which does not have a second parameter like the Job.PostString does.. Is there a way of amending the HTTPUtils2 to accept this or should I just put the data after my link, e.g www.mysite.com/Page1/DataToSend.

There are no Headers I can use which suit the data, which is a row count of a table on my device which I need to get to my server and use the data to create the server response..

Thanks for your help.


Derek.
 

DonManfred

Expert
Licensed User
Longtime User
Poststring should be the right one then...
It is your server which sends the result; even if it is a download of something... The server need to correctly get the submitted data and send the result.

You maybe can set a specialized header and the serverside will get the data from the header.
Here an example from my Dropbox V2 http class (using job.download and a special header
B4X:
    Dim job As HttpJob
    job.Initialize("filedownload",Me)
    job.Tag = File.Combine(destpath,destfile)
    LogColor("Download: "&job.Tag,Colors.Blue)
    job.Download(mApiV2urlContent&"files/download")
    job.GetRequest.SetHeader("Authorization", "Bearer "&mAccessToken)
    job.GetRequest.SetHeader("Dropbox-API-Arg", $"{"path":"${path}"}"$)
    job.GetRequest.SetHeader("Accept","application/vnd.dropbox-cors-hack")
 
Upvote 0

Derek Jee

Active Member
Licensed User
Longtime User
Thank you Manfred

I wish I could use a specialised header but my client only wants to use conventional ones. I will use Poststring as you have suggested.. Many thanks, again..

Derek.
 
Upvote 0
Top