Chilkat Online Tools

PowerBuilder / Salesforce Platform APIs / Tabs

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_SbResponseBody
oleobject loo_JarrResp
integer li_RespStatusCode
oleobject loo_Json
integer li_Custom
string ls_IconUrl
string ls_Label
string ls_MiniIconUrl
string ls_Name
string ls_SobjectName
string ls_Url
integer j
integer li_Count_j
string ls_Color
string ls_Context
string ls_Theme
string ls_ContentType
integer li_Height
integer li_Width
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

// Adds the "Authorization: Bearer <access_token>" header.
loo_Http.AuthToken = "<access_token>"
loo_Http.SetRequestHeader("Content-Type","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://domain.com/services/data/v{{version}}/tabs",loo_SbResponseBody)
if li_Success = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_SbResponseBody
    return
end if

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

loo_JarrResp.LoadSb(loo_SbResponseBody)
loo_JarrResp.EmitCompact = 0

Write-Debug "Response Body:"
Write-Debug loo_JarrResp.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_JarrResp
    return
end if

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

// [
//   {
//     "colors": [
//       {
//         "color": "5867E8",
//         "context": "primary",
//         "theme": "theme4"
//       },
//       {
//         "color": "236FBD",
//         "context": "primary",
//         "theme": "theme3"
//       }
//     ],
//     "custom": false,
//     "iconUrl": "https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/accounts32.png",
//     "icons": [
//       {
//         "contentType": "image/png",
//         "height": 32,
//         "theme": "theme3",
//         "url": "https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/accounts32.png",
//         "width": 32
//       },
//       {
//         "contentType": "image/png",
//         "height": 16,
//         "theme": "theme3",
//         "url": "https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/accounts16.png",
//         "width": 16
//       },
//       {
//         "contentType": "image/svg+xml",
//         "height": 0,
//         "theme": "theme4",
//         "url": "https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/t4v35/standard/account.svg",
//         "width": 0
//       },
//       {
//         "contentType": "image/png",
//         "height": 60,
//         "theme": "theme4",
//         "url": "https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/t4v35/standard/account_60.png",
//         "width": 60
//       },
//       {
//         "contentType": "image/png",
//         "height": 120,
//         "theme": "theme4",
//         "url": "https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/t4v35/standard/account_120.png",
//         "width": 120
//       }
//     ],
//     "label": "Accounts",
//     "miniIconUrl": "https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/accounts16.png",
//     "name": "standard-Account",
//     "sobjectName": "Account",
//     "url": "https://nto-df17-demo-dev-ed.my.salesforce.com/001/o"
//   },
//   {
//     "colors": [
//       {
//         "color": "056764",
//         "context": "primary",
//         "theme": "theme4"
//       },
//       {
//         "color": "056764",
//         "context": "primary",
//         "theme": "theme3"
//       }
//     ],
//     "custom": false,
//     "iconUrl": "https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/wrench32.png",
//     "icons": [
//       {
//         "contentType": "image/png",
//         "height": 32,
//         "theme": "theme3",
//         "url": "https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/wrench32.png",
//         "width": 32
//       },
//       {
//         "contentType": "image/png",
//         "height": 16,
//         "theme": "theme3",
//         "url": "https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/wrench16.png",
//         "width": 16
//       }
//     ],
//     "label": "Active Scratch Orgs",
//     "miniIconUrl": "https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/wrench16.png",
//     "name": "standard-ActiveScratchOrg",
//     "sobjectName": "ActiveScratchOrg",
//     "url": "https://nto-df17-demo-dev-ed.my.salesforce.com/2AS/o"
//   },
//   {
//     "colors": [
//       {
//         "color": "06A59A",
//         "context": "primary",
//         "theme": "theme4"
//       },
//       {
//         "color": "A55647",
//         "context": "primary",
//         "theme": "theme3"
//       }
//     ],
//     "custom": false,
//     "iconUrl": "https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/reports32.png",
//     "icons": [
//       {
//         "contentType": "image/png",
//         "height": 32,
//         "theme": "theme3",
//         "url": "https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/reports32.png",
//         "width": 32
//       },
//       {
//         "contentType": "image/png",
//         "height": 16,
//         "theme": "theme3",
//         "url": "https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/reports16.png",
//         "width": 16
//       },
//       {
//         "contentType": "image/svg+xml",
//         "height": 0,
//         "theme": "theme4",
//         "url": "https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/t4v35/standard/report.svg",
//         "width": 0
//       },
//       {
//         "contentType": "image/png",
//         "height": 60,
//         "theme": "theme4",
//         "url": "https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/t4v35/standard/report_60.png",
//         "width": 60
//       },
//       {
//         "contentType": "image/png",
//         "height": 120,
//         "theme": "theme4",
//         "url": "https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/t4v35/standard/report_120.png",
//         "width": 120
//       }
//     ],
//     "label": "Reports",
//     "miniIconUrl": "https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/reports16.png",
//     "name": "standard-report",
//     "sobjectName": "Report",
//     "url": "https://nto-df17-demo-dev-ed.my.salesforce.com/00O/o"
//   }
// ]

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

