Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_BdRequestBody
oleobject loo_Resp
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
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
loo_BdRequestBody = create oleobject
// Use "Chilkat_9_5_0.BinData" for versions of Chilkat < 10.0.0
li_rc = loo_BdRequestBody.ConnectToNewObject("Chilkat.BinData")
li_Success = loo_BdRequestBody.LoadFile("file")
if li_Success <> 1 then
Write-Debug "Failed to load file"
destroy loo_Http
destroy loo_BdRequestBody
return
end if
loo_Http.SetRequestHeader("Authorization","{{partner_resource_authorization_header}}")
loo_Resp = loo_Http.PBinaryBd("PUT","https://domain.com/",loo_BdRequestBody,"{{partner_resource_mimeType}}",0,0)
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_BdRequestBody
return
end if
Write-Debug string(loo_Resp.StatusCode)
Write-Debug loo_Resp.BodyStr
destroy loo_Resp
destroy loo_Http
destroy loo_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": [
]
}