Xbase++
Xbase++
DocuSign List Folder Items
See more DocuSign Examples
Retrieves a list of the envelopes in the specified folder.Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oHttp
LOCAL oJsonToken
LOCAL oSbResponseBody
LOCAL oJResp
LOCAL nRespStatusCode
LOCAL cOwnerName
LOCAL cEnvelopeId
LOCAL cEnvelopeUri
LOCAL cStatus
LOCAL cSenderName
LOCAL cSenderEmail
LOCAL cCreatedDateTime
LOCAL cSentDateTime
LOCAL cCompletedDateTime
LOCAL cSubject
LOCAL cTemplateId
LOCAL cName
LOCAL cShared
LOCAL cPassword
LOCAL cDescription
LOCAL cLastModified
LOCAL nPageCount
LOCAL cUri
LOCAL cIs21CFRPart11
LOCAL cIsSignatureProviderEnvelope
LOCAL j
LOCAL nCount_j
LOCAL cFieldId
LOCAL cShow
LOCAL cRequired
LOCAL cValue
LOCAL cConfigurationType
LOCAL cErrorDetailsErrorCode
LOCAL cErrorDetailsMessage
LOCAL cResultSetSize
LOCAL cStartPosition
LOCAL cEndPosition
LOCAL cTotalSetSize
LOCAL cPreviousUri
LOCAL cNextUri
LOCAL i
LOCAL nCount_i
nSuccess := 0
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
oHttp := CreateObject("Chilkat.Http")
// Implements the following HTTP request:
// GET /restapi/v2.1/accounts/{accountId}/folders/{folderId}
// Adds the "Authorization: Bearer eyJ0eXAi.....UE8Kl_V8KroQ" header.
oJsonToken := CreateObject("Chilkat.JsonObject")
// Load a previously obtained OAuth2 access token.
nSuccess := oJsonToken:LoadFile("qa_data/tokens/docusign.json")
IF (nSuccess == 0)
? oJsonToken:LastErrorText
oHttp:destroy()
oJsonToken:destroy()
RETURN
ENDIF
oHttp:AuthToken := oJsonToken:StringOf("access_token")
// Use your account ID and a valid folderId here:
oHttp:SetUrlVar("accountId", "7f3f65ed-5e87-418d-94c1-92499ddc8252")
oHttp:SetUrlVar("folderId", "94644782-31b7-4f82-a2c1-26d8a9306f8c")
oSbResponseBody := CreateObject("Chilkat.StringBuilder")
nSuccess := oHttp:QuickGetSb("https://demo.docusign.net/restapi/v2.1/accounts/{$accountId}/folders/{$folderId}", oSbResponseBody)
IF (nSuccess == 0)
? oHttp:LastErrorText
oHttp:destroy()
oJsonToken:destroy()
oSbResponseBody:destroy()
RETURN
ENDIF
oJResp := CreateObject("Chilkat.JsonObject")
oJResp:LoadSb(oSbResponseBody)
oJResp:EmitCompact := 0
? "Response Body:"
? oJResp:Emit()
nRespStatusCode := oHttp:LastStatus
? "Response Status Code = " + Str(nRespStatusCode)
IF (nRespStatusCode >= 400)
? "Response Header:"
? oHttp:LastResponseHeader
? "Failed."
oHttp:destroy()
oJsonToken:destroy()
oSbResponseBody:destroy()
oJResp:destroy()
RETURN
ENDIF
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "resultSetSize": "sample string 1",
// "startPosition": "sample string 2",
// "endPosition": "sample string 3",
// "totalSetSize": "sample string 4",
// "previousUri": "sample string 5",
// "nextUri": "sample string 6",
// "folderItems": [
// {
// "ownerName": "sample string 1",
// "envelopeId": "sample string 2",
// "envelopeUri": "sample string 3",
// "status": "sample string 4",
// "senderName": "sample string 5",
// "senderEmail": "sample string 6",
// "createdDateTime": "sample string 7",
// "sentDateTime": "sample string 8",
// "completedDateTime": "sample string 9",
// "subject": "sample string 10",
// "templateId": "sample string 11",
// "name": "sample string 12",
// "shared": "sample string 13",
// "password": "sample string 14",
// "description": "sample string 15",
// "lastModified": "sample string 16",
// "pageCount": 17,
// "uri": "sample string 18",
// "is21CFRPart11": "sample string 19",
// "isSignatureProviderEnvelope": "sample string 20",
// "customFields": [
// {
// "fieldId": "sample string 1",
// "name": "sample string 2",
// "show": "sample string 3",
// "required": "sample string 4",
// "value": "sample string 5",
// "configurationType": "sample string 6",
// "errorDetails": {
// "errorCode": "sample string 1",
// "message": "sample string 2"
// }
// }
// ]
// }
// ]
// }
// Sample code for parsing the JSON response...
// Use the following online tool to generate parsing code from sample JSON:
// Generate Parsing Code from JSON
cResultSetSize := oJResp:StringOf("resultSetSize")
cStartPosition := oJResp:StringOf("startPosition")
cEndPosition := oJResp:StringOf("endPosition")
cTotalSetSize := oJResp:StringOf("totalSetSize")
cPreviousUri := oJResp:StringOf("previousUri")
cNextUri := oJResp:StringOf("nextUri")
i := 0
nCount_i := oJResp:SizeOfArray("folderItems")
DO WHILE i < nCount_i
oJResp:I := i
cOwnerName := oJResp:StringOf("folderItems[i].ownerName")
cEnvelopeId := oJResp:StringOf("folderItems[i].envelopeId")
cEnvelopeUri := oJResp:StringOf("folderItems[i].envelopeUri")
cStatus := oJResp:StringOf("folderItems[i].status")
cSenderName := oJResp:StringOf("folderItems[i].senderName")
cSenderEmail := oJResp:StringOf("folderItems[i].senderEmail")
cCreatedDateTime := oJResp:StringOf("folderItems[i].createdDateTime")
cSentDateTime := oJResp:StringOf("folderItems[i].sentDateTime")
cCompletedDateTime := oJResp:StringOf("folderItems[i].completedDateTime")
cSubject := oJResp:StringOf("folderItems[i].subject")
cTemplateId := oJResp:StringOf("folderItems[i].templateId")
cName := oJResp:StringOf("folderItems[i].name")
cShared := oJResp:StringOf("folderItems[i].shared")
cPassword := oJResp:StringOf("folderItems[i].password")
cDescription := oJResp:StringOf("folderItems[i].description")
cLastModified := oJResp:StringOf("folderItems[i].lastModified")
nPageCount := oJResp:IntOf("folderItems[i].pageCount")
cUri := oJResp:StringOf("folderItems[i].uri")
cIs21CFRPart11 := oJResp:StringOf("folderItems[i].is21CFRPart11")
cIsSignatureProviderEnvelope := oJResp:StringOf("folderItems[i].isSignatureProviderEnvelope")
j := 0
nCount_j := oJResp:SizeOfArray("folderItems[i].customFields")
DO WHILE j < nCount_j
oJResp:J := j
cFieldId := oJResp:StringOf("folderItems[i].customFields[j].fieldId")
cName := oJResp:StringOf("folderItems[i].customFields[j].name")
cShow := oJResp:StringOf("folderItems[i].customFields[j].show")
cRequired := oJResp:StringOf("folderItems[i].customFields[j].required")
cValue := oJResp:StringOf("folderItems[i].customFields[j].value")
cConfigurationType := oJResp:StringOf("folderItems[i].customFields[j].configurationType")
cErrorDetailsErrorCode := oJResp:StringOf("folderItems[i].customFields[j].errorDetails.errorCode")
cErrorDetailsMessage := oJResp:StringOf("folderItems[i].customFields[j].errorDetails.message")
j := j + 1
ENDDO
i := i + 1
ENDDO
oHttp:destroy()
oJsonToken:destroy()
oSbResponseBody:destroy()
oJResp:destroy()