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
(C) 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/
#include <C_CkHttp.h> #include <C_CkJsonObject.h> #include <C_CkStringBuilder.h> void ChilkatSample(void) { HCkHttp http; BOOL success; HCkJsonObject jsonToken; HCkStringBuilder sbResponseBody; HCkJsonObject jResp; int respStatusCode; const char *ownerName; const char *envelopeId; const char *envelopeUri; const char *status; const char *senderName; const char *senderEmail; const char *createdDateTime; const char *sentDateTime; const char *completedDateTime; const char *subject; const char *templateId; const char *name; const char *shared; const char *password; const char *description; const char *lastModified; int pageCount; const char *uri; const char *is21CFRPart11; const char *isSignatureProviderEnvelope; int j; int count_j; const char *fieldId; const char *show; const char *required; const char *value; const char *configurationType; const char *errorDetailsErrorCode; const char *errorDetailsMessage; const char *resultSetSize; const char *startPosition; const char *endPosition; const char *totalSetSize; const char *previousUri; const char *nextUri; int i; int count_i; // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. http = CkHttp_Create(); // Implements the following HTTP request: // GET /restapi/v2.1/accounts/{accountId}/folders/{folderId} // Adds the "Authorization: Bearer eyJ0eXAi.....UE8Kl_V8KroQ" header. jsonToken = CkJsonObject_Create(); // Load a previously obtained OAuth2 access token. success = CkJsonObject_LoadFile(jsonToken,"qa_data/tokens/docusign.json"); if (success == FALSE) { printf("%s\n",CkJsonObject_lastErrorText(jsonToken)); CkHttp_Dispose(http); CkJsonObject_Dispose(jsonToken); return; } CkHttp_putAuthToken(http,CkJsonObject_stringOf(jsonToken,"access_token")); // Use your account ID and a valid folderId here: CkHttp_SetUrlVar(http,"accountId","7f3f65ed-5e87-418d-94c1-92499ddc8252"); CkHttp_SetUrlVar(http,"folderId","94644782-31b7-4f82-a2c1-26d8a9306f8c"); sbResponseBody = CkStringBuilder_Create(); success = CkHttp_QuickGetSb(http,"https://demo.docusign.net/restapi/v2.1/accounts/{$accountId}/folders/{$folderId}",sbResponseBody); if (success == FALSE) { printf("%s\n",CkHttp_lastErrorText(http)); CkHttp_Dispose(http); CkJsonObject_Dispose(jsonToken); CkStringBuilder_Dispose(sbResponseBody); return; } jResp = CkJsonObject_Create(); CkJsonObject_LoadSb(jResp,sbResponseBody); CkJsonObject_putEmitCompact(jResp,FALSE); printf("Response Body:\n"); printf("%s\n",CkJsonObject_emit(jResp)); respStatusCode = CkHttp_getLastStatus(http); printf("Response Status Code = %d\n",respStatusCode); if (respStatusCode >= 400) { printf("Response Header:\n"); printf("%s\n",CkHttp_lastHeader(http)); printf("Failed.\n"); CkHttp_Dispose(http); CkJsonObject_Dispose(jsonToken); CkStringBuilder_Dispose(sbResponseBody); CkJsonObject_Dispose(jResp); return; } // 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 // Chilkat functions returning "const char *" return a pointer to temporary internal memory owned and managed by Chilkat. // See this example explaining how this memory should be used: const char * functions. resultSetSize = CkJsonObject_stringOf(jResp,"resultSetSize"); startPosition = CkJsonObject_stringOf(jResp,"startPosition"); endPosition = CkJsonObject_stringOf(jResp,"endPosition"); totalSetSize = CkJsonObject_stringOf(jResp,"totalSetSize"); previousUri = CkJsonObject_stringOf(jResp,"previousUri"); nextUri = CkJsonObject_stringOf(jResp,"nextUri"); i = 0; count_i = CkJsonObject_SizeOfArray(jResp,"folderItems"); while (i < count_i) { CkJsonObject_putI(jResp,i); ownerName = CkJsonObject_stringOf(jResp,"folderItems[i].ownerName"); envelopeId = CkJsonObject_stringOf(jResp,"folderItems[i].envelopeId"); envelopeUri = CkJsonObject_stringOf(jResp,"folderItems[i].envelopeUri"); status = CkJsonObject_stringOf(jResp,"folderItems[i].status"); senderName = CkJsonObject_stringOf(jResp,"folderItems[i].senderName"); senderEmail = CkJsonObject_stringOf(jResp,"folderItems[i].senderEmail"); createdDateTime = CkJsonObject_stringOf(jResp,"folderItems[i].createdDateTime"); sentDateTime = CkJsonObject_stringOf(jResp,"folderItems[i].sentDateTime"); completedDateTime = CkJsonObject_stringOf(jResp,"folderItems[i].completedDateTime"); subject = CkJsonObject_stringOf(jResp,"folderItems[i].subject"); templateId = CkJsonObject_stringOf(jResp,"folderItems[i].templateId"); name = CkJsonObject_stringOf(jResp,"folderItems[i].name"); shared = CkJsonObject_stringOf(jResp,"folderItems[i].shared"); password = CkJsonObject_stringOf(jResp,"folderItems[i].password"); description = CkJsonObject_stringOf(jResp,"folderItems[i].description"); lastModified = CkJsonObject_stringOf(jResp,"folderItems[i].lastModified"); pageCount = CkJsonObject_IntOf(jResp,"folderItems[i].pageCount"); uri = CkJsonObject_stringOf(jResp,"folderItems[i].uri"); is21CFRPart11 = CkJsonObject_stringOf(jResp,"folderItems[i].is21CFRPart11"); isSignatureProviderEnvelope = CkJsonObject_stringOf(jResp,"folderItems[i].isSignatureProviderEnvelope"); j = 0; count_j = CkJsonObject_SizeOfArray(jResp,"folderItems[i].customFields"); while (j < count_j) { CkJsonObject_putJ(jResp,j); fieldId = CkJsonObject_stringOf(jResp,"folderItems[i].customFields[j].fieldId"); name = CkJsonObject_stringOf(jResp,"folderItems[i].customFields[j].name"); show = CkJsonObject_stringOf(jResp,"folderItems[i].customFields[j].show"); required = CkJsonObject_stringOf(jResp,"folderItems[i].customFields[j].required"); value = CkJsonObject_stringOf(jResp,"folderItems[i].customFields[j].value"); configurationType = CkJsonObject_stringOf(jResp,"folderItems[i].customFields[j].configurationType"); errorDetailsErrorCode = CkJsonObject_stringOf(jResp,"folderItems[i].customFields[j].errorDetails.errorCode"); errorDetailsMessage = CkJsonObject_stringOf(jResp,"folderItems[i].customFields[j].errorDetails.message"); j = j + 1; } i = i + 1; } CkHttp_Dispose(http); CkJsonObject_Dispose(jsonToken); CkStringBuilder_Dispose(sbResponseBody); CkJsonObject_Dispose(jResp); } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.