TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Amit Joshi
NA
122
35.2k
Calling WEB API from C# console application
Mar 19 2015 10:51 AM
I have web API service which has single Put method which takes one string parameter.
Put(string id)
I want to call the web API from C# console application.
I have below code.
client.BaseAddress = new Uri("http://localhost:8080");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
String Id="100";
string serviceURL="api/employee"
HttpResponseMessage response = client.PutAsJsonAsync(serviceURL,Id).Result;
if (response.IsSuccessStatusCode)
{
}
The Id parameter is not getting mapped to the URL in order to call the Web API Put method. How to send single parameter to Put method.
Reply
Answers (
2
)
Phone number Format
Raw in mvc 5