Method GetLeaveDefs

Type: FusionOSServices.Controllers.PYLeaveController

Summary

This service returns the the types of Leave possible and the Hours that affect those Leaves

Example

GET https://fusion.superion.com/FusionOSServices/v1/ONESolution/Payroll/LeaveDefinitions

Sample Code

using System.Net;
using Newtonsoft.Json.Linq;

public void MethodName(parms){

    string uri = "https://fusion.superion.com/FusionOSServices/v1/ONESolution/Payroll/LeaveDefinitions";
    

    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 transactions = (JContainer)response["RequestResponse"]["DATA"]["Leaves"];

            foreach (var transaction in transactions )
            {
                // Your code goes here
                string leaveID = (string)transactions["LEAVEID"];
                string leaveDescription = (string)transactions["Title"];
                var hours = (JContainer)transaction["CDHS"];
                foreach(var hour in hours)
                {
                    string hourNumber = hour["CDH"];
                    string hourTitle = hour["Title"];
                    string effect = hour["Effect"];
                }
            }
            // responses with more then 1000 positions are broken up into multiple requests
            uri = (string)response["RequestResponse"]["NextUri"];
        }
    }
}

Sample Responses


                        
            {
                "RequestResponse": {
                "Count": "none",
                 "DATA": {
                   "LEAVES": [
                     {
                       "LEAVEID": "7",
                       "Title": "Vacation Balance",
                       "CDHS": [
                         {
                           "CDH": "3400",
                           "Title": "VACATION ACCRUAL",
                           "Effect": "+"
                         },
                         {
                           "CDH": "3402",
                           "Title": "VACATION USED",
                           "Effect": "-"
                         },
                         {
                           "CDH": "3404",
                           "Title": "VACATION ADJUSTMENT",
                           "Effect": "+"
                         },
                         {
                           "CDH": "3406",
                           "Title": "VACATION PAYOUT",
                           "Effect": "-"
                         }
                   ]
                 }
               }
             }