Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

Tcl Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Security Token Service
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon SP-API
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Banco Inter
Belgian eHealth Platform
Bitfinex v2 REST
Bluzone
BrickLink
Bunny CDN
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Egypt eReceipt
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Google Translate
Google Vision
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
JCC Cyprus
Jira
Lightspeed
MYOB
Magento
Mailgun
Malaysia MyInvois

Mastercard
MedTunnel
MercadoLibre
MessageMedia
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
OpenAI ChatGPT
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Refinitiv
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
Salesforce
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
TikTok Shop
Trello
Twilio
Twitter API v2
Twitter v1
UPS
UniPin
VoiceBase
Vonage
WaTrend
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yapily
Yousign
ZATCA
Zendesk
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(Tcl) Yousign Create Procedure after Uploading the PDF

Demonstrates 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

Chilkat Tcl Extension Downloads

Chilkat Tcl Extension Downloads

load ./chilkat.dll

# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

set http [new_CkHttp]

# 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"
#         }
#       ]
#     }
#   ]
# }

set json [new_CkJsonObject]

CkJsonObject_UpdateString $json "name" "My first procedure"
CkJsonObject_UpdateString $json "description" "Awesome! Here is the description of my first procedure"
CkJsonObject_UpdateString $json "members[0].firstname" "John"
CkJsonObject_UpdateString $json "members[0].lastname" "Doe"
CkJsonObject_UpdateString $json "members[0].email" "john.doe@yousign.fr"
CkJsonObject_UpdateString $json "members[0].phone" "+33612345678"
CkJsonObject_UpdateString $json "members[0].fileObjects[0].file" "/files/6c123a8d-e5cf-4534-8da0-81886376ba2c"
CkJsonObject_UpdateInt $json "members[0].fileObjects[0].page" 2
CkJsonObject_UpdateString $json "members[0].fileObjects[0].position" "230,499,464,589"
CkJsonObject_UpdateString $json "members[0].fileObjects[0].mention" "Read and approved"
CkJsonObject_UpdateString $json "members[0].fileObjects[0].mention2" "Signed by John Doe"

# Adds the "Authorization: Bearer YOUR_API_KEY" header.
CkHttp_put_AuthToken $http "YOUR_API_KEY"
CkHttp_SetRequestHeader $http "Content-Type" "application/json"

# resp is a CkHttpResponse
set resp [CkHttp_PostJson3 $http "https://staging-api.yousign.com/procedures" "application/json" $json]
if {[CkHttp_get_LastMethodSuccess $http] == 0} then {
    puts [CkHttp_lastErrorText $http]
    delete_CkHttp $http
    delete_CkJsonObject $json
    exit
}

set sbResponseBody [new_CkStringBuilder]

CkHttpResponse_GetBodySb $resp $sbResponseBody
set jResp [new_CkJsonObject]

CkJsonObject_LoadSb $jResp $sbResponseBody
CkJsonObject_put_EmitCompact $jResp 0

puts "Response Body:"
puts [CkJsonObject_emit $jResp]

set respStatusCode [CkHttpResponse_get_StatusCode $resp]
puts "Response Status Code = $respStatusCode"
if {$respStatusCode >= 400} then {
    puts "Response Header:"
    puts [CkHttpResponse_header $resp]
    puts "Failed."
    delete_CkHttpResponse $resp

    delete_CkHttp $http
    delete_CkJsonObject $json
    delete_CkStringBuilder $sbResponseBody
    delete_CkJsonObject $jResp
    exit
}

delete_CkHttpResponse $resp

# 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

