Method GetTimecards

Type: FusionOSServices.Controllers.PYTimecardController

Summary

REST service that returns Timecard data

Example

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

Sample Code

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

public void MethodName(parms){

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

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

            foreach (var timecard in timecards )
            {
                // Your code goes here
                string empId = (string)timecard["EMPID"];
                string hours = (string)timecard["HRS"];

            }
            // responses with more then 1000 positions are broken up into multiple requests
            uri = (string)response["RequestResponse"]["NextUri"];
        }
    }
}

Sample Responses


                        
              {
              "RequestResponse": {
                "Count": "2",
                "DATA": {
            		"INTERFACETIMECARDS":  [
            	   { "EMPID": "E0001",
            	     "HRS": "6.00000",
            	     "CDH": "3001",
            	     "TRANDT": "5/23/2017 4:24:58 PM"
            	   },
            	   { "EMPID": "E0002",
            	     "HRS": "1.00000",
            	     "CDH": "3050",
            	     "TRANDT": "5/23/2017 4:24:58 PM"
            	   }
            
            	}
              } 
            }
            
        

Remarks

Allowed values for the Fields paramater include: empid (employee ID), trandt (Timecard Date), hrs (Timecard Hours), cdh (the hour number) and rectype (the payroll record type). these values can also be use as filters, for example, "?trandt=1/1/2017" would limit the response to just those transaction occuring on January 1st, 2017. Query string options SkipRows: The number of rows at the begining of the query to not report. TakeRows: The number of rows from the query to report. If left blank the default is 1000. ?TakeRows=10 results in only 10 rows being returned. ?SkipRows=10 results in all rows after row 10 being returned. ?SkipRows=10&TakeRows=10 results in rows 11 through 20 being returned. Fields: A list of table columns to be included in the query. If this is included in the query string then only the listed columns will be reported. (note that the examples below are for HREmpmstr, but similar ideas can be applied to any table) ?fields=empid,hrs results in only the employee id and hours being reported. Columns can be renamed by appending the new name after the default name. ?fields=empid+EmployeeID,trandt+TimecardDate Filters: Any column name can be added to the query string as a filter. For example ?empid=E0001 ?trandt=1/1/2017 By default the filter comparison is equality. Other comparison are available and can be appended to the filter "?fname=Dan+like " will select Dan, Daniel and Dannie "?hdt=1/1/2017+gt" will include all dates after 1/1/2017 Available comparisons are: "ge", greater than or equal to (>=) "gt", greater than (>) "isnotnull", is not null "isnull", is null "le", less than or equal to (<=) "like", like "lt", less than (<) "ne", not equal (!= , <>) "notlike", not like