Skip to content
On this page

Document-Related Code Samples

GetDocuments()

csharp
var req = new DocumentDetailsRequestModel()
{
    IDs = new List<object> { 1234567890 },
    Includes = new DocumentIncludesModel()
    {
        IncludeMetaData = true,
        IncludeTasks = true,
        IncludeWorkflowActions = true,
        TaskIncludes = new TaskIncludesModel()
        {
            IncludeFileAttachments = true,
            IncludeWorkflowActions = true
        }
    }
};

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

GetDocumentsUpdateable()

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

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

GetDocumentsCompletedUpdateable()

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

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

GetPdfDataFiles()

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

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

GetDocumentFilesInTiffFormat()

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

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

InsertDocuments()

csharp
var req = new DocumentInsertRequestModel()
{
    Documents = new List<object>
                    {
                        new DocumentInsertModel()
                        {
                            TransactionID = 1234567890,
                            Title = "Web Services Insert Test Document",
                            Source = new SourceModel()
                            {
                                FilePath = @"c:\myDocument.pdf"
                            },
                            Tasks = new List<object>
                            {
                                new TaskInsertModel()
                                {
                                    ParticipantID = 1987654320
                                }
                            }
                        }
                    }
};

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

UpdateDocuments()

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

var api = new DocumentsUpdateableApi(myRestEndpointUrl);
var results = api.GetDocumentsUpdateable(req, apiKey, apiSecret, apiUsername, apiPassword);
if (results.IsSuccessful.Value)
{
	results.UpdateableDocuments[0].Title = "UPDATED!";
    var updateModel = new DocumentUpdateRequestModel()
    {
        Documents = results.UpdateableDocuments
    };

    var api = new DocumentsApi(myRestEndpointUrl);
	var updateResults = api.UpdateDocuments(req, apiKey, apiSecret, apiUsername, apiPassword);
	if (updateResults.IsSuccessful)
	{
		//do work...
	}
	else
	{
	    //handle error
	}
}
else
{
    //handle error
}

UpdateDocumentsCompleted()

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

var api = new DocumentsUpdateableApi(myRestEndpointUrl);
var results = api.GetDocumentsCompletedUpdateable(req, apiKey, apiSecret, apiUsername, apiPassword);
if (results.IsSuccessful.Value)
{
	results.UpdateableDocuments[0].Title = "UPDATED!";
    var updateModel = new DocumentCompletedUpdateRequestModel()
    {
        Documents = results.UpdateableDocuments
    };

    var api = new DocumentsUpdateableApi(myRestEndpointUrl);
	var updateResults = api.UpdateDocumentsCompleted(req, apiKey, apiSecret, apiUsername, apiPassword);
	if (updateResults.IsSuccessful)
	{
		//do work...
	}
	else
	{
	    //handle error
	}
}
else
{
    //handle error
}

UpdateDocumentFormFields()

csharp
var req = new DocumentUpdateFormFieldsRequestModel()
{
    DocumentFormFields = new List<object>
    {
        new DocumentFormFieldsModel()
        {
            DocumentID = 1000435535,
            FormFields = new List<object>
				        {
				            new FormFieldModel()
				            {
				                Name = "City",
				                Value = "Dallas"
				            },
				            new FormFieldModel()
				            {
				                Name = "State",
				                Value = "TX"
				            }
				        }
        }
    }
};

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

UpdateDocumentTextStamps()

csharp
var req = new DocumentUpdateTextStampsRequestModel()
{
    DocumentTextStamps = new List<object>()
                        {
                            new DocumentTextStampsModel()
                            {
                                DocumentID = 1234567890,
                                TextStamps = new List<object>()
                                            {
                                                new TextStampModel()
                                                {
                                                    TextToStamp = "THIS IS A TEST",
                                                    FontColor = TextStampModel.FontColorEnum.Black,
                                                    FontSize = 10,
                                                    PageCoordinatesPageNumber = 1,
                                                    XOffset = 50,
                                                    YOffset = 50
                                                },
                                                new TextStampModel()
                                                {
                                                    TextToStamp = "Another test!",
                                                    FontColor = TextStampModel.FontColorEnum.Blue,
                                                    FontSize = 8,
                                                    SearchTextText = "{{MyPlaceHolderText}}",
                                                    SearchTextStartPosition = TextStampModel.SearchTextStartPositionEnum.Bottom
                                                },
                                                new TextStampModel()
                                                {
                                                    TextToStamp = "Yes Another test!",
                                                    FontColor = TextStampModel.FontColorEnum.Red,
                                                    FontSize = 8,
                                                    SearchTextText = "{{MyPlaceHolderText}}",
                                                    SearchTextStartPosition = TextStampModel.SearchTextStartPositionEnum.Top,
                                                    SearchTextInstance = 2
                                                },
                                                new TextStampModel()
                                                {
                                                    TextToStamp = "FORM FIELD PLACEMENT",
                                                    FontColor = TextStampModel.FontColorEnum.Red,
                                                    FontSize = 8,
                                                    FormFieldFieldName = "Date",
                                                    XOffset = 20,
                                                    YOffset = 20
                                                }
                                            }
                            }
                        }
};

var api = new DocumentsApi(myRestEndpointUrl);
var results = await api.UpdateDocumentTextStampsAsync(req, apiKey, apiSecret, apiUsername, apiPassword);

if (results.IsSuccessful.Value)
{
    // do work
} else
{
    // handle error
}

VoidDocuments()

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

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

SealPdfs()

csharp
var req = new TransactionCertifySealRequestModel()
{
    Transactions = new List<object>
    {
        new TransactionCertifySealPdfModel()
        {
            IsTest = true,
            Description = "Seal Test",
            Pdfs = new List<object>
            {
                new DocumentPdfModel()
                {
                    FileBytes = System.IO.File.ReadAllBytes(@"c:\myDocument.pdf"),
                    Title = "Seal Test PDF"
                }
            }
        }
    }
};

var api = new PdfApi(myRestEndpointUrl);
var results = api.SealPdfs(sa, model);
if (results.IsSuccessful.Value)
{
    //do work...
}
else
{
    //handle error
}

CertifyPdfs()

WARNING

The CertifyPdfs() method has been deprecated in v5.16+

csharp
var req = new TransactionCertifySealRequestModel()
{
    Transactions = new List<object>
    {
        new TransactionCertifySealPdfModel()
        {
            IsTest = true,
            Description = "Certify Test",
            Pdfs = new List<object>
            {
                new DocumentPdfModel()
                {
                    FileBytes = System.IO.File.ReadAllBytes(@"c:\myDocument.pdf"),
                    Title = "Certify Test PDF"
                }
            }
        }
    }
};

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