This service returns the following information about Positions: The Position ID, the Position Description (POSLONG), PCN, PCN Description (LONGDESC), and the hours associated with the Position.
Type | Description |
---|---|
System.String | If a Position ID is provided only information for that Position will be returned. |
using System.Net;
using Newtonsoft.Json.Linq;
public void MethodName(parms){
string uri = "https://fusion.superion.com/FusionOSServices/v0/ONESolution/TimeClockPlus/Positions";
using (WebClient wc = new WebClient())
{
wc.Headers.Add("Content-Type", "application/json");
// Replace "ID" with supplied AppID
wc.Headers.Set("X-APPID", "ID");
// Replace "KEY" with supplied AppKey
wc.Headers.Set("X-APPKEY", "KEY");
while (uri != null)
{
string result = wc.DownloadString(uri);
var response = JObject.Parse(result);
var count = (string)response["RequestResponse"]["Count"];
var positions = (JContainer)response["RequestResponse"]["DATA"]["POSITION"];
foreach (var position in positions)
{
// Your code goes here
string positionDescription = (string)position["POSLONG"];
string positionControlNumber = (string)position["PCN"];
foreach(var hour in position["HOURS"])
{
string hourNumber = (string)hour["CDHNO"];
string hourDescription = (string)hour["CDHTITLE"];
string hourType = (string)hour["TCPTYPE"];
}
}
// responses with more then 1000 positions are broken up into multiple requests
uri = (string)response["RequestResponse"]["NextUri"];
}
}
}
{
"RequestResponse": {
"Count": "1",
"DATA": {
"POSITION": [
{
"LONGDESC": "CITY COUNCIL",
"PCN": "01050000",
"POSLONG": "MIKE COUNCIL",
"POSITION": "MIKETEST",
"HOURS": [
{
"HOUR": [
{
"CDHNO": "3002",
"CDHTITLE": "SALARY",
"TCPTYPE": "REG"
},
{
"CDHNO": "3402",
"CDHTITLE": "VACATION USED",
"TCPTYPE": "LEAVE"
},
{
"CDHNO": "3422",
"CDHTITLE": "SICK USED",
"TCPTYPE": "LEAVE"
},
{
"CDHNO": "3432",
"CDHTITLE": "SICK USED-FAMILY",
"TCPTYPE": "LEAVE"
},
{
"CDHNO": "3442",
"CDHTITLE": "PERSONAL USED",
"TCPTYPE": "LEAVE"
},
{
"CDHNO": "3462",
"CDHTITLE": "ADMIN USED",
"TCPTYPE": "LEAVE"
}
]
}
]
}
]
}
}
}