Access the full API documentation here: http://apidocs.peoplehr.com/
private void button2_Click(object sender, EventArgs e)
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://api.peoplehr.net/Employee");
httpWebRequest.ContentType = "text/json";
httpWebRequest.Method = "POST";
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
string json = "{\"APIKey\":\"b448145f-6b5b-4c5e-be4c-f2ec22e926cc\", \"Action\": \"GetAllEmployeeDetail\", \"IncludeLeavers\": \"false\"}";
streamWriter.Write(json);
}
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var responseText = streamReader.ReadToEnd();
//Now you have your response.
//or false depending on information in the response
//MessageBox.Show(responseText);
dynamic stuff = JsonConvert.DeserializeObject(responseText);
string name = stuff.Message;
foreach (var x in stuff.Result)
{
var z = x.FirstName.DisplayValue;
string id = z;
MessageBox.Show(id);
}
MessageBox.Show(name);
}
}
Thanks,
Customer Services Team