Back to Collection Items
var
http: HCkHttp;
success: Boolean;
bdRequestBody: HCkBinData;
resp: HCkHttpResponse;
begin
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http := CkHttp_Create();
bdRequestBody := CkBinData_Create();
success := CkBinData_LoadFile(bdRequestBody,'file');
if (success <> True) then
begin
Memo1.Lines.Add('Failed to load file');
Exit;
end;
CkHttp_SetRequestHeader(http,'Authorization','{{partner_resource_authorization_header}}');
resp := CkHttp_PBinaryBd(http,'PUT','https://domain.com/',bdRequestBody,'{{partner_resource_mimeType}}',False,False);
if (CkHttp_getLastMethodSuccess(http) = False) then
begin
Memo1.Lines.Add(CkHttp__lastErrorText(http));
Exit;
end;
Memo1.Lines.Add(IntToStr(CkHttpResponse_getStatusCode(resp)));
Memo1.Lines.Add(CkHttpResponse__bodyStr(resp));
CkHttpResponse_Dispose(resp);
CkHttp_Dispose(http);
CkBinData_Dispose(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": "94addbd1-0de1-43f5-b53e-2dc7306e407e",
"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": [
]
}