Sending binary data via a GET or POST REST call

  • Thread starter Thread starter Anthony P.
  • Start date Start date
A

Anthony P.

Hello Everyone,

I'm creating a program that will use a REST interface to send a binary
file to the server but I'm really not sure how to do that. I know how
to do the REST call but how do I send binary data? The documentation
says I will send it as file_data=<raw_binary_data> in my GET request.

I'm using the HTTPWebRequest() and HTTPWebResponse() classes to do
this from the client.

Can anyone help?
Also, is the process much different to send via POST? Can anyone point
me in the right direction?

Thanks!
Anthony
 
Small Correction:

The method is actually ONLY POST. So I guess my question is: from a
VB.NET application, how do I send raw binary data as part of my POST
request?
 
Take a look at the System.Net.WebClient class.  It might be what you're
looking for.

Thanks Mike! Close but not quiet. I need something I can pass
parameters along with (this is a REST call). WebClient doesn't allow
that. Any other ideas?
 
Anthony said:
Jason,

Thanks but doesn't meet my needs. I'm not using ASP.NET. This is a
traditional desktop app that interacts with a REST service over the
internet. Certainly attaching binary data to a variable in a REST call
can't be that difficult where nobody knows how, can it?

Anthony

OpenRasta is not just for ASP.NET. If I were doing REST I'd probably use it.

If you haven't already solved your problem then these links might help:

http://www.shaneng.net/Main/Multi-PartFormPost
http://www.dotnet247.com/247reference/msgs/41/207812.aspx
http://stackoverflow.com/questions/566462/upload-files-with-httpwebrequest-multipart-form-data
http://developer.nirvanix.com/forums/t/56.aspx
http://bytes.com/topic/c-sharp/answers/268661-how-upload-file-via-c-code
http://www.groupsrv.com/dotnet/post-373624.html
http://killustar.blogspot.com/2009/03/silverlight-multi-part-form-post.html
 
Back
Top