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
(AutoIt) 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
; This example assumes the Chilkat API to have been previously unlocked. ; See Global Unlock Sample for sample code. $oHttp = ObjCreate("Chilkat.Http") Local $bSuccess ; 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" ; } ; ] ; } ; ] ; } $oJson = ObjCreate("Chilkat.JsonObject") $oJson.UpdateString("name","My first procedure") $oJson.UpdateString("description","Awesome! Here is the description of my first procedure") $oJson.UpdateString("members[0].firstname","John") $oJson.UpdateString("members[0].lastname","Doe") $oJson.UpdateString("members[0].email","john.doe@yousign.fr") $oJson.UpdateString("members[0].phone","+33612345678") $oJson.UpdateString("members[0].fileObjects[0].file","/files/6c123a8d-e5cf-4534-8da0-81886376ba2c") $oJson.UpdateInt("members[0].fileObjects[0].page",2) $oJson.UpdateString("members[0].fileObjects[0].position","230,499,464,589") $oJson.UpdateString("members[0].fileObjects[0].mention","Read and approved") $oJson.UpdateString("members[0].fileObjects[0].mention2","Signed by John Doe") ; Adds the "Authorization: Bearer YOUR_API_KEY" header. $oHttp.AuthToken = "YOUR_API_KEY" $oHttp.SetRequestHeader "Content-Type","application/json" Local $oResp = $oHttp.PostJson3("https://staging-api.yousign.com/procedures","application/json",$oJson) If ($oHttp.LastMethodSuccess = False) Then ConsoleWrite($oHttp.LastErrorText & @CRLF) Exit EndIf $oSbResponseBody = ObjCreate("Chilkat.StringBuilder") $oResp.GetBodySb($oSbResponseBody) $oJResp = ObjCreate("Chilkat.JsonObject") $oJResp.LoadSb($oSbResponseBody) $oJResp.EmitCompact = False ConsoleWrite("Response Body:" & @CRLF) ConsoleWrite($oJResp.Emit() & @CRLF) Local $iRespStatusCode = $oResp.StatusCode ConsoleWrite("Response Status Code = " & $iRespStatusCode & @CRLF) If ($iRespStatusCode >= 400) Then ConsoleWrite("Response Header:" & @CRLF) ConsoleWrite($oResp.Header & @CRLF) ConsoleWrite("Failed." & @CRLF) Exit EndIf ; 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 Local $sUser Local $sV_type Local $sFirstname Local $sLastname Local $sEmail Local $sPhone Local $iPosition Local $sComment Local $sOperationLevel Local $sOperationModeSmsConfig Local $iJ Local $iCount_j Local $sFileId Local $sFileName Local $sFileType Local $sFileContentType Local $sFileDescription Local $sFileCreatedAt Local $sFileUpdatedAt Local $sFileSha256 Local $sFileWorkspace Local $sFileCreator Local $bFileProtected Local $iFilePosition Local $sFileParent Local $iPage Local $sPosition_str Local $sFieldName Local $sMention Local $sMention2 Local $sReason Local $iK Local $iCount_k Local $strVal Local $sContentType Local $sha256 Local $bV_protected Local $sId = $oJResp.StringOf("id") Local $sName = $oJResp.StringOf("name") Local $sDescription = $oJResp.StringOf("description") Local $sCreatedAt = $oJResp.StringOf("createdAt") Local $sUpdatedAt = $oJResp.StringOf("updatedAt") Local $sFinishedAt = $oJResp.StringOf("finishedAt") Local $sExpiresAt = $oJResp.StringOf("expiresAt") Local $status = $oJResp.StringOf("status") Local $sCreator = $oJResp.StringOf("creator") Local $sCreatorFirstName = $oJResp.StringOf("creatorFirstName") Local $sCreatorLastName = $oJResp.StringOf("creatorLastName") Local $sWorkspace = $oJResp.StringOf("workspace") Local $bTemplate = $oJResp.BoolOf("template") Local $bOrdered = $oJResp.BoolOf("ordered") Local $sParent = $oJResp.StringOf("parent") Local $bRelatedFilesEnable = $oJResp.BoolOf("relatedFilesEnable") Local $bArchive = $oJResp.BoolOf("archive") Local $i = 0 Local $iCount_i = $oJResp.SizeOfArray("metadata") While $i < $iCount_i $oJResp.I = $i $i = $i + 1 Wend $i = 0 $iCount_i = $oJResp.SizeOfArray("config") While $i < $iCount_i $oJResp.I = $i $i = $i + 1 Wend $i = 0 $iCount_i = $oJResp.SizeOfArray("members") While $i < $iCount_i $oJResp.I = $i $sId = $oJResp.StringOf("members[i].id") $sUser = $oJResp.StringOf("members[i].user") $sV_type = $oJResp.StringOf("members[i].type") $sFirstname = $oJResp.StringOf("members[i].firstname") $sLastname = $oJResp.StringOf("members[i].lastname") $sEmail = $oJResp.StringOf("members[i].email") $sPhone = $oJResp.StringOf("members[i].phone") $iPosition = $oJResp.IntOf("members[i].position") $sCreatedAt = $oJResp.StringOf("members[i].createdAt") $sUpdatedAt = $oJResp.StringOf("members[i].updatedAt") $sFinishedAt = $oJResp.StringOf("members[i].finishedAt") $status = $oJResp.StringOf("members[i].status") $sComment = $oJResp.StringOf("members[i].comment") $sOperationLevel = $oJResp.StringOf("members[i].operationLevel") $sOperationModeSmsConfig = $oJResp.StringOf("members[i].operationModeSmsConfig") $sParent = $oJResp.StringOf("members[i].parent") $iJ = 0 $iCount_j = $oJResp.SizeOfArray("members[i].fileObjects") While $iJ < $iCount_j $oJResp.J = $iJ $sId = $oJResp.StringOf("members[i].fileObjects[j].id") $sFileId = $oJResp.StringOf("members[i].fileObjects[j].file.id") $sFileName = $oJResp.StringOf("members[i].fileObjects[j].file.name") $sFileType = $oJResp.StringOf("members[i].fileObjects[j].file.type") $sFileContentType = $oJResp.StringOf("members[i].fileObjects[j].file.contentType") $sFileDescription = $oJResp.StringOf("members[i].fileObjects[j].file.description") $sFileCreatedAt = $oJResp.StringOf("members[i].fileObjects[j].file.createdAt") $sFileUpdatedAt = $oJResp.StringOf("members[i].fileObjects[j].file.updatedAt") $sFileSha256 = $oJResp.StringOf("members[i].fileObjects[j].file.sha256") $sFileWorkspace = $oJResp.StringOf("members[i].fileObjects[j].file.workspace") $sFileCreator = $oJResp.StringOf("members[i].fileObjects[j].file.creator") $bFileProtected = $oJResp.BoolOf("members[i].fileObjects[j].file.protected") $iFilePosition = $oJResp.IntOf("members[i].fileObjects[j].file.position") $sFileParent = $oJResp.StringOf("members[i].fileObjects[j].file.parent") $iPage = $oJResp.IntOf("members[i].fileObjects[j].page") $sPosition_str = $oJResp.StringOf("members[i].fileObjects[j].position") $sFieldName = $oJResp.StringOf("members[i].fileObjects[j].fieldName") $sMention = $oJResp.StringOf("members[i].fileObjects[j].mention") $sMention2 = $oJResp.StringOf("members[i].fileObjects[j].mention2") $sCreatedAt = $oJResp.StringOf("members[i].fileObjects[j].createdAt") $sUpdatedAt = $oJResp.StringOf("members[i].fileObjects[j].updatedAt") $sParent = $oJResp.StringOf("members[i].fileObjects[j].parent") $sReason = $oJResp.StringOf("members[i].fileObjects[j].reason") $iK = 0 $iCount_k = $oJResp.SizeOfArray("members[i].fileObjects[j].file.metadata") While $iK < $iCount_k $oJResp.K = $iK $iK = $iK + 1 Wend $iJ = $iJ + 1 Wend $iJ = 0 $iCount_j = $oJResp.SizeOfArray("members[i].notificationsEmail") While $iJ < $iCount_j $oJResp.J = $iJ $iJ = $iJ + 1 Wend $iJ = 0 $iCount_j = $oJResp.SizeOfArray("members[i].operationCustomModes") While $iJ < $iCount_j $oJResp.J = $iJ $strVal = $oJResp.StringOf("members[i].operationCustomModes[j]") $iJ = $iJ + 1 Wend $i = $i + 1 Wend $i = 0 $iCount_i = $oJResp.SizeOfArray("subscribers") While $i < $iCount_i $oJResp.I = $i $i = $i + 1 Wend $i = 0 $iCount_i = $oJResp.SizeOfArray("files") While $i < $iCount_i $oJResp.I = $i $sId = $oJResp.StringOf("files[i].id") $sName = $oJResp.StringOf("files[i].name") $sV_type = $oJResp.StringOf("files[i].type") $sContentType = $oJResp.StringOf("files[i].contentType") $sDescription = $oJResp.StringOf("files[i].description") $sCreatedAt = $oJResp.StringOf("files[i].createdAt") $sUpdatedAt = $oJResp.StringOf("files[i].updatedAt") $sha256 = $oJResp.StringOf("files[i].sha256") $sWorkspace = $oJResp.StringOf("files[i].workspace") $sCreator = $oJResp.StringOf("files[i].creator") $bV_protected = $oJResp.BoolOf("files[i].protected") $iPosition = $oJResp.IntOf("files[i].position") $sParent = $oJResp.StringOf("files[i].parent") $iJ = 0 $iCount_j = $oJResp.SizeOfArray("files[i].metadata") While $iJ < $iCount_j $oJResp.J = $iJ $iJ = $iJ + 1 Wend $i = $i + 1 Wend $i = 0 $iCount_i = $oJResp.SizeOfArray("archiveMetadata") While $i < $iCount_i $oJResp.I = $i $i = $i + 1 Wend $i = 0 $iCount_i = $oJResp.SizeOfArray("fields") While $i < $iCount_i $oJResp.I = $i $i = $i + 1 Wend $i = 0 $iCount_i = $oJResp.SizeOfArray("permissions") While $i < $iCount_i $oJResp.I = $i $i = $i + 1 Wend |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.