Objective-C / DocuSign REST API / Uploads a branding resource file.
Back to Collection Items
#import <CkoHttp.h>
#import <CkoHttpRequest.h>
#import <CkoJsonObject.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;
CkoHttpRequest *req = [[CkoHttpRequest alloc] init];
req.HttpVerb = @"PUT";
req.Path = @"/v2.1/accounts/{{accountId}}/brands/{{brandId}}/resources/{{resourceContentType}}";
req.ContentType = @"multipart/form-data";
CkoJsonObject *jsonFormData1 = [[CkoJsonObject alloc] init];
[req AddStringForUpload2: @"file.xml" filename: @"" strData: jsonFormData1 charset: @"utf-8" contentType: @"application/json"];
[req AddHeader: @"Authorization" value: @"Bearer {{accessToken}}"];
[req AddHeader: @"Accept" value: @"application/json"];
CkoHttpResponse *resp = [http SynchronousRequest: @"domain.com" port: [NSNumber numberWithInt: 443] ssl: YES req: req];
if (http.LastMethodSuccess == NO) {
NSLog(@"%@",http.LastErrorText);
return;
}
NSLog(@"%d",[resp.StatusCode intValue]);
NSLog(@"%@",resp.BodyStr);
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": [
]
}