How Do I Get Additional Results from EnvelopesAPI.ListStatusChanges

三世轮回 提交于 2019-12-12 05:53:29

问题


I'm trying to practice defensive programming. Following the advice from the documentation, I want to poll using the api passing in a value 3 minutes before the last time I polled. Considering, I could get a ResultSetSize less than the TotalSetSize, I'd like to ask for the next set of results starting at the next result.

So, as an example, I request the following (using the REST API explorer):

GET https://demo.docusign.net/restapi/v2/accounts/#####/envelopes?count=2&from_date=2017-01-01&from_to_status=changed HTTP/1.1

(note the count = 2)

This returns:

Object
resultSetSize:  "2"
totalSetSize:  "8"
startPosition:  "0"
endPosition:  "1"
nextUri:  "/accounts/#####/envelopes?start_position=2&count=2&from_date=1%2f1%2f2017+12%3a00%3a00+AM&from_to_status=changed"
previousUri:  ""
 envelopes: Array [2]

Ok, great, exactly as I expect. Now, I want to get the second "page" of results. I add a start_position of 2, right? (Since the end position is 1, I'd expect to get startPosition 2 and endPosition 3 to be returned.)

GET https://demo.docusign.net/restapi/v2/accounts/#####/envelopes?count=2&from_date=2017-01-01&from_to_status=changed&start_position=2 HTTP/1.1

No dice... 400 Bad Request:

Object
errorCode:  "INVALID_REQUEST_PARAMETER"
message:  "The request contained at least one invalid parameter. Query parameter 'count' was not a positive integer."

The count parameter is a positive integer...

Please, someone tell me what I'm doing wrong. I would like to just request as many as they can pass at a time, and if there are more, I'd like to repeat until all envelopes have been retrieved, but that "count" error is concerning.


回答1:


From documentation

start_position parameter is reserved for DocuSign use only.

Looks like pagination is not supported with the listStatusChanges api.




回答2:


If you call the nextUri address, what happens? You will need to prepend your base URL.



来源:https://stackoverflow.com/questions/43354681/how-do-i-get-additional-results-from-envelopesapi-liststatuschanges

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!