Back to Collection Items
LOCAL loHttp
LOCAL lnSuccess
LOCAL loBdRequestBody
LOCAL loResp
* This example assumes the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http')
loHttp = CreateObject('Chilkat.Http')
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.BinData')
loBdRequestBody = CreateObject('Chilkat.BinData')
lnSuccess = loBdRequestBody.LoadFile("file")
IF (lnSuccess <> 1) THEN
? "Failed to load file"
RELEASE loHttp
RELEASE loBdRequestBody
CANCEL
ENDIF
loHttp.SetRequestHeader("Authorization","{{partner_resource_authorization_header}}")
loResp = loHttp.PBinaryBd("PUT","https://domain.com/",loBdRequestBody,"{{partner_resource_mimeType}}",0,0)
IF (loHttp.LastMethodSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loBdRequestBody
CANCEL
ENDIF
? STR(loResp.StatusCode)
? loResp.BodyStr
RELEASE loResp
RELEASE loHttp
RELEASE loBdRequestBody
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": [
]
}