hello guys i have swagger url http://somehost/swagger/index.html
end methods there as shown on image:
I am trying to create HTTP POST web request refer to one of the post method.
using System;
using System.Collections.Generic;
using System.Net.Http;
namespace SwaggerConsoleAPP
{
class Program
{
static void Main(string[] args)
{
postRequest("http://somehost/api/Referral/GetReferralsByPersonalIdNumber");
Console.ReadKey();
}
async static void postRequest (string url){
IEnumerable<KeyValuePair<string, string>> queries = new List<KeyValuePair<string, string>>() {
new KeyValuePair<string, string>("1133221221","5642")
};
HttpContent q = new FormUrlEncodedContent(queries);
using (HttpClient client = new HttpClient())
{
using (HttpResponseMessage responce = await client.PostAsync(url,q))
{
using (HttpContent content = responce.Content)
{
string mycontent = await content.ReadAsStringAsync();
Console.WriteLine(mycontent);
}
}
}
}
}
}
this is console application but console writes error:
{"":["The input was not valid."]}
Any help?