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
(DataFlex) Yousign Create Procedure after Uploading the PDFDemonstrates the 2nd step of Yousign procedure creation. This is the call to create the procedure after previously uploading the PDF file. For more information, see https://dev.yousign.com/?version=latest#c2e03a8b-f782-4d3e-96d1-04517c083497
Use ChilkatAx-win32.pkg Procedure Test Handle hoHttp Boolean iSuccess Variant vJson Handle hoJson Variant vResp Handle hoResp Variant vSbResponseBody Handle hoSbResponseBody Handle hoJResp Integer iRespStatusCode String sUser String sV_type String sFirstname String sLastname String sEmail String sPhone Integer iPosition String sComment String sOperationLevel String sOperationModeSmsConfig Integer j Integer iCount_j String sFileId String sFileName String sFileType String sFileContentType String sFileDescription String sFileCreatedAt String sFileUpdatedAt String sFileSha256 String sFileWorkspace String sFileCreator Boolean iFileProtected Integer iFilePosition String sFileParent Integer iPage String sPosition_str String sFieldName String sMention String sMention2 String sReason Integer k Integer iCount_k String sStrVal String sContentType String sSha256 Boolean iV_protected String sId String sName String sDescription String sCreatedAt String sUpdatedAt String sFinishedAt String sExpiresAt String sStatus String sCreator String sCreatorFirstName String sCreatorLastName String sWorkspace Boolean iTemplate Boolean iOrdered String sParent Boolean iRelatedFilesEnable Boolean iArchive Integer i Integer iCount_i String sTemp1 Boolean bTemp1 // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. Get Create (RefClass(cComChilkatHttp)) To hoHttp If (Not(IsComObjectCreated(hoHttp))) Begin Send CreateComObject of hoHttp End // Implements the following CURL command: // curl --location --request POST 'https://staging-api.yousign.com/procedures' \ // --header 'Authorization: Bearer YOUR_API_KEY' \ // --header 'Content-Type: application/json' \ // --data-raw '{ // "name": "My first procedure", // "description": "Awesome! Here is the description of my first procedure", // "members": [ // { // "firstname": "John", // "lastname": "Doe", // "email": "john.doe@yousign.fr", // "phone": "+33612345678", // "fileObjects": [ // { // "file": "/files/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", // "page": 2, // "position": "230,499,464,589", // "mention": "Read and approved", // "mention2": "Signed by John Doe" // } // ] // } // ] // }' // Use the following online tool to generate HTTP code from a CURL command // Convert a cURL Command to HTTP Source Code // Use this online tool to generate code from sample JSON: // Generate Code to Create JSON // The following JSON is sent in the request body. // { // "name": "My first procedure", // "description": "Awesome! Here is the description of my first procedure", // "members": [ // { // "firstname": "John", // "lastname": "Doe", // "email": "john.doe@yousign.fr", // "phone": "+33612345678", // "fileObjects": [ // { // "file": "/files/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", // "page": 2, // "position": "230,499,464,589", // "mention": "Read and approved", // "mention2": "Signed by John Doe" // } // ] // } // ] // } Get Create (RefClass(cComChilkatJsonObject)) To hoJson If (Not(IsComObjectCreated(hoJson))) Begin Send CreateComObject of hoJson End Get ComUpdateString Of hoJson "name" "My first procedure" To iSuccess Get ComUpdateString Of hoJson "description" "Awesome! Here is the description of my first procedure" To iSuccess Get ComUpdateString Of hoJson "members[0].firstname" "John" To iSuccess Get ComUpdateString Of hoJson "members[0].lastname" "Doe" To iSuccess Get ComUpdateString Of hoJson "members[0].email" "john.doe@yousign.fr" To iSuccess Get ComUpdateString Of hoJson "members[0].phone" "+33612345678" To iSuccess Get ComUpdateString Of hoJson "members[0].fileObjects[0].file" "/files/6c123a8d-e5cf-4534-8da0-81886376ba2c" To iSuccess Get ComUpdateInt Of hoJson "members[0].fileObjects[0].page" 2 To iSuccess Get ComUpdateString Of hoJson "members[0].fileObjects[0].position" "230,499,464,589" To iSuccess Get ComUpdateString Of hoJson "members[0].fileObjects[0].mention" "Read and approved" To iSuccess Get ComUpdateString Of hoJson "members[0].fileObjects[0].mention2" "Signed by John Doe" To iSuccess // Adds the "Authorization: Bearer YOUR_API_KEY" header. Set ComAuthToken Of hoHttp To "YOUR_API_KEY" Send ComSetRequestHeader To hoHttp "Content-Type" "application/json" Get pvComObject of hoJson to vJson Get ComPostJson3 Of hoHttp "https://staging-api.yousign.com/procedures" "application/json" vJson To vResp If (IsComObject(vResp)) Begin Get Create (RefClass(cComChilkatHttpResponse)) To hoResp Set pvComObject Of hoResp To vResp End Get ComLastMethodSuccess Of hoHttp To bTemp1 If (bTemp1 = False) Begin Get ComLastErrorText Of hoHttp To sTemp1 Showln sTemp1 Procedure_Return End Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody If (Not(IsComObjectCreated(hoSbResponseBody))) Begin Send CreateComObject of hoSbResponseBody End Get pvComObject of hoSbResponseBody to vSbResponseBody Get ComGetBodySb Of hoResp vSbResponseBody To iSuccess Get Create (RefClass(cComChilkatJsonObject)) To hoJResp If (Not(IsComObjectCreated(hoJResp))) Begin Send CreateComObject of hoJResp End Get pvComObject of hoSbResponseBody to vSbResponseBody Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess Set ComEmitCompact Of hoJResp To False Showln "Response Body:" Get ComEmit Of hoJResp To sTemp1 Showln sTemp1 Get ComStatusCode Of hoResp To iRespStatusCode Showln "Response Status Code = " iRespStatusCode If (iRespStatusCode >= 400) Begin Showln "Response Header:" Get ComHeader Of hoResp To sTemp1 Showln sTemp1 Showln "Failed." Send Destroy of hoResp Procedure_Return End Send Destroy of hoResp // Sample JSON response: // (Sample code for parsing the JSON response is shown below) // { // "id": "/procedures/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", // "name": "My first procedure", // "description": "Awesome! Here is the description of my first procedure", // "createdAt": "2018-12-01T11:49:11+01:00", // "updatedAt": "2018-12-01T11:49:11+01:00", // "finishedAt": null, // "expiresAt": null, // "status": "active", // "creator": null, // "creatorFirstName": null, // "creatorLastName": null, // "workspace": "/workspaces/XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", // "template": false, // "ordered": false, // "parent": null, // "metadata": [ // ], // "config": [ // ], // "members": [ // { // "id": "/members/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", // "user": null, // "type": "signer", // "firstname": "John", // "lastname": "Doe", // "email": "john.doe@yousign.fr", // "phone": "+33612345678", // "position": 1, // "createdAt": "2018-12-01T11:49:11+01:00", // "updatedAt": "2018-12-01T11:49:11+01:00", // "finishedAt": null, // "status": "pending", // "fileObjects": [ // { // "id": "/file_objects/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", // "file": { // "id": "/files/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", // "name": "The best name for my file.pdf", // "type": "signable", // "contentType": "application/pdf", // "description": null, // "createdAt": "2018-12-01T11:36:20+01:00", // "updatedAt": "2018-12-01T11:49:11+01:00", // "sha256": "bb57ae2b2ca6ad0133a699350d1a6f6c8cdfde3cf872cf526585d306e4675cc2", // "metadata": [ // ], // "workspace": "/workspaces/XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", // "creator": null, // "protected": false, // "position": 0, // "parent": null // }, // "page": 2, // "position": "230,499,464,589", // "fieldName": null, // "mention": "Read and approved", // "mention2": "Signed by John Doe", // "createdAt": "2018-12-01T11:49:11+01:00", // "updatedAt": "2018-12-01T11:49:11+01:00", // "parent": null, // "reason": "Signed by Yousign" // } // ], // "comment": null, // "notificationsEmail": [ // ], // "operationLevel": "custom", // "operationCustomModes": [ // "sms" // ], // "operationModeSmsConfig": null, // "parent": null // } // ], // "subscribers": [ // ], // "files": [ // { // "id": "/files/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", // "name": "The best name for my file.pdf", // "type": "signable", // "contentType": "application/pdf", // "description": null, // "createdAt": "2018-12-01T11:36:20+01:00", // "updatedAt": "2018-12-01T11:49:11+01:00", // "sha256": "bb57ae2b2ca6ad0133a699350d1a6f6c8cdfde3cf872cf526585d306e4675cc2", // "metadata": [ // ], // "workspace": "/workspaces/XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", // "creator": null, // "protected": false, // "position": 0, // "parent": null // } // ], // "relatedFilesEnable": false, // "archive": false, // "archiveMetadata": [ // ], // "fields": [ // ], // "permissions": [ // ] // } // Sample code for parsing the JSON response... // Use the following online tool to generate parsing code from sample JSON: // Generate Parsing Code from JSON Get ComStringOf Of hoJResp "id" To sId Get ComStringOf Of hoJResp "name" To sName Get ComStringOf Of hoJResp "description" To sDescription Get ComStringOf Of hoJResp "createdAt" To sCreatedAt Get ComStringOf Of hoJResp "updatedAt" To sUpdatedAt Get ComStringOf Of hoJResp "finishedAt" To sFinishedAt Get ComStringOf Of hoJResp "expiresAt" To sExpiresAt Get ComStringOf Of hoJResp "status" To sStatus Get ComStringOf Of hoJResp "creator" To sCreator Get ComStringOf Of hoJResp "creatorFirstName" To sCreatorFirstName Get ComStringOf Of hoJResp "creatorLastName" To sCreatorLastName Get ComStringOf Of hoJResp "workspace" To sWorkspace Get ComBoolOf Of hoJResp "template" To iTemplate Get ComBoolOf Of hoJResp "ordered" To iOrdered Get ComStringOf Of hoJResp "parent" To sParent Get ComBoolOf Of hoJResp "relatedFilesEnable" To iRelatedFilesEnable Get ComBoolOf Of hoJResp "archive" To iArchive Move 0 To i Get ComSizeOfArray Of hoJResp "metadata" To iCount_i While (i < iCount_i) Set ComI Of hoJResp To i Move (i + 1) To i Loop Move 0 To i Get ComSizeOfArray Of hoJResp "config" To iCount_i While (i < iCount_i) Set ComI Of hoJResp To i Move (i + 1) To i Loop Move 0 To i Get ComSizeOfArray Of hoJResp "members" To iCount_i While (i < iCount_i) Set ComI Of hoJResp To i Get ComStringOf Of hoJResp "members[i].id" To sId Get ComStringOf Of hoJResp "members[i].user" To sUser Get ComStringOf Of hoJResp "members[i].type" To sV_type Get ComStringOf Of hoJResp "members[i].firstname" To sFirstname Get ComStringOf Of hoJResp "members[i].lastname" To sLastname Get ComStringOf Of hoJResp "members[i].email" To sEmail Get ComStringOf Of hoJResp "members[i].phone" To sPhone Get ComIntOf Of hoJResp "members[i].position" To iPosition Get ComStringOf Of hoJResp "members[i].createdAt" To sCreatedAt Get ComStringOf Of hoJResp "members[i].updatedAt" To sUpdatedAt Get ComStringOf Of hoJResp "members[i].finishedAt" To sFinishedAt Get ComStringOf Of hoJResp "members[i].status" To sStatus Get ComStringOf Of hoJResp "members[i].comment" To sComment Get ComStringOf Of hoJResp "members[i].operationLevel" To sOperationLevel Get ComStringOf Of hoJResp "members[i].operationModeSmsConfig" To sOperationModeSmsConfig Get ComStringOf Of hoJResp "members[i].parent" To sParent Move 0 To j Get ComSizeOfArray Of hoJResp "members[i].fileObjects" To iCount_j While (j < iCount_j) Set ComJ Of hoJResp To j Get ComStringOf Of hoJResp "members[i].fileObjects[j].id" To sId Get ComStringOf Of hoJResp "members[i].fileObjects[j].file.id" To sFileId Get ComStringOf Of hoJResp "members[i].fileObjects[j].file.name" To sFileName Get ComStringOf Of hoJResp "members[i].fileObjects[j].file.type" To sFileType Get ComStringOf Of hoJResp "members[i].fileObjects[j].file.contentType" To sFileContentType Get ComStringOf Of hoJResp "members[i].fileObjects[j].file.description" To sFileDescription Get ComStringOf Of hoJResp "members[i].fileObjects[j].file.createdAt" To sFileCreatedAt Get ComStringOf Of hoJResp "members[i].fileObjects[j].file.updatedAt" To sFileUpdatedAt Get ComStringOf Of hoJResp "members[i].fileObjects[j].file.sha256" To sFileSha256 Get ComStringOf Of hoJResp "members[i].fileObjects[j].file.workspace" To sFileWorkspace Get ComStringOf Of hoJResp "members[i].fileObjects[j].file.creator" To sFileCreator Get ComBoolOf Of hoJResp "members[i].fileObjects[j].file.protected" To iFileProtected Get ComIntOf Of hoJResp "members[i].fileObjects[j].file.position" To iFilePosition Get ComStringOf Of hoJResp "members[i].fileObjects[j].file.parent" To sFileParent Get ComIntOf Of hoJResp "members[i].fileObjects[j].page" To iPage Get ComStringOf Of hoJResp "members[i].fileObjects[j].position" To sPosition_str Get ComStringOf Of hoJResp "members[i].fileObjects[j].fieldName" To sFieldName Get ComStringOf Of hoJResp "members[i].fileObjects[j].mention" To sMention Get ComStringOf Of hoJResp "members[i].fileObjects[j].mention2" To sMention2 Get ComStringOf Of hoJResp "members[i].fileObjects[j].createdAt" To sCreatedAt Get ComStringOf Of hoJResp "members[i].fileObjects[j].updatedAt" To sUpdatedAt Get ComStringOf Of hoJResp "members[i].fileObjects[j].parent" To sParent Get ComStringOf Of hoJResp "members[i].fileObjects[j].reason" To sReason Move 0 To k Get ComSizeOfArray Of hoJResp "members[i].fileObjects[j].file.metadata" To iCount_k While (k < iCount_k) Set ComK Of hoJResp To k Move (k + 1) To k Loop Move (j + 1) To j Loop Move 0 To j Get ComSizeOfArray Of hoJResp "members[i].notificationsEmail" To iCount_j While (j < iCount_j) Set ComJ Of hoJResp To j Move (j + 1) To j Loop Move 0 To j Get ComSizeOfArray Of hoJResp "members[i].operationCustomModes" To iCount_j While (j < iCount_j) Set ComJ Of hoJResp To j Get ComStringOf Of hoJResp "members[i].operationCustomModes[j]" To sStrVal Move (j + 1) To j Loop Move (i + 1) To i Loop Move 0 To i Get ComSizeOfArray Of hoJResp "subscribers" To iCount_i While (i < iCount_i) Set ComI Of hoJResp To i Move (i + 1) To i Loop Move 0 To i Get ComSizeOfArray Of hoJResp "files" To iCount_i While (i < iCount_i) Set ComI Of hoJResp To i Get ComStringOf Of hoJResp "files[i].id" To sId Get ComStringOf Of hoJResp "files[i].name" To sName Get ComStringOf Of hoJResp "files[i].type" To sV_type Get ComStringOf Of hoJResp "files[i].contentType" To sContentType Get ComStringOf Of hoJResp "files[i].description" To sDescription Get ComStringOf Of hoJResp "files[i].createdAt" To sCreatedAt Get ComStringOf Of hoJResp "files[i].updatedAt" To sUpdatedAt Get ComStringOf Of hoJResp "files[i].sha256" To sSha256 Get ComStringOf Of hoJResp "files[i].workspace" To sWorkspace Get ComStringOf Of hoJResp "files[i].creator" To sCreator Get ComBoolOf Of hoJResp "files[i].protected" To iV_protected Get ComIntOf Of hoJResp "files[i].position" To iPosition Get ComStringOf Of hoJResp "files[i].parent" To sParent Move 0 To j Get ComSizeOfArray Of hoJResp "files[i].metadata" To iCount_j While (j < iCount_j) Set ComJ Of hoJResp To j Move (j + 1) To j Loop Move (i + 1) To i Loop Move 0 To i Get ComSizeOfArray Of hoJResp "archiveMetadata" To iCount_i While (i < iCount_i) Set ComI Of hoJResp To i Move (i + 1) To i Loop Move 0 To i Get ComSizeOfArray Of hoJResp "fields" To iCount_i While (i < iCount_i) Set ComI Of hoJResp To i Move (i + 1) To i Loop Move 0 To i Get ComSizeOfArray Of hoJResp "permissions" To iCount_i While (i < iCount_i) Set ComI Of hoJResp To i Move (i + 1) To i Loop End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.