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
(PowerBuilder) Docusign: Return Brand Data Associated with a UserDemonstrates a call using an OAuth2 access token in combination with the account ID for which we have authorization. For more information, see https://developers.docusign.com/esign-rest-api/guides/authentication/oauth2-jsonwebtoken
integer li_rc oleobject loo_Http integer li_Success oleobject loo_JsonToken oleobject loo_SbResponseBody oleobject loo_Json integer li_RespStatusCode string ls_BrandCompany string ls_BrandId string ls_BrandName string ls_ErrorDetailsErrorCode string ls_ErrorDetailsMessage string ls_IsOverridingCompanyName string ls_IsSendingDefault string ls_IsSigningDefault string ls_LogosPrimary string ls_LogosSecondary string ls_LogosEmail string ls_ResourcesEmail string ls_ResourcesSending string ls_ResourcesSigning string ls_ResourcesSigningCaptive integer j integer li_Count_j string ls_LinkType string ls_UrlOrMailTo string ls_LinkText string ls_ShowLink string ls_EmailContentType string ls_Content string ls_EmailToLink string ls_RecipientBrandIdDefault string ls_SenderBrandIdDefault integer i integer li_Count_i // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. loo_Http = create oleobject // Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0 li_rc = loo_Http.ConnectToNewObject("Chilkat.Http") if li_rc < 0 then destroy loo_Http MessageBox("Error","Connecting to COM object failed") return end if // Implements the following CURL command: // curl --request GET https://account-d.docusign.com/restapi/v2/accounts/18b4799a-xxxx-xxxx-xxxx-b5b4b8a97604/brands --header "Authorization: Bearer eyJ0eXAi.....UE8Kl_V8KroQ" // Use the following online tool to generate HTTP code from a CURL command // Convert a cURL Command to HTTP Source Code // Adds the "Authorization: Bearer eyJ0eXAi.....UE8Kl_V8KroQ" header. loo_JsonToken = create oleobject // Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 li_rc = loo_JsonToken.ConnectToNewObject("Chilkat.JsonObject") // Load a previously obtained OAuth2 access token. li_Success = loo_JsonToken.LoadFile("qa_data/tokens/docusign.json") if li_Success = 0 then Write-Debug loo_JsonToken.LastErrorText destroy loo_Http destroy loo_JsonToken return end if loo_Http.AuthToken = loo_JsonToken.StringOf("access_token") // Use an account ID obtained from DocuSign Get User Account Data loo_SbResponseBody = create oleobject // Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0 li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder") li_Success = loo_Http.QuickGetSb("https://account-d.docusign.com/restapi/v2/accounts/18b4799a-xxxx-xxxx-xxxx-b5b4b8a97604/brands",loo_SbResponseBody) if li_Success = 0 then Write-Debug loo_Http.LastErrorText destroy loo_Http destroy loo_JsonToken destroy loo_SbResponseBody return end if loo_Json = create oleobject // Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject") loo_Json.LoadSb(loo_SbResponseBody) loo_Json.EmitCompact = 0 Write-Debug "Response Body:" Write-Debug loo_Json.Emit() li_RespStatusCode = loo_Http.LastStatus Write-Debug "Response Status Code = " + string(li_RespStatusCode) if li_RespStatusCode >= 400 then Write-Debug "Response Header:" Write-Debug loo_Http.LastHeader Write-Debug "Failed." destroy loo_Http destroy loo_JsonToken destroy loo_SbResponseBody destroy loo_Json return end if // Sample JSON response: // (Sample code for parsing the JSON response is shown below) // { // "recipientBrandIdDefault": "sample string 1", // "senderBrandIdDefault": "sample string 2", // "brands": [ // { // "brandCompany": "sample string 1", // "brandId": "sample string 2", // "brandName": "sample string 3", // "colors": [ // {} // ], // "errorDetails": { // "errorCode": "sample string 1", // "message": "sample string 2" // }, // "isOverridingCompanyName": "sample string 4", // "isSendingDefault": "sample string 5", // "isSigningDefault": "sample string 6", // "landingPages": [ // {} // ], // "links": [ // { // "linkType": "sample string 1", // "urlOrMailTo": "sample string 2", // "linkText": "sample string 3", // "showLink": "sample string 4" // } // ], // "emailContent": [ // { // "emailContentType": "sample string 1", // "content": "sample string 2", // "emailToLink": "sample string 3", // "linkText": "sample string 4" // } // ], // "logos": { // "primary": "sample string 1", // "secondary": "sample string 2", // "email": "sample string 3" // }, // "resources": { // "email": "sample string 1", // "sending": "sample string 2", // "signing": "sample string 3", // "signingCaptive": "sample string 4" // } // } // ] // } // Sample code for parsing the JSON response... // Use the following online tool to generate parsing code from sample JSON: // Generate Parsing Code from JSON ls_RecipientBrandIdDefault = loo_Json.StringOf("recipientBrandIdDefault") ls_SenderBrandIdDefault = loo_Json.StringOf("senderBrandIdDefault") i = 0 li_Count_i = loo_Json.SizeOfArray("brands") do while i < li_Count_i loo_Json.I = i ls_BrandCompany = loo_Json.StringOf("brands[i].brandCompany") ls_BrandId = loo_Json.StringOf("brands[i].brandId") ls_BrandName = loo_Json.StringOf("brands[i].brandName") ls_ErrorDetailsErrorCode = loo_Json.StringOf("brands[i].errorDetails.errorCode") ls_ErrorDetailsMessage = loo_Json.StringOf("brands[i].errorDetails.message") ls_IsOverridingCompanyName = loo_Json.StringOf("brands[i].isOverridingCompanyName") ls_IsSendingDefault = loo_Json.StringOf("brands[i].isSendingDefault") ls_IsSigningDefault = loo_Json.StringOf("brands[i].isSigningDefault") ls_LogosPrimary = loo_Json.StringOf("brands[i].logos.primary") ls_LogosSecondary = loo_Json.StringOf("brands[i].logos.secondary") ls_LogosEmail = loo_Json.StringOf("brands[i].logos.email") ls_ResourcesEmail = loo_Json.StringOf("brands[i].resources.email") ls_ResourcesSending = loo_Json.StringOf("brands[i].resources.sending") ls_ResourcesSigning = loo_Json.StringOf("brands[i].resources.signing") ls_ResourcesSigningCaptive = loo_Json.StringOf("brands[i].resources.signingCaptive") j = 0 li_Count_j = loo_Json.SizeOfArray("brands[i].colors") do while j < li_Count_j loo_Json.J = j j = j + 1 loop j = 0 li_Count_j = loo_Json.SizeOfArray("brands[i].landingPages") do while j < li_Count_j loo_Json.J = j j = j + 1 loop j = 0 li_Count_j = loo_Json.SizeOfArray("brands[i].links") do while j < li_Count_j loo_Json.J = j ls_LinkType = loo_Json.StringOf("brands[i].links[j].linkType") ls_UrlOrMailTo = loo_Json.StringOf("brands[i].links[j].urlOrMailTo") ls_LinkText = loo_Json.StringOf("brands[i].links[j].linkText") ls_ShowLink = loo_Json.StringOf("brands[i].links[j].showLink") j = j + 1 loop j = 0 li_Count_j = loo_Json.SizeOfArray("brands[i].emailContent") do while j < li_Count_j loo_Json.J = j ls_EmailContentType = loo_Json.StringOf("brands[i].emailContent[j].emailContentType") ls_Content = loo_Json.StringOf("brands[i].emailContent[j].content") ls_EmailToLink = loo_Json.StringOf("brands[i].emailContent[j].emailToLink") ls_LinkText = loo_Json.StringOf("brands[i].emailContent[j].linkText") j = j + 1 loop i = i + 1 loop destroy loo_Http destroy loo_JsonToken destroy loo_SbResponseBody destroy loo_Json |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.