Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PureBasic) DocuSign List Folder ItemsSee more DocuSign ExamplesRetrieves a list of the envelopes in the specified folder. For more information, see https://developers.docusign.com/docs/esign-rest-api/reference/folders/folders/listitems/
IncludeFile "CkHttp.pb" IncludeFile "CkStringBuilder.pb" IncludeFile "CkJsonObject.pb" Procedure ChilkatExample() ; This example assumes the Chilkat API to have been previously unlocked. ; See Global Unlock Sample for sample code. http.i = CkHttp::ckCreate() If http.i = 0 Debug "Failed to create object." ProcedureReturn EndIf success.i ; Implements the following HTTP request: ; GET /restapi/v2.1/accounts/{accountId}/folders/{folderId} ; Adds the "Authorization: Bearer eyJ0eXAi.....UE8Kl_V8KroQ" header. jsonToken.i = CkJsonObject::ckCreate() If jsonToken.i = 0 Debug "Failed to create object." ProcedureReturn EndIf ; Load a previously obtained OAuth2 access token. success = CkJsonObject::ckLoadFile(jsonToken,"qa_data/tokens/docusign.json") If success = 0 Debug CkJsonObject::ckLastErrorText(jsonToken) CkHttp::ckDispose(http) CkJsonObject::ckDispose(jsonToken) ProcedureReturn EndIf CkHttp::setCkAuthToken(http, CkJsonObject::ckStringOf(jsonToken,"access_token")) ; Use your account ID and a valid folderId here: CkHttp::ckSetUrlVar(http,"accountId","7f3f65ed-5e87-418d-94c1-92499ddc8252") CkHttp::ckSetUrlVar(http,"folderId","94644782-31b7-4f82-a2c1-26d8a9306f8c") sbResponseBody.i = CkStringBuilder::ckCreate() If sbResponseBody.i = 0 Debug "Failed to create object." ProcedureReturn EndIf success = CkHttp::ckQuickGetSb(http,"https://demo.docusign.net/restapi/v2.1/accounts/{$accountId}/folders/{$folderId}",sbResponseBody) If success = 0 Debug CkHttp::ckLastErrorText(http) CkHttp::ckDispose(http) CkJsonObject::ckDispose(jsonToken) CkStringBuilder::ckDispose(sbResponseBody) ProcedureReturn EndIf jResp.i = CkJsonObject::ckCreate() If jResp.i = 0 Debug "Failed to create object." ProcedureReturn EndIf CkJsonObject::ckLoadSb(jResp,sbResponseBody) CkJsonObject::setCkEmitCompact(jResp, 0) Debug "Response Body:" Debug CkJsonObject::ckEmit(jResp) respStatusCode.i = CkHttp::ckLastStatus(http) Debug "Response Status Code = " + Str(respStatusCode) If respStatusCode >= 400 Debug "Response Header:" Debug CkHttp::ckLastHeader(http) Debug "Failed." CkHttp::ckDispose(http) CkJsonObject::ckDispose(jsonToken) CkStringBuilder::ckDispose(sbResponseBody) CkJsonObject::ckDispose(jResp) ProcedureReturn 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 ownerName.s envelopeId.s envelopeUri.s status.s senderName.s senderEmail.s createdDateTime.s sentDateTime.s completedDateTime.s subject.s templateId.s name.s shared.s password.s description.s lastModified.s pageCount.i uri.s is21CFRPart11.s isSignatureProviderEnvelope.s j.i count_j.i fieldId.s show.s required.s value.s configurationType.s errorDetailsErrorCode.s errorDetailsMessage.s resultSetSize.s = CkJsonObject::ckStringOf(jResp,"resultSetSize") startPosition.s = CkJsonObject::ckStringOf(jResp,"startPosition") endPosition.s = CkJsonObject::ckStringOf(jResp,"endPosition") totalSetSize.s = CkJsonObject::ckStringOf(jResp,"totalSetSize") previousUri.s = CkJsonObject::ckStringOf(jResp,"previousUri") nextUri.s = CkJsonObject::ckStringOf(jResp,"nextUri") i.i = 0 count_i.i = CkJsonObject::ckSizeOfArray(jResp,"folderItems") While i < count_i CkJsonObject::setCkI(jResp, i) ownerName = CkJsonObject::ckStringOf(jResp,"folderItems[i].ownerName") envelopeId = CkJsonObject::ckStringOf(jResp,"folderItems[i].envelopeId") envelopeUri = CkJsonObject::ckStringOf(jResp,"folderItems[i].envelopeUri") status = CkJsonObject::ckStringOf(jResp,"folderItems[i].status") senderName = CkJsonObject::ckStringOf(jResp,"folderItems[i].senderName") senderEmail = CkJsonObject::ckStringOf(jResp,"folderItems[i].senderEmail") createdDateTime = CkJsonObject::ckStringOf(jResp,"folderItems[i].createdDateTime") sentDateTime = CkJsonObject::ckStringOf(jResp,"folderItems[i].sentDateTime") completedDateTime = CkJsonObject::ckStringOf(jResp,"folderItems[i].completedDateTime") subject = CkJsonObject::ckStringOf(jResp,"folderItems[i].subject") templateId = CkJsonObject::ckStringOf(jResp,"folderItems[i].templateId") name = CkJsonObject::ckStringOf(jResp,"folderItems[i].name") shared = CkJsonObject::ckStringOf(jResp,"folderItems[i].shared") password = CkJsonObject::ckStringOf(jResp,"folderItems[i].password") description = CkJsonObject::ckStringOf(jResp,"folderItems[i].description") lastModified = CkJsonObject::ckStringOf(jResp,"folderItems[i].lastModified") pageCount = CkJsonObject::ckIntOf(jResp,"folderItems[i].pageCount") uri = CkJsonObject::ckStringOf(jResp,"folderItems[i].uri") is21CFRPart11 = CkJsonObject::ckStringOf(jResp,"folderItems[i].is21CFRPart11") isSignatureProviderEnvelope = CkJsonObject::ckStringOf(jResp,"folderItems[i].isSignatureProviderEnvelope") j = 0 count_j = CkJsonObject::ckSizeOfArray(jResp,"folderItems[i].customFields") While j < count_j CkJsonObject::setCkJ(jResp, j) fieldId = CkJsonObject::ckStringOf(jResp,"folderItems[i].customFields[j].fieldId") name = CkJsonObject::ckStringOf(jResp,"folderItems[i].customFields[j].name") show = CkJsonObject::ckStringOf(jResp,"folderItems[i].customFields[j].show") required = CkJsonObject::ckStringOf(jResp,"folderItems[i].customFields[j].required") value = CkJsonObject::ckStringOf(jResp,"folderItems[i].customFields[j].value") configurationType = CkJsonObject::ckStringOf(jResp,"folderItems[i].customFields[j].configurationType") errorDetailsErrorCode = CkJsonObject::ckStringOf(jResp,"folderItems[i].customFields[j].errorDetails.errorCode") errorDetailsMessage = CkJsonObject::ckStringOf(jResp,"folderItems[i].customFields[j].errorDetails.message") j = j + 1 Wend i = i + 1 Wend CkHttp::ckDispose(http) CkJsonObject::ckDispose(jsonToken) CkStringBuilder::ckDispose(sbResponseBody) CkJsonObject::ckDispose(jResp) ProcedureReturn EndProcedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.