PowerBuilder / DocuSign REST API / Uploads a branding resource file.
Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Req
oleobject loo_JsonFormData1
oleobject loo_Resp
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_Req = create oleobject
// Use "Chilkat_9_5_0.HttpRequest" for versions of Chilkat < 10.0.0
li_rc = loo_Req.ConnectToNewObject("Chilkat.HttpRequest")
loo_Req.HttpVerb = "PUT"
loo_Req.Path = "/v2.1/accounts/{{accountId}}/brands/{{brandId}}/resources/{{resourceContentType}}"
loo_Req.ContentType = "multipart/form-data"
loo_JsonFormData1 = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JsonFormData1.ConnectToNewObject("Chilkat.JsonObject")
loo_Req.AddStringForUpload2("file.xml","",loo_JsonFormData1,"utf-8","application/json")
loo_Req.AddHeader("Authorization","Bearer {{accessToken}}")
loo_Req.AddHeader("Accept","application/json")
loo_Resp = loo_Http.SynchronousRequest("domain.com",443,1,loo_Req)
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_Req
destroy loo_JsonFormData1
return
end if
Write-Debug string(loo_Resp.StatusCode)
Write-Debug loo_Resp.BodyStr
destroy loo_Resp
destroy loo_Http
destroy loo_Req
destroy loo_JsonFormData1
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": [
]
}