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
(Visual Basic 6.0) 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. Dim http As New ChilkatHttp Dim success As Long ' 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" ' } ' ] ' } ' ] ' } Dim json As New ChilkatJsonObject success = json.UpdateString("name","My first procedure") success = json.UpdateString("description","Awesome! Here is the description of my first procedure") success = json.UpdateString("members[0].firstname","John") success = json.UpdateString("members[0].lastname","Doe") success = json.UpdateString("members[0].email","john.doe@yousign.fr") success = json.UpdateString("members[0].phone","+33612345678") success = json.UpdateString("members[0].fileObjects[0].file","/files/6c123a8d-e5cf-4534-8da0-81886376ba2c") success = json.UpdateInt("members[0].fileObjects[0].page",2) success = json.UpdateString("members[0].fileObjects[0].position","230,499,464,589") success = json.UpdateString("members[0].fileObjects[0].mention","Read and approved") success = json.UpdateString("members[0].fileObjects[0].mention2","Signed by John Doe") ' Adds the "Authorization: Bearer YOUR_API_KEY" header. http.AuthToken = "YOUR_API_KEY" http.SetRequestHeader "Content-Type","application/json" Dim resp As ChilkatHttpResponse Set resp = http.PostJson3("https://staging-api.yousign.com/procedures","application/json",json) If (http.LastMethodSuccess = 0) Then Debug.Print http.LastErrorText Exit Sub End If Dim sbResponseBody As New ChilkatStringBuilder success = resp.GetBodySb(sbResponseBody) Dim jResp As New ChilkatJsonObject success = jResp.LoadSb(sbResponseBody) jResp.EmitCompact = 0 Debug.Print "Response Body:" Debug.Print jResp.Emit() Dim respStatusCode As Long respStatusCode = resp.StatusCode Debug.Print "Response Status Code = " & respStatusCode If (respStatusCode >= 400) Then Debug.Print "Response Header:" Debug.Print resp.Header Debug.Print "Failed." Exit Sub End If ' 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 Dim user As String Dim v_type As String Dim firstname As String Dim lastname As String Dim email As String Dim phone As String Dim position As Long Dim comment As String Dim operationLevel As String Dim operationModeSmsConfig As String Dim j As Long Dim count_j As Long Dim fileId As String Dim fileName As String Dim fileType As String Dim fileContentType As String Dim fileDescription As String Dim fileCreatedAt As String Dim fileUpdatedAt As String Dim fileSha256 As String Dim fileWorkspace As String Dim fileCreator As String Dim fileProtected As Long Dim filePosition As Long Dim fileParent As String Dim page As Long Dim position_str As String Dim fieldName As String Dim mention As String Dim mention2 As String Dim reason As String Dim k As Long Dim count_k As Long Dim strVal As String Dim contentType As String Dim sha256 As String Dim v_protected As Long Dim id As String id = jResp.StringOf("id") Dim name As String name = jResp.StringOf("name") Dim description As String description = jResp.StringOf("description") Dim createdAt As String createdAt = jResp.StringOf("createdAt") Dim updatedAt As String updatedAt = jResp.StringOf("updatedAt") Dim finishedAt As String finishedAt = jResp.StringOf("finishedAt") Dim expiresAt As String expiresAt = jResp.StringOf("expiresAt") Dim status As String status = jResp.StringOf("status") Dim creator As String creator = jResp.StringOf("creator") Dim creatorFirstName As String creatorFirstName = jResp.StringOf("creatorFirstName") Dim creatorLastName As String creatorLastName = jResp.StringOf("creatorLastName") Dim workspace As String workspace = jResp.StringOf("workspace") Dim template As Long template = jResp.BoolOf("template") Dim ordered As Long ordered = jResp.BoolOf("ordered") Dim parent As String parent = jResp.StringOf("parent") Dim relatedFilesEnable As Long relatedFilesEnable = jResp.BoolOf("relatedFilesEnable") Dim archive As Long archive = jResp.BoolOf("archive") Dim i As Long i = 0 Dim count_i As Long count_i = jResp.SizeOfArray("metadata") Do While i < count_i jResp.I = i i = i + 1 Loop i = 0 count_i = jResp.SizeOfArray("config") Do While i < count_i jResp.I = i i = i + 1 Loop i = 0 count_i = jResp.SizeOfArray("members") Do While i < count_i jResp.I = i id = jResp.StringOf("members[i].id") user = jResp.StringOf("members[i].user") v_type = jResp.StringOf("members[i].type") firstname = jResp.StringOf("members[i].firstname") lastname = jResp.StringOf("members[i].lastname") email = jResp.StringOf("members[i].email") phone = jResp.StringOf("members[i].phone") position = jResp.IntOf("members[i].position") createdAt = jResp.StringOf("members[i].createdAt") updatedAt = jResp.StringOf("members[i].updatedAt") finishedAt = jResp.StringOf("members[i].finishedAt") status = jResp.StringOf("members[i].status") comment = jResp.StringOf("members[i].comment") operationLevel = jResp.StringOf("members[i].operationLevel") operationModeSmsConfig = jResp.StringOf("members[i].operationModeSmsConfig") parent = jResp.StringOf("members[i].parent") j = 0 count_j = jResp.SizeOfArray("members[i].fileObjects") Do While j < count_j jResp.J = j id = jResp.StringOf("members[i].fileObjects[j].id") fileId = jResp.StringOf("members[i].fileObjects[j].file.id") fileName = jResp.StringOf("members[i].fileObjects[j].file.name") fileType = jResp.StringOf("members[i].fileObjects[j].file.type") fileContentType = jResp.StringOf("members[i].fileObjects[j].file.contentType") fileDescription = jResp.StringOf("members[i].fileObjects[j].file.description") fileCreatedAt = jResp.StringOf("members[i].fileObjects[j].file.createdAt") fileUpdatedAt = jResp.StringOf("members[i].fileObjects[j].file.updatedAt") fileSha256 = jResp.StringOf("members[i].fileObjects[j].file.sha256") fileWorkspace = jResp.StringOf("members[i].fileObjects[j].file.workspace") fileCreator = jResp.StringOf("members[i].fileObjects[j].file.creator") fileProtected = jResp.BoolOf("members[i].fileObjects[j].file.protected") filePosition = jResp.IntOf("members[i].fileObjects[j].file.position") fileParent = jResp.StringOf("members[i].fileObjects[j].file.parent") page = jResp.IntOf("members[i].fileObjects[j].page") position_str = jResp.StringOf("members[i].fileObjects[j].position") fieldName = jResp.StringOf("members[i].fileObjects[j].fieldName") mention = jResp.StringOf("members[i].fileObjects[j].mention") mention2 = jResp.StringOf("members[i].fileObjects[j].mention2") createdAt = jResp.StringOf("members[i].fileObjects[j].createdAt") updatedAt = jResp.StringOf("members[i].fileObjects[j].updatedAt") parent = jResp.StringOf("members[i].fileObjects[j].parent") reason = jResp.StringOf("members[i].fileObjects[j].reason") k = 0 count_k = jResp.SizeOfArray("members[i].fileObjects[j].file.metadata") Do While k < count_k jResp.K = k k = k + 1 Loop j = j + 1 Loop j = 0 count_j = jResp.SizeOfArray("members[i].notificationsEmail") Do While j < count_j jResp.J = j j = j + 1 Loop j = 0 count_j = jResp.SizeOfArray("members[i].operationCustomModes") Do While j < count_j jResp.J = j strVal = jResp.StringOf("members[i].operationCustomModes[j]") j = j + 1 Loop i = i + 1 Loop i = 0 count_i = jResp.SizeOfArray("subscribers") Do While i < count_i jResp.I = i i = i + 1 Loop i = 0 count_i = jResp.SizeOfArray("files") Do While i < count_i jResp.I = i id = jResp.StringOf("files[i].id") name = jResp.StringOf("files[i].name") v_type = jResp.StringOf("files[i].type") contentType = jResp.StringOf("files[i].contentType") description = jResp.StringOf("files[i].description") createdAt = jResp.StringOf("files[i].createdAt") updatedAt = jResp.StringOf("files[i].updatedAt") sha256 = jResp.StringOf("files[i].sha256") workspace = jResp.StringOf("files[i].workspace") creator = jResp.StringOf("files[i].creator") v_protected = jResp.BoolOf("files[i].protected") position = jResp.IntOf("files[i].position") parent = jResp.StringOf("files[i].parent") j = 0 count_j = jResp.SizeOfArray("files[i].metadata") Do While j < count_j jResp.J = j j = j + 1 Loop i = i + 1 Loop i = 0 count_i = jResp.SizeOfArray("archiveMetadata") Do While i < count_i jResp.I = i i = i + 1 Loop i = 0 count_i = jResp.SizeOfArray("fields") Do While i < count_i jResp.I = i i = i + 1 Loop i = 0 count_i = jResp.SizeOfArray("permissions") Do While i < count_i jResp.I = i i = i + 1 Loop |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.