Chilkat Online Tools

Objective-C / EPC 2.0 - Partner Sandbox - 19.4 November [External] / Stream Resource

Back to Collection Items

#import <CkoHttp.h>
#import <CkoBinData.h>
#import <CkoHttpResponse.h>

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

CkoHttp *http = [[CkoHttp alloc] init];
BOOL success;

CkoBinData *bdRequestBody = [[CkoBinData alloc] init];
success = [bdRequestBody LoadFile: @"file"];
if (success != YES) {
    NSLog(@"%@",@"Failed to load file");
    return;
}

[http SetRequestHeader: @"Authorization" value: @"{{partner_resource_authorization_header}}"];

CkoHttpResponse *resp = [http PBinaryBd: @"PUT" url: @"https://domain.com/" data: bdRequestBody contentType: @"{{partner_resource_mimeType}}" md5: NO gzip: NO];
if (http.LastMethodSuccess == NO) {
    NSLog(@"%@",http.LastErrorText);
    return;
}

NSLog(@"%d",[resp.StatusCode intValue]);
NSLog(@"%@",resp.BodyStr);

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": [
  ]
}