Back to Collection Items
IncludeFile "CkHttp.pb"
IncludeFile "CkHttpResponse.pb"
IncludeFile "CkBinData.pb"
Procedure ChilkatExample()
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
http.i = CkHttp::ckCreate()
If http.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success.i
bdRequestBody.i = CkBinData::ckCreate()
If bdRequestBody.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success = CkBinData::ckLoadFile(bdRequestBody,"file")
If success <> 1
Debug "Failed to load file"
CkHttp::ckDispose(http)
CkBinData::ckDispose(bdRequestBody)
ProcedureReturn
EndIf
CkHttp::ckSetRequestHeader(http,"Authorization","{{partner_resource_authorization_header}}")
resp.i = CkHttp::ckPBinaryBd(http,"PUT","https://domain.com/",bdRequestBody,"{{partner_resource_mimeType}}",0,0)
If CkHttp::ckLastMethodSuccess(http) = 0
Debug CkHttp::ckLastErrorText(http)
CkHttp::ckDispose(http)
CkBinData::ckDispose(bdRequestBody)
ProcedureReturn
EndIf
Debug Str(CkHttpResponse::ckStatusCode(resp))
Debug CkHttpResponse::ckBodyStr(resp)
CkHttpResponse::ckDispose(resp)
CkHttp::ckDispose(http)
CkBinData::ckDispose(bdRequestBody)
ProcedureReturn
EndProcedure
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": [
]
}