Answered by:
How to POST data to a REST Service

Question
-
User-13689440 posted
I am writing an application (windows service) which needs to POST to a REST web service to send some data. Can someone please tell me step by step process to do this?
Thanks
Wednesday, August 14, 2013 12:26 PM
Answers
-
User220959680 posted
Still not clear, I need to post data (3 parameters - to, from, body) to a REST service (https://xyz/,,,) how do i do that without any add in's and just using HttpWebRequest(????)
Note that To, From and Body are going to be properties in an object that should be posted to the service.
public class Email { public string ToAddress{get;set;} public string FromAddress{get;set;} public string Body{get;set;} }
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, August 15, 2013 7:04 AM
All replies
-
User1109032460 posted
Read
http://www.jayway.com/2012/03/13/httpclient-makes-get-and-post-very-simple/
That will tell you everything you need to know.
Wednesday, August 14, 2013 12:39 PM -
User-13689440 posted
Still not clear, I need to post data (3 parameters - to, from, body) to a REST service (https://xyz/,,,) how do i do that without any add in's and just using HttpWebRequest(????)
Wednesday, August 14, 2013 1:06 PM -
User1109032460 posted
Step by step, then
Go to google (it's a search engine for the WWW)
Type in HttpWebRequest POST variables
The first search result will tell you exactly what to do.
Wednesday, August 14, 2013 2:07 PM -
User220959680 posted
A Beginner's Tutorial on Creating WCF REST Services
Code sample: WCF WebHttp REST Entity Service in C# for Visual Studio 2010
* Note that ASP.NET Web API can be utilised to implement HTTP REST services, which is easier than WCF. WCF is more configuration based than convention. Refer www.asp.net/web-api for Web API resources.
Thursday, August 15, 2013 7:00 AM -
User220959680 posted
Still not clear, I need to post data (3 parameters - to, from, body) to a REST service (https://xyz/,,,) how do i do that without any add in's and just using HttpWebRequest(????)
Note that To, From and Body are going to be properties in an object that should be posted to the service.
public class Email { public string ToAddress{get;set;} public string FromAddress{get;set;} public string Body{get;set;} }
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, August 15, 2013 7:04 AM -
User503812343 posted
You will have to use WebClient from windows form or service to invoke post operation of WCF REST service
Click here to check how to invoke post operation with webclient and datacontract
Thursday, August 15, 2013 11:46 AM