Skip to content
On this page

Managing Tasks

When you create a new Transaction, you are required to include at least one Document, one Participant, and one Task per Document/Participant. However, after the Transaction is created, you can add new Tasks or update existing Tasks via the API at any point as long as the transaction is still in the Pending status.

Insert a Task

In order to insert a new Task into an existing Transaction, you'll need provide the Document ID and Participant ID along with the new Task's details.

csharp
var req = new TaskInsertRequestModel() {
    EnableLogging = false,
        Tasks = new List<object> {
            new TaskInsertModel() {
                DocumentID = 1234567890,
                    ParticipantID = 1000456789,
                    Type = TaskTypes.Delivery
            }
        }
};

var api = new TasksApi(myRestEndpointUrl);
var results = api.InsertTasks(req, apiKey, apiSecret, apiUsername, apiPassword);;
if (results.IsSuccessful.Value) {
    //do work...
} else {
    //handle error
}

Update a Task

In order to update an existing Participant, you'll need to retrieve an existing "Updateable" Participant first. Once you have the ParticipantUpdateModel you can add/update/delete any properties you wish from that object and then all the UpdateParticipants() method to commit the update.

csharp
var req = new TaskUpdateableRequestModel() {
    IDs = new List<object> {
        1234567890
    }
};

var api = new TasksUpdateableApi(myRestEndpointUrl);
var results = api.GetTasksUpdateable(req, apiKey, apiSecret, apiUsername, apiPassword);
if (results.IsSuccessful.Value) {
    results.UpdateableTasks[0].ParticipantID = 1234567890;
    var updateModel = new TaskUpdateRequestModel() {
        Tasks = results.UpdateableTasks
    };
    
    var api = new TasksApi(myRestEndpointUrl);
	var updateResults = api.UpdateTasks(sa, updateModel);
    if (updateResults.IsSuccessful) {
        //do work...
    } else {
        //handle error
    }
} else {
    //handle error
}