Chilkat Online Tools

phpExt / DocuSign REST API / Uploads a branding resource file.

Back to Collection Items

<?php

include("chilkat_9_5_0.php");

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

$http = new CkHttp();

$req = new CkHttpRequest();
$req->put_HttpVerb('PUT');
$req->put_Path('/v2.1/accounts/{{accountId}}/brands/{{brandId}}/resources/{{resourceContentType}}');
$req->put_ContentType('multipart/form-data');

$jsonFormData1 = new CkJsonObject();
$req->AddParam('file.xml',$jsonFormData1->emit());

$req->AddHeader('Authorization','Bearer {{accessToken}}');
$req->AddHeader('Accept','application/json');

// resp is a CkHttpResponse
$resp = $http->SynchronousRequest('domain.com',443,true,$req);
if ($http->get_LastMethodSuccess() == false) {
    print $http->lastErrorText() . "\n";
    exit;
}

print $resp->get_StatusCode() . "\n";
print $resp->bodyStr() . "\n";


?>

Curl Command

curl -X PUT
	-H "Accept: application/json"
	-H "Content-Type: multipart/form-data"
	-H "Authorization: Bearer {{accessToken}}"
	--form 'file.xml={{file.xml}}'
https://domain.com/v2.1/accounts/{{accountId}}/brands/{{brandId}}/resources/{{resourceContentType}}

Postman Collection Item JSON

{
  "name": "Uploads a branding resource file.",
  "request": {
    "method": "PUT",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      },
      {
        "key": "Content-Type",
        "value": "multipart/form-data"
      },
      {
        "key": "Authorization",
        "value": "Bearer {{accessToken}}"
      }
    ],
    "body": {
      "mode": "formdata",
      "formdata": [
        {
          "key": "file.xml",
          "value": "{{file.xml}}",
          "type": "text"
        }
      ]
    },
    "url": {
      "raw": "{{baseUrl}}/v2.1/accounts/{{accountId}}/brands/{{brandId}}/resources/{{resourceContentType}}",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "v2.1",
        "accounts",
        "{{accountId}}",
        "brands",
        "{{brandId}}",
        "resources",
        "{{resourceContentType}}"
      ],
      "variable": [
        {
          "key": "accountId",
          "value": "{{accountId}}"
        },
        {
          "key": "brandId",
          "value": "{{brandId}}"
        },
        {
          "key": "resourceContentType",
          "value": "{{resourceContentType}}"
        }
      ]
    }
  },
  "response": [
  ]
}