1. Home
  2. Docs
  3. API Overview
  4. Documents – Leave
  5. Get Leave List

Get Leave List

Get the Leave for TASQ.

 

URL:

https://jobapi.tasq.com.au/api/Staff/GetLeaveList?Jsonlogin={“LoginName”:”testapi@tasq.com.au”,”ClientIP”:null,”Password”:”test123.”,”MobileDeviceToken”:null,”WebApiTOKEN”:”b3b777b0-c7af-458d-be64-b3d6d760177f”}&Type=All&StartTime=2019-10-15&EndTime=2019-11-14&StaffID=[“0AD4938D-0B26-44B6-8D3D-ECC08C792085“]

Supports:

GET

 

Attribute Details:

 

Login Name String must
Client IP String optional
Password String must
Mobile Device Token String optional
Web Api TOKEN Guid (36) must
Type string must
Start Time Date Time must
End Time Date Time must
Staff ID Guid (36) must

JSON Sample Code

Return Value:
{
    "ActionCode": null,
    "IsSuccessed": "YES",
    "ErrorMessage": "",
    "ReturnData": {
        "LeaveTransactionHeaderList": [
            {
                "LeaveID": "292eb182-0be9-41dc-96a2-a71629f96d48",
                "ReferenceNO": "PL00000005",
                "StaffID": "0ad4938d-0b26-44b6-8d3d-ecc08c792085",
                "StaffName": "xxf bbc",
                "LeaveType": "588dfb60-04ad-41a5-b5f6-28355d65c5f2",
                "LeaveTypeName": null,
                "StartTime": "2019-10-18T09:00:00",
                "EndTime": "2019-10-18T09:30:00",
                "Totalhours": 0.5,
                "hasApproval": "YES",
                "IsDeleted": false,
                "CreateTimeUTC": "2019-10-18T07:00:07.33",
                "CreatedBy": "xiaofengxiong@uniware.com.au",
                "LastModifiedTimeUTC": "2019-10-18T07:00:07.33",
                "LastModifiedBy": "xiaofengxiong@uniware.com.au",
                "Memo": ""
            },
            {
                "LeaveID": "a07b5e78-3bff-45cd-887e-2c983cdd8dc5",
                "ReferenceNO": "PL00000004",
                "StaffID": "0ad4938d-0b26-44b6-8d3d-ecc08c792085",
                "StaffName": "xxf bbc",
                "LeaveType": "588dfb60-04ad-41a5-b5f6-28355d65c5f2",
                "LeaveTypeName": null,
                "StartTime": "2019-10-17T09:00:00",
                "EndTime": "2019-10-17T11:30:00",
                "Totalhours": 2.5,
                "hasApproval": "YES",
                "IsDeleted": false,
                "CreateTimeUTC": "2019-10-17T07:49:38.43",
                "CreatedBy": "xiaofengxiong@uniware.com.au",
                "LastModifiedTimeUTC": "2019-10-17T07:50:45.227",
                "LastModifiedBy": "xiaofengxiong@uniware.com.au",
                "Memo": "aa"
            },
            {
                "LeaveID": "7dfc10ec-5b74-4dca-8910-c0061e42f44b",
                "ReferenceNO": "PL00000003",
                "StaffID": "0ad4938d-0b26-44b6-8d3d-ecc08c792085",
                "StaffName": "xxf bbc",
                "LeaveType": "588dfb60-04ad-41a5-b5f6-28355d65c5f2",
                "LeaveTypeName": null,
                "StartTime": "2019-10-17T09:20:00",
                "EndTime": "2019-10-17T09:30:00",
                "Totalhours": 0.17,
                "hasApproval": "YES",
                "IsDeleted": false,
                "CreateTimeUTC": "2019-10-17T07:46:31.177",
                "CreatedBy": "xiaofengxiong@uniware.com.au",
                "LastModifiedTimeUTC": "2019-10-17T07:46:31.177",
                "LastModifiedBy": "xiaofengxiong@uniware.com.au",
                "Memo": ""
            },
            {
                "LeaveID": "49a793c6-5606-4ee0-a9cf-529c5d356b6e",
                "ReferenceNO": "PL00000002",
                "StaffID": "0ad4938d-0b26-44b6-8d3d-ecc08c792085",
                "StaffName": "xxf bbc",
                "LeaveType": "588dfb60-04ad-41a5-b5f6-28355d65c5f2",
                "LeaveTypeName": null,
                "StartTime": "2019-10-17T09:00:00",
                "EndTime": "2019-10-17T11:40:00",
                "Totalhours": 2.67,
                "hasApproval": "YES",
                "IsDeleted": false,
                "CreateTimeUTC": "2019-10-17T07:41:50.963",
                "CreatedBy": "xiaofengxiong@uniware.com.au",
                "LastModifiedTimeUTC": "2019-10-17T07:52:35.887",
                "LastModifiedBy": "xiaofengxiong@uniware.com.au",
                "Memo": "333"
            },
            {
                "LeaveID": "1d5adeca-8029-490c-80eb-9587d295e144",
                "ReferenceNO": "PL00000001",
                "StaffID": "0ad4938d-0b26-44b6-8d3d-ecc08c792085",
                "StaffName": "xxf bbc",
                "LeaveType": "588dfb60-04ad-41a5-b5f6-28355d65c5f2",
                "LeaveTypeName": null,
                "StartTime": "2019-10-17T09:00:00",
                "EndTime": "2019-10-17T10:40:00",
                "Totalhours": 1.67,
                "hasApproval": "YES",
                "IsDeleted": false,
                "CreateTimeUTC": "2019-10-17T07:09:01.973",
                "CreatedBy": "xiaofengxiong@uniware.com.au",
                "LastModifiedTimeUTC": "2019-10-17T07:48:19.04",
                "LastModifiedBy": "xiaofengxiong@uniware.com.au",
                "Memo": "66"
            }
        ],
        "PageCount": 0,
        "DataCount": 0,
        "PageIndex": 0
    }
}

