Back to Collection Items
#include <C_CkHttpW.h>
#include <C_CkBinDataW.h>
#include <C_CkHttpResponseW.h>
void ChilkatSample(void)
{
HCkHttpW http;
BOOL success;
HCkBinDataW bdRequestBody;
HCkHttpResponseW resp;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http = CkHttpW_Create();
bdRequestBody = CkBinDataW_Create();
success = CkBinDataW_LoadFile(bdRequestBody,L"file");
if (success != TRUE) {
wprintf(L"Failed to load file\n");
CkHttpW_Dispose(http);
CkBinDataW_Dispose(bdRequestBody);
return;
}
CkHttpW_SetRequestHeader(http,L"Authorization",L"{{partner_resource_authorization_header}}");
resp = CkHttpW_PBinaryBd(http,L"PUT",L"https://domain.com/",bdRequestBody,L"{{partner_resource_mimeType}}",FALSE,FALSE);
if (CkHttpW_getLastMethodSuccess(http) == FALSE) {
wprintf(L"%s\n",CkHttpW_lastErrorText(http));
CkHttpW_Dispose(http);
CkBinDataW_Dispose(bdRequestBody);
return;
}
wprintf(L"%d\n",CkHttpResponseW_getStatusCode(resp));
wprintf(L"%s\n",CkHttpResponseW_bodyStr(resp));
CkHttpResponseW_Dispose(resp);
CkHttpW_Dispose(http);
CkBinDataW_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": [
]
}