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
(Go) 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
// This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. http := chilkat.NewHttp() var success bool // 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. jsonToken := chilkat.NewJsonObject() // Load a previously obtained OAuth2 access token. success = jsonToken.LoadFile("qa_data/tokens/docusign.json") if success == false { fmt.Println(jsonToken.LastErrorText()) http.DisposeHttp() jsonToken.DisposeJsonObject() return } http.SetAuthToken(jsonToken.StringOf("access_token")) // Use an account ID obtained from DocuSign Get User Account Data sbResponseBody := chilkat.NewStringBuilder() success = http.QuickGetSb("https://account-d.docusign.com/restapi/v2/accounts/18b4799a-xxxx-xxxx-xxxx-b5b4b8a97604/brands",sbResponseBody) if success == false { fmt.Println(http.LastErrorText()) http.DisposeHttp() jsonToken.DisposeJsonObject() sbResponseBody.DisposeStringBuilder() return } json := chilkat.NewJsonObject() json.LoadSb(sbResponseBody) json.SetEmitCompact(false) fmt.Println("Response Body:") fmt.Println(*json.Emit()) respStatusCode := http.LastStatus() fmt.Println("Response Status Code = ", respStatusCode) if respStatusCode >= 400 { fmt.Println("Response Header:") fmt.Println(http.LastHeader()) fmt.Println("Failed.") http.DisposeHttp() jsonToken.DisposeJsonObject() sbResponseBody.DisposeStringBuilder() json.DisposeJsonObject() return } // 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 var brandCompany *string = new(string) var brandId *string = new(string) var brandName *string = new(string) var errorDetailsErrorCode *string = new(string) var errorDetailsMessage *string = new(string) var isOverridingCompanyName *string = new(string) var isSendingDefault *string = new(string) var isSigningDefault *string = new(string) var logosPrimary *string = new(string) var logosSecondary *string = new(string) var logosEmail *string = new(string) var resourcesEmail *string = new(string) var resourcesSending *string = new(string) var resourcesSigning *string = new(string) var resourcesSigningCaptive *string = new(string) var j int var count_j int var linkType *string = new(string) var urlOrMailTo *string = new(string) var linkText *string = new(string) var showLink *string = new(string) var emailContentType *string = new(string) var content *string = new(string) var emailToLink *string = new(string) recipientBrandIdDefault := json.StringOf("recipientBrandIdDefault") senderBrandIdDefault := json.StringOf("senderBrandIdDefault") i := 0 count_i := json.SizeOfArray("brands") for i < count_i { json.SetI(i) brandCompany = json.StringOf("brands[i].brandCompany") brandId = json.StringOf("brands[i].brandId") brandName = json.StringOf("brands[i].brandName") errorDetailsErrorCode = json.StringOf("brands[i].errorDetails.errorCode") errorDetailsMessage = json.StringOf("brands[i].errorDetails.message") isOverridingCompanyName = json.StringOf("brands[i].isOverridingCompanyName") isSendingDefault = json.StringOf("brands[i].isSendingDefault") isSigningDefault = json.StringOf("brands[i].isSigningDefault") logosPrimary = json.StringOf("brands[i].logos.primary") logosSecondary = json.StringOf("brands[i].logos.secondary") logosEmail = json.StringOf("brands[i].logos.email") resourcesEmail = json.StringOf("brands[i].resources.email") resourcesSending = json.StringOf("brands[i].resources.sending") resourcesSigning = json.StringOf("brands[i].resources.signing") resourcesSigningCaptive = json.StringOf("brands[i].resources.signingCaptive") j = 0 count_j = json.SizeOfArray("brands[i].colors") for j < count_j { json.SetJ(j) j = j + 1 } j = 0 count_j = json.SizeOfArray("brands[i].landingPages") for j < count_j { json.SetJ(j) j = j + 1 } j = 0 count_j = json.SizeOfArray("brands[i].links") for j < count_j { json.SetJ(j) linkType = json.StringOf("brands[i].links[j].linkType") urlOrMailTo = json.StringOf("brands[i].links[j].urlOrMailTo") linkText = json.StringOf("brands[i].links[j].linkText") showLink = json.StringOf("brands[i].links[j].showLink") j = j + 1 } j = 0 count_j = json.SizeOfArray("brands[i].emailContent") for j < count_j { json.SetJ(j) emailContentType = json.StringOf("brands[i].emailContent[j].emailContentType") content = json.StringOf("brands[i].emailContent[j].content") emailToLink = json.StringOf("brands[i].emailContent[j].emailToLink") linkText = json.StringOf("brands[i].emailContent[j].linkText") j = j + 1 } i = i + 1 } http.DisposeHttp() jsonToken.DisposeJsonObject() sbResponseBody.DisposeStringBuilder() json.DisposeJsonObject() |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.