Appearance
Transaction Code Samples
CreateTransactions()
TIP
Also see Creating a Simple Transaction for a more in-depth explanation of creating Transactions.
csharp
var taskList = new List<object> { new TaskInsertModel() };
var req = new TransactionCreateRequestModel()
{
EnableLogging = false,
ResponseIncludes = new TransactionIncludesModel()
{
IncludeParticipants = true,
},
Transactions = new List<object>
{
new TransactionCreateModel()
{
IsTest = true,
ProntoID = "Default",
Description = "Web Services Insert Test",
Participants = new List<object>
{
new ParticipantInsertModel()
{
FullName = "John Smith",
EmailAddress = "john.smith@your-domain.com",
SendRequestViaEmail = true,
Tasks = taskList
}
},
Documents = new List<object>
{
new DocumentInsertModel()
{
Title = "Web Services Insert Test Document",
Source = new SourceModel()
{
FileBytes = System.IO.File.ReadAllBytes(@"c:\myDocument.pdf")
},
Tasks = taskList
}
}
}
}
};
var api = new TransactionsApi(myRestEndpointUrl);
var results = api.CreateTransactions(req, apiKey, apiSecret, apiUsername, apiPassword);;
if (results.IsSuccessful.Value)
{
//do work...
}
else
{
//handle error
}
GetTransactions()
csharp
var req = new TransactionDetailsRequestModel()
{
EnableLogging = false,
IDs = new List<object> { 1234567890 },
Includes = new TransactionIncludesModel()
{
IncludeDocuments = true,
IncludeMetaData = true,
IncludeParticipants = true,
IncludeWorkflowActions = true,
DocumentIncludes = new DocumentIncludesModel()
{
IncludeMetaData = true,
IncludeTasks = true,
IncludeWorkflowActions = true,
TaskIncludes = new TaskIncludesModel()
{
IncludeFileAttachments = true,
IncludeWorkflowActions = true
}
},
ParticipantIncludes = new ParticipantIncludesModel()
{
IncludeEmailNotifications = true,
IncludeEmailTemplatePlaceholders = true,
IncludeWorkflowActions = true
}
}
};
var api = new TransactionsApi(myRestEndpointUrl);
var results = api.GetTransactions(req, apiKey, apiSecret, apiUsername, apiPassword);
if (results.IsSuccessful.Value)
{
//do work...
}
else
{
//handle error
}
GetTransactionsUpdateable()
csharp
var req = new TransactionUpdateableRequestModel()
{
IDs = new List<object> { 1234567890 }
};
var api = new TransactionsUpdateableApi(myRestEndpointUrl);
var results = api.GetTransactionsUpdateable(req, apiKey, apiSecret, apiUsername, apiPassword);
if (results.IsSuccessful.Value)
{
//do work...
}
else
{
//handle error
}
UpdateTransactions()
csharp
var req = new TransactionUpdateableRequestModel()
{
IDs = new List<object> { 1234567890 }
};
var api = new TransactionsUpdateableApi(myRestEndpointUrl);
var results = api.GetTransactionsUpdateable(req, apiKey, apiSecret, apiUsername, apiPassword);
if (results.IsSuccessful.Value)
{
results.UpdateableTransactions[0].Description = "UPDATED!";
var updateModel = new TransactionUpdateRequestModel()
{
Transactions = results.UpdateableTransactions
}
var api = new TransactionsApi(myRestEndpointUrl);
var updateResults = api.UpdateTransactions(sa, updateModel);
if (updateResults.IsSuccessful)
{
//do work...
}
else
{
//handle error
}
}
else
{
//handle error
}
CloseTransactions()
TIP
Also see Cancelling a Transaction for a more in-depth explanation of cancelling transactions.
csharp
var req = new TransactionCloseRequestModel()
{
IDs = new List<object> { 1234567890 }
};
var api = new TransactionsApi(myRestEndpointUrl);
var results = api.CloseTransactions(req, apiKey, apiSecret, apiUsername, apiPassword);
if (results.IsSuccessful.Value)
{
//do work...
}
else
{
//handle error
}
GetTransactionTokenData()
TIP
Also see Securing Workflow Actions for more information on Security Token usage.
csharp
private TransactionTokenDataModel GetSecurityTokenData()
{
var token = Request.QueryString["ps_securitytoken"];
var req = new TransactionTokenDataRequestModel();
req.SecurityToken = token;
var results = sc.GetTransactionTokenData(sa,req);
if (results.IsSuccessful.Value)
{
return results.TokenData;
}
else
{
//Handle error
}
}