Back to Collection Items
func chilkatTest() {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let http = CkoHttp()!
var success: Bool
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {}
let json = CkoJsonObject()!
http.setRequestHeader("Content-Type", value: "image/png")
// Adds the "Authorization: Bearer {{accessToken}}" header.
http.authToken = "{{accessToken}}"
http.setRequestHeader("Accept", value: "application/json")
let sbRequestBody = CkoStringBuilder()!
json.emitSb(sbRequestBody)
var resp: CkoHttpResponse? = http.pTextSb("PUT", url: "https://domain.com/v2.1/accounts/{{accountId}}/brands/{{brandId}}/logos/{{logoType}}", textData: sbRequestBody, charset: "utf-8", contentType: "image/png", md5: false, gzip: false)
if http.lastMethodSuccess == false {
print("\(http.lastErrorText!)")
return
}
print("\(resp!.statusCode.intValue)")
print("\(resp!.bodyStr!)")
resp = nil
}
Curl Command
curl -X PUT
-H "Accept: application/json"
-H "Content-Type: image/png"
-H "Authorization: Bearer {{accessToken}}"
-d '{}'
https://domain.com/v2.1/accounts/{{accountId}}/brands/{{brandId}}/logos/{{logoType}}
Postman Collection Item JSON
{
"name": "Put one branding logo.",
"request": {
"method": "PUT",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"key": "Content-Type",
"value": "image/png"
},
{
"key": "Authorization",
"value": "Bearer {{accessToken}}"
}
],
"body": {
"mode": "raw",
"raw": "{}"
},
"url": {
"raw": "{{baseUrl}}/v2.1/accounts/{{accountId}}/brands/{{brandId}}/logos/{{logoType}}",
"host": [
"{{baseUrl}}"
],
"path": [
"v2.1",
"accounts",
"{{accountId}}",
"brands",
"{{brandId}}",
"logos",
"{{logoType}}"
],
"variable": [
{
"key": "accountId",
"value": "{{accountId}}",
"type": "string"
},
{
"key": "brandId",
"value": "{{brandId}}",
"type": "string"
},
{
"key": "logoType",
"value": "{{logoType}}",
"type": "string"
}
]
}
},
"response": [
]
}