Chilkat Online Tools

TCL / EPC 2.0 - Partner Sandbox - 19.4 November [External] / Stream Resource

Back to Collection Items

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]

set bdRequestBody [new_CkBinData]

set success [CkBinData_LoadFile $bdRequestBody "file"]
if {$success != 1} then {
    puts "Failed to load file"
    delete_CkHttp $http
    delete_CkBinData $bdRequestBody
    exit
}

CkHttp_SetRequestHeader $http "Authorization" "{{partner_resource_authorization_header}}"

# resp is a CkHttpResponse
set resp [CkHttp_PBinaryBd $http "PUT" "https://domain.com/" $bdRequestBody "{{partner_resource_mimeType}}" 0 0]
if {[CkHttp_get_LastMethodSuccess $http] == 0} then {
    puts [CkHttp_lastErrorText $http]
    delete_CkHttp $http
    delete_CkBinData $bdRequestBody
    exit
}

puts [CkHttpResponse_get_StatusCode $resp]
puts [CkHttpResponse_bodyStr $resp]
delete_CkHttpResponse $resp


delete_CkHttp $http
delete_CkBinData $bdRequestBody

Curl Command

curl -X PUT
	-H "Authorization: {{partner_resource_authorization_header}}"
	-H "Content-Type: {{partner_resource_mimeType}}"
	--data-binary '@file'
https://domain.com/

Postman Collection Item JSON

{
  "name": "Stream Resource",
  "_postman_id": "42a10928-705a-4438-8ebe-34ff972cc25d",
  "request": {
    "method": "PUT",
    "header": [
      {
        "key": "Authorization",
        "value": "{{partner_resource_authorization_header}}",
        "type": "text"
      },
      {
        "key": "Content-Type",
        "value": "{{partner_resource_mimeType}}",
        "type": "text"
      }
    ],
    "body": {
      "mode": "file",
      "file": {
        "src": ""
      }
    },
    "url": "{{partner_resource_location}}"
  },
  "response": [
  ]
}