Sending binary data via a GET or POST REST call

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
 
A

Anthony P.

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?
 
A

Anthony P.

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?
 
J

Jason Keats

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top