Answer the question
In order to leave comments, you need to log in
How to send a POST request to certain site APIs?
Hello. The second day I can not cope with the API of a site like smmok-fb.
The fact is that I need to send my email and password to this API address - smmok-fb.ru/api/getApiKey in order to get the key and use the API of this site.
I send request in this way,
using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)");
HttpContent content = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("email", "value1"),
new KeyValuePair<string, string>("password","value1")
});
content.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
var responseMessage =
await client.PostAsync("http://smmok-fb.ru/api/getApiKey", content);
var result = JsonConvert.DeserializeObject<RequestSMMOK>(responseMessage.Content.ReadAsStringAsync().Result);
return result;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question