C# Sample Code

public static string GetLeaveList (string Url)
        {
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url);
            request.Method = "GET";
            request.ContentType = "application/json";

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            Stream myResponseStream = response.GetResponseStream();
            StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.UTF8);
            string retString = myStreamReader.ReadToEnd();

            myStreamReader.Close();
            myResponseStream.Close();

            if (response != null)
            {
                response.Close();
            }
            if (request != null)
            {
                request.Abort();
            }

            return retString;
        }

JavaScript Sample Code

  function GetLeaveList () {
        $.ajax({
            type: "Get",
            url: Url,
            dataType: "json",
            success: function (data) {
                console.dir(data)
            },
            error: function (e) {
                console.dir(e)
            }
        });
}

Java Sample Code

private static void GetLeaveList(String path){
    try {
        URL url = new URL(path);
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
        connection.setRequestMethod("GET");
        if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
            InputStreamReader in = new InputStreamReader(connection.getInputStream());
            BufferedReader reader = new BufferedReader(in);
            String line = "";
            StringBuilder result = new StringBuilder();
            while ((line = reader.readLine()) != null) {
                result.append(line);
            }
            reader.close();
            connection.disconnect();
            System.out.println(result);
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}

Swift Sample Code

func GetLeaveList ()
{
    let leave: Leave = Leave()
    let UrlString = TASQSampleCommonLibrary.TASQApiUrl + "Staff/DeleteLeave"
    let loginDetail: LoginDetail = LoginDetail()
    var parameters = [String:AnyObject]()
    var arrayData = [String:AnyObject]()

    arrayData ["WebApiTOKEN"] = TASQSampleCommonLibrary.TASQApiTOKEN as AnyObject?
    arrayData ["LoginName"] = loginDetail.LoginEmail! as AnyObject?
    arrayData ["Password"] = loginDetail.LoginPassword! as AnyObject?
    arrayData ["ClientIP"] = TASQSampleCommonLibrary.getIPAddresses() as AnyObject?
    arrayData ["MobileDeviceToken"] = TASQSampleCommonLibrary.getMobileDeviceToken() as AnyObject?
    
    parameters["CompanyValidateInfo"] = arrayData as AnyObject?
    
    parameters["ID"]  = leave.LeaveID! as AnyObject?
    parameters["NeedValidate"]  = "NO" as AnyObject?

    let request = NSMutableURLRequest(url: NSURL(string: UrlString)! as URL, cachePolicy: NSURLRequest.CachePolicy.reloadIgnoringLocalCacheData, timeoutInterval: 300)
    let jsonString = TASQSampleCommonLibrary.convertDictionaryToJSONData(dicData: parameters)
    print(jsonString)
    request.httpBody = jsonString.data(using: String.Encoding.utf8, allowLossyConversion: true)
    request.httpMethod = "POST"
    request.setValue("application/json", forHTTPHeaderField: "Content-Type")
    do {
        let config = URLSessionConfiguration.default
        let session = URLSession(configuration: config)
        let task = session.dataTask(with: request as URLRequest, completionHandler: {
            (data, response, error)  in
        })
        task.resume()
    }
}

 

 

How can we help?