Chilkat Online Tools

PowerBuilder / Support API / Show a Brand

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_Content_type
string ls_Content_url
string ls_Deleted
string ls_File_name
string ls_Height
string ls_Id
string ls_Inline
string ls_Malware_access_override
string ls_Malware_scan_result
string ls_Mapped_content_url
string ls_Size
string ls_Url
string ls_Width
string ls_Name
string ls_Subdomain
string ls_Active
string ls_Brand_url
string ls_Created_at
string ls_Default
string ls_Has_help_center
string ls_Help_center_state
string ls_Host_mapping
string ls_Id
string ls_Is_deleted
string ls_Content_type
string ls_Content_url
string ls_Deleted
string ls_File_name
string ls_Height
string ls_LogoId
string ls_Inline
string ls_Malware_access_override
string ls_Malware_scan_result
string ls_Mapped_content_url
string ls_Size
string ls_V_Url
string ls_Width
string ls_Signature_template
string ls_Ticket_form_ids
string ls_Updated_at
string ls_BrandUrl
integer i
integer li_Count_i

// 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_Http.BasicAuth = 1
loo_Http.Login = "login"
loo_Http.Password = "password"

loo_Http.SetRequestHeader("Accept","application/json")

loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")

li_Success = loo_Http.QuickGetSb("https://example.zendesk.com/api/v2/brands/:brand_id",loo_SbResponseBody)
if li_Success = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_SbResponseBody
    return
end if

loo_JResp = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject")

loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0

Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()

li_RespStatusCode = loo_Http.LastStatus
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
    Write-Debug "Response Header:"
    Write-Debug loo_Http.LastHeader
    Write-Debug "Failed."
    destroy loo_Http
    destroy loo_SbResponseBody
    destroy loo_JResp
    return
end if

// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)

// {
//   "brand": {
//     "name": "<string>",
//     "subdomain": "<string>",
//     "active": "<boolean>",
//     "brand_url": "<string>",
//     "created_at": "<dateTime>",
//     "default": "<boolean>",
//     "has_help_center": "<boolean>",
//     "help_center_state": "enabled",
//     "host_mapping": "<string>",
//     "id": "<integer>",
//     "is_deleted": "<boolean>",
//     "logo": {
//       "content_type": "<string>",
//       "content_url": "<string>",
//       "deleted": "<boolean>",
//       "file_name": "<string>",
//       "height": "<string>",
//       "id": "<integer>",
//       "inline": "<boolean>",
//       "malware_access_override": "<boolean>",
//       "malware_scan_result": "<string>",
//       "mapped_content_url": "<string>",
//       "size": "<integer>",
//       "url": "<string>",
//       "width": "<string>",
//       "thumbnails": [
//         {
//           "content_type": "<string>",
//           "content_url": "<string>",
//           "deleted": "<boolean>",
//           "file_name": "<string>",
//           "height": "<string>",
//           "id": "<integer>",
//           "inline": "<boolean>",
//           "malware_access_override": "<boolean>",
//           "malware_scan_result": "<string>",
//           "mapped_content_url": "<string>",
//           "size": "<integer>",
//           "url": "<string>",
//           "width": "<string>"
//         },
//         {
//           "content_type": "<string>",
//           "content_url": "<string>",
//           "deleted": "<boolean>",
//           "file_name": "<string>",
//           "height": "<string>",
//           "id": "<integer>",
//           "inline": "<boolean>",
//           "malware_access_override": "<boolean>",
//           "malware_scan_result": "<string>",
//           "mapped_content_url": "<string>",
//           "size": "<integer>",
//           "url": "<string>",
//           "width": "<string>"
//         }
//       ]
//     },
//     "signature_template": "<string>",
//     "ticket_form_ids": "<array>",
//     "updated_at": "<dateTime>",
//     "url": "<string>"
//   }
// }

// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