i = 0
li_Count_i = loo_JarrResp.Size
do while i < li_Count_i
    loo_Json = loo_JarrResp.ObjectAt(i)
    li_Custom = loo_Json.BoolOf("custom")
    ls_IconUrl = loo_Json.StringOf("iconUrl")
    ls_Label = loo_Json.StringOf("label")
    ls_MiniIconUrl = loo_Json.StringOf("miniIconUrl")
    ls_Name = loo_Json.StringOf("name")
    ls_SobjectName = loo_Json.StringOf("sobjectName")
    ls_Url = loo_Json.StringOf("url")
    j = 0
    li_Count_j = loo_Json.SizeOfArray("colors")
    do while j < li_Count_j
        loo_Json.J = j
        ls_Color = loo_Json.StringOf("colors[j].color")
        ls_Context = loo_Json.StringOf("colors[j].context")
        ls_Theme = loo_Json.StringOf("colors[j].theme")
        j = j + 1
    loop
    j = 0
    li_Count_j = loo_Json.SizeOfArray("icons")
    do while j < li_Count_j
        loo_Json.J = j
        ls_ContentType = loo_Json.StringOf("icons[j].contentType")
        li_Height = loo_Json.IntOf("icons[j].height")
        ls_Theme = loo_Json.StringOf("icons[j].theme")
        ls_Url = loo_Json.StringOf("icons[j].url")
        li_Width = loo_Json.IntOf("icons[j].width")
        j = j + 1
    loop
    destroy loo_Json
    i = i + 1
loop


destroy loo_Http
destroy loo_SbResponseBody
destroy loo_JarrResp

Curl Command

curl -X GET
	-H "Authorization: Bearer <access_token>"
	-H "Content-Type: application/json"
https://domain.com/services/data/v{{version}}/tabs

Postman Collection Item JSON

