Chilkat Online Tools

Ruby / DocuSign eSignature REST API / Uploads a branding resource file.

Back to Collection Items

require 'chilkat'

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

http = Chilkat::CkHttp.new()

req = Chilkat::CkHttpRequest.new()
req.put_HttpVerb("PUT")
req.put_Path("/v2.1/accounts/{{accountId}}/brands/{{brandId}}/resources/{{resourceContentType}}")
req.put_ContentType("multipart/form-data")

jsonFormData1 = Chilkat::CkJsonObject.new()
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
end

print resp.get_StatusCode().to_s() + "\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}}",
          "type": "string"
        },
        {
          "key": "brandId",
          "value": "{{brandId}}",
          "type": "string"
        },
        {
          "key": "resourceContentType",
          "value": "{{resourceContentType}}",
          "type": "string"
        }
      ]
    }
  },
  "response": [
  ]
}