ls_Name = loo_JResp.StringOf("brand.name")
ls_Subdomain = loo_JResp.StringOf("brand.subdomain")
ls_Active = loo_JResp.StringOf("brand.active")
ls_Brand_url = loo_JResp.StringOf("brand.brand_url")
ls_Created_at = loo_JResp.StringOf("brand.created_at")
ls_Default = loo_JResp.StringOf("brand.default")
ls_Has_help_center = loo_JResp.StringOf("brand.has_help_center")
ls_Help_center_state = loo_JResp.StringOf("brand.help_center_state")
ls_Host_mapping = loo_JResp.StringOf("brand.host_mapping")
ls_Id = loo_JResp.StringOf("brand.id")
ls_Is_deleted = loo_JResp.StringOf("brand.is_deleted")
ls_Content_type = loo_JResp.StringOf("brand.logo.content_type")
ls_Content_url = loo_JResp.StringOf("brand.logo.content_url")
ls_Deleted = loo_JResp.StringOf("brand.logo.deleted")
ls_File_name = loo_JResp.StringOf("brand.logo.file_name")
ls_Height = loo_JResp.StringOf("brand.logo.height")
ls_LogoId = loo_JResp.StringOf("brand.logo.id")
ls_Inline = loo_JResp.StringOf("brand.logo.inline")
ls_Malware_access_override = loo_JResp.StringOf("brand.logo.malware_access_override")
ls_Malware_scan_result = loo_JResp.StringOf("brand.logo.malware_scan_result")
ls_Mapped_content_url = loo_JResp.StringOf("brand.logo.mapped_content_url")
ls_Size = loo_JResp.StringOf("brand.logo.size")
ls_V_Url = loo_JResp.StringOf("brand.logo.url")
ls_Width = loo_JResp.StringOf("brand.logo.width")
ls_Signature_template = loo_JResp.StringOf("brand.signature_template")
ls_Ticket_form_ids = loo_JResp.StringOf("brand.ticket_form_ids")
ls_Updated_at = loo_JResp.StringOf("brand.updated_at")
ls_BrandUrl = loo_JResp.StringOf("brand.url")
i = 0
li_Count_i = loo_JResp.SizeOfArray("brand.logo.thumbnails")
do while i < li_Count_i
    loo_JResp.I = i
    ls_Content_type = loo_JResp.StringOf("brand.logo.thumbnails[i].content_type")
    ls_Content_url = loo_JResp.StringOf("brand.logo.thumbnails[i].content_url")
    ls_Deleted = loo_JResp.StringOf("brand.logo.thumbnails[i].deleted")
    ls_File_name = loo_JResp.StringOf("brand.logo.thumbnails[i].file_name")
    ls_Height = loo_JResp.StringOf("brand.logo.thumbnails[i].height")
    ls_Id = loo_JResp.StringOf("brand.logo.thumbnails[i].id")
    ls_Inline = loo_JResp.StringOf("brand.logo.thumbnails[i].inline")
    ls_Malware_access_override = loo_JResp.StringOf("brand.logo.thumbnails[i].malware_access_override")
    ls_Malware_scan_result = loo_JResp.StringOf("brand.logo.thumbnails[i].malware_scan_result")
    ls_Mapped_content_url = loo_JResp.StringOf("brand.logo.thumbnails[i].mapped_content_url")
    ls_Size = loo_JResp.StringOf("brand.logo.thumbnails[i].size")
    ls_Url = loo_JResp.StringOf("brand.logo.thumbnails[i].url")
    ls_Width = loo_JResp.StringOf("brand.logo.thumbnails[i].width")
    i = i + 1
loop


destroy loo_Http
destroy loo_SbResponseBody
destroy loo_JResp

Curl Command

curl  -u login:password -X GET
	-H "Accept: application/json"
https://example.zendesk.com/api/v2/brands/:brand_id

Postman Collection Item JSON

{
  "name": "Show a Brand",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/api/v2/brands/:brand_id",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "v2",
        "brands",
        ":brand_id"
      ],
      "variable": [
        {
          "key": "brand_id",
          "value": "<integer>"
        }
      ]
    },
    "description": "Returns a brand for your account.\n\n#### Allowed for\n\n* Admins, Agents"
  },
  "response": [
    {
      "name": "Successful response",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: basic",
            "key": "Authorization",
            "value": "Basic <credentials>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/v2/brands/:brand_id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "brands",
            ":brand_id"
          ],
          "variable": [
            {
              "key": "brand_id"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"brand\": {\n    \"name\": \"<string>\",\n    \"subdomain\": \"<string>\",\n    \"active\": \"<boolean>\",\n    \"brand_url\": \"<string>\",\n    \"created_at\": \"<dateTime>\",\n    \"default\": \"<boolean>\",\n    \"has_help_center\": \"<boolean>\",\n    \"help_center_state\": \"enabled\",\n    \"host_mapping\": \"<string>\",\n    \"id\": \"<integer>\",\n    \"is_deleted\": \"<boolean>\",\n    \"logo\": {\n      \"content_type\": \"<string>\",\n      \"content_url\": \"<string>\",\n      \"deleted\": \"<boolean>\",\n      \"file_name\": \"<string>\",\n      \"height\": \"<string>\",\n      \"id\": \"<integer>\",\n      \"inline\": \"<boolean>\",\n      \"malware_access_override\": \"<boolean>\",\n      \"malware_scan_result\": \"<string>\",\n      \"mapped_content_url\": \"<string>\",\n      \"size\": \"<integer>\",\n      \"url\": \"<string>\",\n      \"width\": \"<string>\",\n      \"thumbnails\": [\n        {\n          \"content_type\": \"<string>\",\n          \"content_url\": \"<string>\",\n          \"deleted\": \"<boolean>\",\n          \"file_name\": \"<string>\",\n          \"height\": \"<string>\",\n          \"id\": \"<integer>\",\n          \"inline\": \"<boolean>\",\n          \"malware_access_override\": \"<boolean>\",\n          \"malware_scan_result\": \"<string>\",\n          \"mapped_content_url\": \"<string>\",\n          \"size\": \"<integer>\",\n          \"url\": \"<string>\",\n          \"width\": \"<string>\"\n        },\n        {\n          \"content_type\": \"<string>\",\n          \"content_url\": \"<string>\",\n          \"deleted\": \"<boolean>\",\n          \"file_name\": \"<string>\",\n          \"height\": \"<string>\",\n          \"id\": \"<integer>\",\n          \"inline\": \"<boolean>\",\n          \"malware_access_override\": \"<boolean>\",\n          \"malware_scan_result\": \"<string>\",\n          \"mapped_content_url\": \"<string>\",\n          \"size\": \"<integer>\",\n          \"url\": \"<string>\",\n          \"width\": \"<string>\"\n        }\n      ]\n    },\n    \"signature_template\": \"<string>\",\n    \"ticket_form_ids\": \"<array>\",\n    \"updated_at\": \"<dateTime>\",\n    \"url\": \"<string>\"\n  }\n}"
    }
  ]
}