Add Delegation

API Type

REST

HTTP Method

POST

Description

Creates a rule for delegating one user's tasks to another user. This method uses the WFDelegation class. For more information, see the AgilePoint Class Reference.

URL Format (On Premises)

https://[domain]:[port]/AgilePointServer/Admin/AddDelegation

URL Format (AgilePoint for Azure)

https://[domain]:[port]/AgilePointService/Admin/AddDelegation

Request Parameters

Name Description
None Not Applicable

Request Body Properties

Name Description

FromUser

Definition:
Specifies a user from whom to delegate tasks.
Type
string
Allowed Values:
A valid user name.

ToUser

Definition:
Specifies the user who will receive the delegated tasks.
Type
string
Allowed Values:
A valid user name.

StartDate

Definition:
>The start date of delegation.
Type
DateTime
Allowed Values:
A valid DateTime value.

EndDate

Definition:
Specifies the completion date of delegation.
Type
DateTime
Allowed Values:
A valid DateTime value.

Description

Definition:
A free text description of a delegation.
Type
string
Allowed Values:
A string that can contain spaces and special characters.

JavaScript Code Example

$("#btnAddDelegation").click(function () {
  
  var JSONObject = {
    FromUser: "demo3\\brian.lucas", 
    ToUser: "demo3\\lilly.allen", 
    StartDate: '\/Date(' + new Date().getTime() + '-0000)\/', 
    EndDate: '\/Date(' + new Date().getTime() + '-0000)\/', 
    Description: "Rest Test", Status: "Created"
  };
  
  $.ajax({
    url: "https://mydomain:9011/AgilePointServer/Admin/AddDelegation",
    data: JSON.stringify(JSONObject)
  });
  
});

Java Code Example

public String AddDelegation(String FromUser, String ToUser,
  String StartDate, String EndDate, String Description, String Status) {

  String URI = "http://mydomain:9011/AgilePointServer/Admin/AddDelegation";

  HTTPOperations ops = new HTTPOperations(domain, this.userName,
                       password, appID, locale);

  JSONObject postData = new JSONObject();
  try {
    postData.put("FromUser", FromUser);
    postData.put("ToUser", ToUser);
    postData.put("StartDate", StartDate);
    postData.put("EndDate", EndDate);
    postData.put("Description", Description);
    postData.put("Status", Status);

    return ops.POSTMethod(URI, postData.toString());
  } catch (JSONException e1) {
    e1.printStackTrace();
  }
  return "";
}

C# Code Example

public string AddDelegation(string username, string username1)
  {
    string gh=@"\/Date(928149600000+0000)\/";
    string jsonRequestData = "{
      \"FromUser\":\"" + username + "\",
      \"ToUser\":\"" + username1 + "\",
      \"StartDate\":\"" + gh + "\",
      \"EndDate\":\"" + gh + "\",
      \"Description\":\"" + "Milind Test" + "\",
      \"Status\":\"" + "Created" + "\"}";
           
    string URI = "http://mydomain:9011/AgilePointServer/Admin/AddDelegation";

    HTTPOperations ops = new HTTPOperations(domain, this.userName, 
                         password, appID, locale);

    return ops.POSTMethod(URI, jsonRequestData);
  }

Output

WFDelegation object.

JSON Response Body Example

{
  "CancelledBy": null,
  "CancelledDate": "\/Date(928149600000+0000)\/",
  "CreatedBy": "demo3\\brian.lucas",
  "CreatedDate": "\/Date(1394154711507+0000)\/",
  "DelegationID": "77F9A9946CF74545B4C8A27956CDA036",
  "Description": "Rest Test",
  "EndDate": "\/Date(28799000+0000)\/",
  "FromUser": "demo3\\brian.lucas",
  "LastUpdatedBy": null,
  "LastUpdatedDate": "\/Date(928149600000+0000)\/",
  "ProcDefIDS": "",
  "RecWeekdaysString": "",
  "StartDate": "\/Date(-57600000+0000)\/",
  "Status": "Created",
  "ToUser": "demo3\\lilly.allen"
}

Supported Versions

AgilePoint BPMS v5.0 R2 and higher