Docusign Paging Envelope JSON Data

2019-07-30 06:50发布

问题:

I am integrating Docusign using REST API to download the document attachments and uploading them to Sharepoint using DocuSign c# SDK

I can see the envelopes.NextUri, but I am not sure how to page the data , JSON response -

nextUri":"/accounts/<acc-id>/envelopes?start_position=100&count=100&from_date=7%2f10%2f2016+5%3a24%3a59+AM&from_to_status=changed&to_date=8%2f14%2f2017+5%3a24%3a59+AM&status=Completed","previousUri":"","resultSetSize":"100","startPosition":"0","totalSetSize":"6709"}

Could you please provide me a snippet on how to page the JSON data on nextUri parameter?.

回答1:

The listStatusChanges api does not support pagination.

Why do you want to implement pagination on top of the api? Why not just retrieve the entire dataset and cache it in your application.

Since you just want to download the documents and archive them to Sharepoint, you can just used the cached data and mark it as completed in your application.


Retrieving partial Data

You also have an option to obtain partial data using the date ranges.

GET /restapi/v2/accounts/{accountId}/envelopes?from_date=2017-01-01&to_date=2017-02-01

GET /restapi/v2/accounts/{accountId}/envelopes?from_date=2017-02-01&to_date=2017-03-01

Using C# SDK

// set a filter for the envelopes we want returned using the fromDate and count properties
var options = new EnvelopesApi.ListStatusChangesOptions()
{
    fromDate = "6/16/2017",
    toDate = "6/30/2017"
};

// |EnvelopesApi| contains methods related to envelopes and envelope recipients
var envelopesApi = new EnvelopesApi();
var envelopes = envelopesApi.ListStatusChanges(accountId, options);

Microsoft Flow

Also take a look at DocuSign for Microsoft Flow. With this you can automate the task of archiving documents to Sharepoint.