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) Yousign: Making your first API callDemonstrates making the simplest of calls to test your API key. This example tests using the sandbox URLs. For more information, see https://dev.yousign.com/?version=latest#c803dbec-2afb-4b2d-b70b-b42e5c8cbc9a
integer li_rc oleobject loo_Http integer li_Success oleobject loo_SbResponseBody oleobject loo_JResp integer li_RespStatusCode string ls_Name string ls_StrVal string ls_Id string ls_Firstname string ls_Lastname string ls_Email string ls_Title string ls_Phone string ls_Status string ls_Organization string ls_Permission string ls_GroupId string ls_GroupName string ls_CreatedAt string ls_UpdatedAt integer li_Deleted string ls_DeletedAt string ls_InweboUserRequest string ls_SamlNameId string ls_DefaultSignImage integer li_NotificationsProcedure integer li_FastSign string ls_FullName 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 --location --request GET 'https://staging-api.yousign.com/users' \ // --header 'Authorization: Bearer YOUR_API_KEY' \ // --header 'Content-Type: application/json' // 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 YOUR_API_KEY" header. loo_Http.AuthToken = "YOUR_API_KEY" loo_Http.SetRequestHeader("Content-Type","application/json") 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://staging-api.yousign.com/users",loo_SbResponseBody) if li_Success = 0 then Write-Debug loo_Http.LastErrorText destroy loo_Http destroy loo_SbResponseBody return end if loo_JResp = create oleobject // Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject") loo_JResp.LoadSb(loo_SbResponseBody) loo_JResp.EmitCompact = 0 Write-Debug "Response Body:" Write-Debug loo_JResp.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_SbResponseBody destroy loo_JResp return end if // Sample JSON response: // (Sample code for parsing the JSON response is shown below) // { // "id": "/users/XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", // "firstname": "John", // "lastname": "Doe", // "email": "john.doe@yousign.fr", // "title": "Developer", // "phone": "+33612345678", // "status": "activated", // "organization": "/organizations/XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", // "workspaces": [ // { // "id": "/workspaces/XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", // "name": "Acme" // } // ], // "permission": "ROLE_ADMIN", // "group": { // "id": "/user_groups/XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", // "name": "Administrateur", // "permissions": [ // "procedure_write", // "procedure_template_write", // "procedure_create_from_template", // "contact", // "sign", // "organization", // "user", // "api_key", // "procedure_custom_field", // "signature_ui", // "certificate", // "archive" // ] // }, // "createdAt": "2018-12-01T09:42:25+01:00", // "updatedAt": "2018-12-01T09:42:25+01:00", // "deleted": false, // "deletedAt": null, // "config": [ // ], // "inweboUserRequest": null, // "samlNameId": null, // "defaultSignImage": null, // "notifications": { // "procedure": true // }, // "fastSign": false, // "fullName": "John Doe" // } // 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_Id = loo_JResp.StringOf("id") ls_Firstname = loo_JResp.StringOf("firstname") ls_Lastname = loo_JResp.StringOf("lastname") ls_Email = loo_JResp.StringOf("email") ls_Title = loo_JResp.StringOf("title") ls_Phone = loo_JResp.StringOf("phone") ls_Status = loo_JResp.StringOf("status") ls_Organization = loo_JResp.StringOf("organization") ls_Permission = loo_JResp.StringOf("permission") ls_GroupId = loo_JResp.StringOf("group.id") ls_GroupName = loo_JResp.StringOf("group.name") ls_CreatedAt = loo_JResp.StringOf("createdAt") ls_UpdatedAt = loo_JResp.StringOf("updatedAt") li_Deleted = loo_JResp.BoolOf("deleted") ls_DeletedAt = loo_JResp.StringOf("deletedAt") ls_InweboUserRequest = loo_JResp.StringOf("inweboUserRequest") ls_SamlNameId = loo_JResp.StringOf("samlNameId") ls_DefaultSignImage = loo_JResp.StringOf("defaultSignImage") li_NotificationsProcedure = loo_JResp.BoolOf("notifications.procedure") li_FastSign = loo_JResp.BoolOf("fastSign") ls_FullName = loo_JResp.StringOf("fullName") i = 0 li_Count_i = loo_JResp.SizeOfArray("workspaces") do while i < li_Count_i loo_JResp.I = i ls_Id = loo_JResp.StringOf("workspaces[i].id") ls_Name = loo_JResp.StringOf("workspaces[i].name") i = i + 1 loop i = 0 li_Count_i = loo_JResp.SizeOfArray("group.permissions") do while i < li_Count_i loo_JResp.I = i ls_StrVal = loo_JResp.StringOf("group.permissions[i]") i = i + 1 loop i = 0 li_Count_i = loo_JResp.SizeOfArray("config") do while i < li_Count_i loo_JResp.I = i i = i + 1 loop destroy loo_Http destroy loo_SbResponseBody destroy loo_JResp |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.