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

Delete Leave

Supports:

POST

URL:

https://jobapi.tasq.com.au/api/Staff/DeleteLeave

 

Attribute Details:

Company Validate Info

Login Name String must
Client IP String optional
Password String must
Mobile Device Token String optional
Web Api TOKEN Guid (36) must
ID Guid (36) must
Send From User ID Guid (36) optional
Need Validate Boolean must

JSON Sample Code

{
	     "CompanyValidateInfo": {
"ClientIP": null,
"LoginName": "testapi@tasq.com.au",
"MobileDeviceToken": null,
"Password": "test123.",
"WebApiTOKEN": "b3b777b0-c7af-458d-be64-b3d6d760177f"
},
	"ID": " ACBC85EA-AA9D-4DC9-9057-A00E0E619914",
	"SendFromUserID": null,
	"NeedValidate": false
}
Return Value:
{
    "ActionCode": "Delete",
    "IsSuccessed": "YES",
    "ErrorMessage": "Delete successfully!",
    "ReturnData": "acbc85ea-aa9d-4dc9-9057-a00e0e619914"
}

C# Sample Code

public static string EditLeave (string Url ,string content)
        {
            string result = "";
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(Url);
            req.Method = "POST";
            req.ContentType = "application/json";

            #region Add Post Param
            byte[] data = Encoding.UTF8.GetBytes(content);
            req.ContentLength = data.Length;
            using (Stream reqStream = req.GetRequestStream())
            {
                reqStream.Write(data, 0, data.Length);
                reqStream.Close();
            }
            #endregion

            HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
            Stream stream = resp.GetResponseStream();
            using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
            {
                result = reader.ReadToEnd();
            }
            return result;
        }

JavaScript

 function EditLeave () {
        $.ajax({
            type: "Post",
            url: "https://jobapi.tasq.com.au/api/Staff/DeleteLeave",
            data: {
               …
            },
            dataType: "json",
            success: function (data) {
                console.dir(data)
            },
            error: function (e) {
                console.dir(e)
            }
        });
}

Java Sample Code

private static void DeleteLeave(String json){
    try {
        URL url = new URL("https://jobapi.tasq.com.au/api/Staff/DeleteLeave");
        HttpURLConnection con = (HttpURLConnection)url.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Content-Type", "application/json; charset=utf-8");
        con.setRequestProperty("Accept", "application/json");
        con.setDoInput(true);
        con.setDoOutput(true);
        con.setUseCaches(false);
        con.setRequestProperty("Connection", "Keep-Alive");
        if (json != null){
            byte[] writeBytes = json.getBytes("utf-8");
            OutputStream outputStream = con.getOutputStream();
            outputStream.write(writeBytes,0, writeBytes.length);
            outputStream.flush();
            outputStream.close();
        }
        if (con.getResponseCode() == HttpURLConnection.HTTP_OK){
            InputStreamReader in = new InputStreamReader(con.getInputStream());
            BufferedReader br = new BufferedReader(in);
            StringBuilder response = new StringBuilder();
            String responseLine = null;
            while ((responseLine = br.readLine()) != null){
                response.append(responseLine.trim());
            }
            System.out.println(response.toString());
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}

Swift Sample Code

func DeleteLeave ()
{
    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?