PowerBuilder
PowerBuilder
Yousign: List Files
See more Yousign Examples
List Yousign files.Chilkat PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Http
oleobject loo_SbResponseBody
oleobject loo_Json
integer li_RespStatusCode
string ls_Id
string ls_Name
string ls_V_type
string ls_ContentType
string ls_Description
string ls_CreatedAt
string ls_UpdatedAt
string ls_Sha256
string ls_Workspace
string ls_Creator
integer li_V_protected
integer li_Position
string ls_Parent
integer li_FieldsCompatible
string ls_Company
integer i
integer li_Count_i
li_Success = 0
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
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/files' \
// --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
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")
li_Success = loo_Http.QuickGetSb("https://staging-api.yousign.com/files",loo_SbResponseBody)
if li_Success = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_SbResponseBody
return
end if
loo_Json = create oleobject
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")
loo_Json.LoadSb(loo_SbResponseBody)
loo_Json.EmitCompact = 0
Write-Debug "Response Body:"
Write-Debug loo_Json.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_Json
return
end if
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "id": "\/files\/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
// "name": "abc.pdf",
// "type": "signable",
// "contentType": "application\/pdf",
// "description": null,
// "createdAt": "2020-05-27T09:14:12+02:00",
// "updatedAt": "2020-05-27T09:14:12+02:00",
// "sha256": "ea2a92b0eff5bebfa3ccd869fd61e27bb7fe973d0dff63f106d8b0d614469fa0",
// "metadata": [
// ],
// "workspace": "\/workspaces\/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
// "creator": null,
// "fileObjects": [
// ],
// "protected": false,
// "position": 0,
// "parent": null,
// "fieldsCompatible": true,
// "company": "\/companies\/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
// }
// Use the following online tool to generate parsing code from sample JSON:
// Generate Parsing Code from JSON
ls_Id = loo_Json.StringOf("id")
ls_Name = loo_Json.StringOf("name")
ls_V_type = loo_Json.StringOf("type")
ls_ContentType = loo_Json.StringOf("contentType")
ls_Description = loo_Json.StringOf("description")
ls_CreatedAt = loo_Json.StringOf("createdAt")
ls_UpdatedAt = loo_Json.StringOf("updatedAt")
ls_Sha256 = loo_Json.StringOf("sha256")
ls_Workspace = loo_Json.StringOf("workspace")
ls_Creator = loo_Json.StringOf("creator")
li_V_protected = loo_Json.BoolOf("protected")
li_Position = loo_Json.IntOf("position")
ls_Parent = loo_Json.StringOf("parent")
li_FieldsCompatible = loo_Json.BoolOf("fieldsCompatible")
ls_Company = loo_Json.StringOf("company")
i = 0
li_Count_i = loo_Json.SizeOfArray("metadata")
do while i < li_Count_i
loo_Json.I = i
i = i + 1
loop
i = 0
li_Count_i = loo_Json.SizeOfArray("fileObjects")
do while i < li_Count_i
loo_Json.I = i
i = i + 1
loop
destroy loo_Http
destroy loo_SbResponseBody
destroy loo_Json