F
F
ferroussage2020-07-04 17:39:40
API
ferroussage, 2020-07-04 17:39:40

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;
            }


But in the response I get an error that the data was not transmitted - "{\"status\":400,\"error\":\"\\u041d\\u0435 \\u0443\\u043a\\u0430\\u0437\\ u0430\\u043d email\"}"

Please help me with this problem. it doesn't work for me (

https://smmok14.ru/api_docs - here is the API documentation

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2020-07-04
@freeExec

Yours "value1"is not a valid email.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question