set id [CkJsonObject_stringOf $jResp "id"]
set name [CkJsonObject_stringOf $jResp "name"]
set description [CkJsonObject_stringOf $jResp "description"]
set createdAt [CkJsonObject_stringOf $jResp "createdAt"]
set updatedAt [CkJsonObject_stringOf $jResp "updatedAt"]
set finishedAt [CkJsonObject_stringOf $jResp "finishedAt"]
set expiresAt [CkJsonObject_stringOf $jResp "expiresAt"]
set status [CkJsonObject_stringOf $jResp "status"]
set creator [CkJsonObject_stringOf $jResp "creator"]
set creatorFirstName [CkJsonObject_stringOf $jResp "creatorFirstName"]
set creatorLastName [CkJsonObject_stringOf $jResp "creatorLastName"]
set workspace [CkJsonObject_stringOf $jResp "workspace"]
set template [CkJsonObject_BoolOf $jResp "template"]
set ordered [CkJsonObject_BoolOf $jResp "ordered"]
set parent [CkJsonObject_stringOf $jResp "parent"]
set relatedFilesEnable [CkJsonObject_BoolOf $jResp "relatedFilesEnable"]
set archive [CkJsonObject_BoolOf $jResp "archive"]
set i 0
set count_i [CkJsonObject_SizeOfArray $jResp "metadata"]
while {$i < $count_i} {
    CkJsonObject_put_I $jResp $i
    set i [expr $i + 1]
}
set i 0
set count_i [CkJsonObject_SizeOfArray $jResp "config"]
while {$i < $count_i} {
    CkJsonObject_put_I $jResp $i
    set i [expr $i + 1]
}
set i 0
set count_i [CkJsonObject_SizeOfArray $jResp "members"]
while {$i < $count_i} {
    CkJsonObject_put_I $jResp $i
    set id [CkJsonObject_stringOf $jResp "members[i].id"]
    set user [CkJsonObject_stringOf $jResp "members[i].user"]
    set v_type [CkJsonObject_stringOf $jResp "members[i].type"]
    set firstname [CkJsonObject_stringOf $jResp "members[i].firstname"]
    set lastname [CkJsonObject_stringOf $jResp "members[i].lastname"]
    set email [CkJsonObject_stringOf $jResp "members[i].email"]
    set phone [CkJsonObject_stringOf $jResp "members[i].phone"]
    set position [CkJsonObject_IntOf $jResp "members[i].position"]
    set createdAt [CkJsonObject_stringOf $jResp "members[i].createdAt"]
    set updatedAt [CkJsonObject_stringOf $jResp "members[i].updatedAt"]
    set finishedAt [CkJsonObject_stringOf $jResp "members[i].finishedAt"]
    set status [CkJsonObject_stringOf $jResp "members[i].status"]
    set comment [CkJsonObject_stringOf $jResp "members[i].comment"]
    set operationLevel [CkJsonObject_stringOf $jResp "members[i].operationLevel"]
    set operationModeSmsConfig [CkJsonObject_stringOf $jResp "members[i].operationModeSmsConfig"]
    set parent [CkJsonObject_stringOf $jResp "members[i].parent"]
    set j 0
    set count_j [CkJsonObject_SizeOfArray $jResp "members[i].fileObjects"]
    while {$j < $count_j} {
        CkJsonObject_put_J $jResp $j
        set id [CkJsonObject_stringOf $jResp "members[i].fileObjects[j].id"]
        set fileId [CkJsonObject_stringOf $jResp "members[i].fileObjects[j].file.id"]
        set fileName [CkJsonObject_stringOf $jResp "members[i].fileObjects[j].file.name"]
        set fileType [CkJsonObject_stringOf $jResp "members[i].fileObjects[j].file.type"]
        set fileContentType [CkJsonObject_stringOf $jResp "members[i].fileObjects[j].file.contentType"]
        set fileDescription [CkJsonObject_stringOf $jResp "members[i].fileObjects[j].file.description"]
        set fileCreatedAt [CkJsonObject_stringOf $jResp "members[i].fileObjects[j].file.createdAt"]
        set fileUpdatedAt [CkJsonObject_stringOf $jResp "members[i].fileObjects[j].file.updatedAt"]
        set fileSha256 [CkJsonObject_stringOf $jResp "members[i].fileObjects[j].file.sha256"]
        set fileWorkspace [CkJsonObject_stringOf $jResp "members[i].fileObjects[j].file.workspace"]
        set fileCreator [CkJsonObject_stringOf $jResp "members[i].fileObjects[j].file.creator"]
        set fileProtected [CkJsonObject_BoolOf $jResp "members[i].fileObjects[j].file.protected"]
        set filePosition [CkJsonObject_IntOf $jResp "members[i].fileObjects[j].file.position"]
        set fileParent [CkJsonObject_stringOf $jResp "members[i].fileObjects[j].file.parent"]
        set page [CkJsonObject_IntOf $jResp "members[i].fileObjects[j].page"]
        set position_str [CkJsonObject_stringOf $jResp "members[i].fileObjects[j].position"]
        set fieldName [CkJsonObject_stringOf $jResp "members[i].fileObjects[j].fieldName"]
        set mention [CkJsonObject_stringOf $jResp "members[i].fileObjects[j].mention"]
        set mention2 [CkJsonObject_stringOf $jResp "members[i].fileObjects[j].mention2"]
        set createdAt [CkJsonObject_stringOf $jResp "members[i].fileObjects[j].createdAt"]
        set updatedAt [CkJsonObject_stringOf $jResp "members[i].fileObjects[j].updatedAt"]
        set parent [CkJsonObject_stringOf $jResp "members[i].fileObjects[j].parent"]
        set reason [CkJsonObject_stringOf $jResp "members[i].fileObjects[j].reason"]
        set k 0
        set count_k [CkJsonObject_SizeOfArray $jResp "members[i].fileObjects[j].file.metadata"]
        while {$k < $count_k} {
            CkJsonObject_put_K $jResp $k
            set k [expr $k + 1]
        }
        set j [expr $j + 1]
    }
    set j 0
    set count_j [CkJsonObject_SizeOfArray $jResp "members[i].notificationsEmail"]
    while {$j < $count_j} {
        CkJsonObject_put_J $jResp $j
        set j [expr $j + 1]
    }
    set j 0
    set count_j [CkJsonObject_SizeOfArray $jResp "members[i].operationCustomModes"]
    while {$j < $count_j} {
        CkJsonObject_put_J $jResp $j
        set strVal [CkJsonObject_stringOf $jResp "members[i].operationCustomModes[j]"]
        set j [expr $j + 1]
    }
    set i [expr $i + 1]
}
set i 0
set count_i [CkJsonObject_SizeOfArray $jResp "subscribers"]
while {$i < $count_i} {
    CkJsonObject_put_I $jResp $i
    set i [expr $i + 1]
}
set i 0
set count_i [CkJsonObject_SizeOfArray $jResp "files"]
while {$i < $count_i} {
    CkJsonObject_put_I $jResp $i
    set id [CkJsonObject_stringOf $jResp "files[i].id"]
    set name [CkJsonObject_stringOf $jResp "files[i].name"]
    set v_type [CkJsonObject_stringOf $jResp "files[i].type"]
    set contentType [CkJsonObject_stringOf $jResp "files[i].contentType"]
    set description [CkJsonObject_stringOf $jResp "files[i].description"]
    set createdAt [CkJsonObject_stringOf $jResp "files[i].createdAt"]
    set updatedAt [CkJsonObject_stringOf $jResp "files[i].updatedAt"]
    set sha256 [CkJsonObject_stringOf $jResp "files[i].sha256"]
    set workspace [CkJsonObject_stringOf $jResp "files[i].workspace"]
    set creator [CkJsonObject_stringOf $jResp "files[i].creator"]
    set v_protected [CkJsonObject_BoolOf $jResp "files[i].protected"]
    set position [CkJsonObject_IntOf $jResp "files[i].position"]
    set parent [CkJsonObject_stringOf $jResp "files[i].parent"]
    set j 0
    set count_j [CkJsonObject_SizeOfArray $jResp "files[i].metadata"]
    while {$j < $count_j} {
        CkJsonObject_put_J $jResp $j
        set j [expr $j + 1]
    }
    set i [expr $i + 1]
}
set i 0
set count_i [CkJsonObject_SizeOfArray $jResp "archiveMetadata"]
while {$i < $count_i} {
    CkJsonObject_put_I $jResp $i
    set i [expr $i + 1]
}
set i 0
set count_i [CkJsonObject_SizeOfArray $jResp "fields"]
while {$i < $count_i} {
    CkJsonObject_put_I $jResp $i
    set i [expr $i + 1]
}
set i 0
set count_i [CkJsonObject_SizeOfArray $jResp "permissions"]
while {$i < $count_i} {
    CkJsonObject_put_I $jResp $i
    set i [expr $i + 1]
}

delete_CkHttp $http
delete_CkJsonObject $json
delete_CkStringBuilder $sbResponseBody
delete_CkJsonObject $jResp

 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.