{
  "name": "Tabs",
  "protocolProfileBehavior": {
    "disableBodyPruning": true
  },
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Content-Type",
        "value": "application/json"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": ""
    },
    "url": {
      "raw": "{{_endpoint}}/services/data/v{{version}}/tabs",
      "host": [
        "{{_endpoint}}"
      ],
      "path": [
        "services",
        "data",
        "v{{version}}",
        "tabs"
      ]
    },
    "description": "f a survey field can be translated or is already translated into a particular language, you can add or change the translated value of the survey field.\n\nhttps://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/request_survey_translate_add_change.htm"
  },
  "response": [
    {
      "name": "Tabs",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": ""
        },
        "url": {
          "raw": "{{_endpoint}}/services/data/v{{version}}/tabs",
          "host": [
            "{{_endpoint}}"
          ],
          "path": [
            "services",
            "data",
            "v{{version}}",
            "tabs"
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Date",
          "value": "Wed, 27 Sep 2023 15:29:05 GMT"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=63072000; includeSubDomains"
        },
        {
          "key": "X-Content-Type-Options",
          "value": "nosniff"
        },
        {
          "key": "X-XSS-Protection",
          "value": "1; mode=block"
        },
        {
          "key": "X-Robots-Tag",
          "value": "none"
        },
        {
          "key": "Cache-Control",
          "value": "no-cache,must-revalidate,max-age=0,no-store,private"
        },
        {
          "key": "Sforce-Limit-Info",
          "value": "api-usage=6/15000"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=UTF-8"
        },
        {
          "key": "Vary",
          "value": "Accept-Encoding"
        },
        {
          "key": "Content-Encoding",
          "value": "gzip"
        },
        {
          "key": "Transfer-Encoding",
          "value": "chunked"
        }
      ],
      "cookie": [
      ],
      "body": "[\n    {\n        \"colors\": [\n            {\n                \"color\": \"5867E8\",\n                \"context\": \"primary\",\n                \"theme\": \"theme4\"\n            },\n            {\n                \"color\": \"236FBD\",\n                \"context\": \"primary\",\n                \"theme\": \"theme3\"\n            }\n        ],\n        \"custom\": false,\n        \"iconUrl\": \"https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/accounts32.png\",\n        \"icons\": [\n            {\n                \"contentType\": \"image/png\",\n                \"height\": 32,\n                \"theme\": \"theme3\",\n                \"url\": \"https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/accounts32.png\",\n                \"width\": 32\n            },\n            {\n                \"contentType\": \"image/png\",\n                \"height\": 16,\n                \"theme\": \"theme3\",\n                \"url\": \"https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/accounts16.png\",\n                \"width\": 16\n            },\n            {\n                \"contentType\": \"image/svg+xml\",\n                \"height\": 0,\n                \"theme\": \"theme4\",\n                \"url\": \"https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/t4v35/standard/account.svg\",\n                \"width\": 0\n            },\n            {\n                \"contentType\": \"image/png\",\n                \"height\": 60,\n                \"theme\": \"theme4\",\n                \"url\": \"https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/t4v35/standard/account_60.png\",\n                \"width\": 60\n            },\n            {\n                \"contentType\": \"image/png\",\n                \"height\": 120,\n                \"theme\": \"theme4\",\n                \"url\": \"https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/t4v35/standard/account_120.png\",\n                \"width\": 120\n            }\n        ],\n        \"label\": \"Accounts\",\n        \"miniIconUrl\": \"https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/accounts16.png\",\n        \"name\": \"standard-Account\",\n        \"sobjectName\": \"Account\",\n        \"url\": \"https://nto-df17-demo-dev-ed.my.salesforce.com/001/o\"\n    },\n    {\n        \"colors\": [\n            {\n                \"color\": \"056764\",\n                \"context\": \"primary\",\n                \"theme\": \"theme4\"\n            },\n            {\n                \"color\": \"056764\",\n                \"context\": \"primary\",\n                \"theme\": \"theme3\"\n            }\n        ],\n        \"custom\": false,\n        \"iconUrl\": \"https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/wrench32.png\",\n        \"icons\": [\n            {\n                \"contentType\": \"image/png\",\n                \"height\": 32,\n                \"theme\": \"theme3\",\n                \"url\": \"https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/wrench32.png\",\n                \"width\": 32\n            },\n            {\n                \"contentType\": \"image/png\",\n                \"height\": 16,\n                \"theme\": \"theme3\",\n                \"url\": \"https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/wrench16.png\",\n                \"width\": 16\n            }\n        ],\n        \"label\": \"Active Scratch Orgs\",\n        \"miniIconUrl\": \"https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/wrench16.png\",\n        \"name\": \"standard-ActiveScratchOrg\",\n        \"sobjectName\": \"ActiveScratchOrg\",\n        \"url\": \"https://nto-df17-demo-dev-ed.my.salesforce.com/2AS/o\"\n    },\n    {\n        \"colors\": [\n            {\n                \"color\": \"06A59A\",\n                \"context\": \"primary\",\n                \"theme\": \"theme4\"\n            },\n            {\n                \"color\": \"A55647\",\n                \"context\": \"primary\",\n                \"theme\": \"theme3\"\n            }\n        ],\n        \"custom\": false,\n        \"iconUrl\": \"https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/reports32.png\",\n        \"icons\": [\n            {\n                \"contentType\": \"image/png\",\n                \"height\": 32,\n                \"theme\": \"theme3\",\n                \"url\": \"https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/reports32.png\",\n                \"width\": 32\n            },\n            {\n                \"contentType\": \"image/png\",\n                \"height\": 16,\n                \"theme\": \"theme3\",\n                \"url\": \"https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/reports16.png\",\n                \"width\": 16\n            },\n            {\n                \"contentType\": \"image/svg+xml\",\n                \"height\": 0,\n                \"theme\": \"theme4\",\n                \"url\": \"https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/t4v35/standard/report.svg\",\n                \"width\": 0\n            },\n            {\n                \"contentType\": \"image/png\",\n                \"height\": 60,\n                \"theme\": \"theme4\",\n                \"url\": \"https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/t4v35/standard/report_60.png\",\n                \"width\": 60\n            },\n            {\n                \"contentType\": \"image/png\",\n                \"height\": 120,\n                \"theme\": \"theme4\",\n                \"url\": \"https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/t4v35/standard/report_120.png\",\n                \"width\": 120\n            }\n        ],\n        \"label\": \"Reports\",\n        \"miniIconUrl\": \"https://nto-df17-demo-dev-ed.my.salesforce.com/img/icon/reports16.png\",\n        \"name\": \"standard-report\",\n        \"sobjectName\": \"Report\",\n        \"url\": \"https://nto-df17-demo-dev-ed.my.salesforce.com/00O/o\"\n    }\n]"
    }
  ]
}