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
darma teja
NA
496
337k
post data to API
Apr 20 2017 7:06 AM
I am trying to post data to my API. Could anyone tell me where I missing??
I am getting error at:
responseFinal = client.PutAsJsonAsync(
"apiName/api/blabla"
, data).Result;
Here is my code:
var client =
new
HttpClient();
client.BaseAddress =
new
Uri(
"http://Ipaddress/apiName"
);
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(
new
System.Net.Http.Headers.MediaTypeWithQualityHeaderValue(
"application/json"
));
client.DefaultRequestHeaders.Authorization = CreateBasicHeader(userName, password);
var data =
new
{
data =
"0001"
};
HttpResponseMessage responseFinal =
null
;
responseFinal = client.PutAsJsonAsync(
"apiName/api/blabla"
, data).Result;
// I am getting error
Advance thanks,
Darma
Reply
Answers (
1
)
Regarding Project. Wix file
How private public key encryption works