Chilkat Online Tools

PowerBuilder / Salesforce Platform APIs / Get Tooling Metadata SObject

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
integer li_Activateable
string ls_AssociateEntityType
string ls_AssociateParentEntity
integer li_Createable
integer li_Custom
integer li_CustomSetting
integer li_DeepCloneable
integer li_Deletable
integer li_DeprecatedAndHidden
integer li_FeedEnabled
integer li_HasSubtypes
integer li_IsInterface
integer li_IsSubtype
string ls_KeyPrefix
string ls_Label
string ls_LabelPlural
integer li_Layoutable
integer li_Mergeable
integer li_MruEnabled
string ls_Name
integer li_Queryable
integer li_Replicateable
integer li_Retrieveable
integer li_Searchable
integer li_Triggerable
integer li_Undeletable
integer li_Updateable
string ls_CompactLayouts
string ls_RowTemplate
string ls_Describe
string ls_Layouts
string ls_Sobject
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_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}}/tooling/sobjects/:SOBJECT_API_NAME",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)

// {
//   "objectDescribe": {
//     "activateable": false,
//     "associateEntityType": null,
//     "associateParentEntity": null,
//     "createable": true,
//     "custom": false,
//     "customSetting": false,
//     "deepCloneable": false,
//     "deletable": true,
//     "deprecatedAndHidden": false,
//     "feedEnabled": false,
//     "hasSubtypes": false,
//     "isInterface": false,
//     "isSubtype": false,
//     "keyPrefix": "01p",
//     "label": "Apex Class",
//     "labelPlural": "Apex Classes",
//     "layoutable": true,
//     "mergeable": false,
//     "mruEnabled": true,
//     "name": "ApexClass",
//     "queryable": true,
//     "replicateable": true,
//     "retrieveable": true,
//     "searchable": true,
//     "triggerable": false,
//     "undeletable": false,
//     "updateable": true,
//     "urls": {
//       "compactLayouts": "/services/data/v59.0/tooling/sobjects/ApexClass/describe/compactLayouts",
//       "rowTemplate": "/services/data/v59.0/tooling/sobjects/ApexClass/{ID}",
//       "describe": "/services/data/v59.0/tooling/sobjects/ApexClass/describe",
//       "layouts": "/services/data/v59.0/tooling/sobjects/ApexClass/describe/layouts",
//       "sobject": "/services/data/v59.0/tooling/sobjects/ApexClass"
//     }
//   },
//   "recentItems": [
//   ]
// }

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

li_Activateable = loo_JResp.BoolOf("objectDescribe.activateable")
ls_AssociateEntityType = loo_JResp.StringOf("objectDescribe.associateEntityType")
ls_AssociateParentEntity = loo_JResp.StringOf("objectDescribe.associateParentEntity")
li_Createable = loo_JResp.BoolOf("objectDescribe.createable")
li_Custom = loo_JResp.BoolOf("objectDescribe.custom")
li_CustomSetting = loo_JResp.BoolOf("objectDescribe.customSetting")
li_DeepCloneable = loo_JResp.BoolOf("objectDescribe.deepCloneable")
li_Deletable = loo_JResp.BoolOf("objectDescribe.deletable")
li_DeprecatedAndHidden = loo_JResp.BoolOf("objectDescribe.deprecatedAndHidden")
li_FeedEnabled = loo_JResp.BoolOf("objectDescribe.feedEnabled")
li_HasSubtypes = loo_JResp.BoolOf("objectDescribe.hasSubtypes")
li_IsInterface = loo_JResp.BoolOf("objectDescribe.isInterface")
li_IsSubtype = loo_JResp.BoolOf("objectDescribe.isSubtype")
ls_KeyPrefix = loo_JResp.StringOf("objectDescribe.keyPrefix")
ls_Label = loo_JResp.StringOf("objectDescribe.label")
ls_LabelPlural = loo_JResp.StringOf("objectDescribe.labelPlural")
li_Layoutable = loo_JResp.BoolOf("objectDescribe.layoutable")
li_Mergeable = loo_JResp.BoolOf("objectDescribe.mergeable")
li_MruEnabled = loo_JResp.BoolOf("objectDescribe.mruEnabled")
ls_Name = loo_JResp.StringOf("objectDescribe.name")
li_Queryable = loo_JResp.BoolOf("objectDescribe.queryable")
li_Replicateable = loo_JResp.BoolOf("objectDescribe.replicateable")
li_Retrieveable = loo_JResp.BoolOf("objectDescribe.retrieveable")
li_Searchable = loo_JResp.BoolOf("objectDescribe.searchable")
li_Triggerable = loo_JResp.BoolOf("objectDescribe.triggerable")
li_Undeletable = loo_JResp.BoolOf("objectDescribe.undeletable")
li_Updateable = loo_JResp.BoolOf("objectDescribe.updateable")
ls_CompactLayouts = loo_JResp.StringOf("objectDescribe.urls.compactLayouts")
ls_RowTemplate = loo_JResp.StringOf("objectDescribe.urls.rowTemplate")
ls_Describe = loo_JResp.StringOf("objectDescribe.urls.describe")
ls_Layouts = loo_JResp.StringOf("objectDescribe.urls.layouts")
ls_Sobject = loo_JResp.StringOf("objectDescribe.urls.sobject")
i = 0
li_Count_i = loo_JResp.SizeOfArray("recentItems")
do while i < li_Count_i
    loo_JResp.I = i
    i = i + 1
loop


destroy loo_Http
destroy loo_SbResponseBody
destroy loo_JResp

Curl Command

curl -X GET
	-H "Authorization: Bearer <access_token>"
https://domain.com/services/data/v{{version}}/tooling/sobjects/:SOBJECT_API_NAME

Postman Collection Item JSON

{
  "name": "Get Tooling Metadata SObject",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{_endpoint}}/services/data/v{{version}}/tooling/sobjects/:SOBJECT_API_NAME",
      "host": [
        "{{_endpoint}}"
      ],
      "path": [
        "services",
        "data",
        "v{{version}}",
        "tooling",
        "sobjects",
        ":SOBJECT_API_NAME"
      ],
      "variable": [
        {
          "key": "SOBJECT_API_NAME",
          "value": ""
        }
      ]
    }
  },
  "response": [
    {
      "name": "Get Tooling Metadata SObject",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{_endpoint}}/services/data/v{{version}}/tooling/sobjects/:SOBJECT_API_NAME",
          "host": [
            "{{_endpoint}}"
          ],
          "path": [
            "services",
            "data",
            "v{{version}}",
            "tooling",
            "sobjects",
            ":SOBJECT_API_NAME"
          ],
          "variable": [
            {
              "key": "SOBJECT_API_NAME",
              "value": "ApexClass"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Date",
          "value": "Mon, 11 Dec 2023 10:36:20 GMT"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=63072000; includeSubDomains"
        },
        {
          "key": "X-Content-Type-Options",
          "value": "nosniff"
        },
        {
          "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=298/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    \"objectDescribe\": {\n        \"activateable\": false,\n        \"associateEntityType\": null,\n        \"associateParentEntity\": null,\n        \"createable\": true,\n        \"custom\": false,\n        \"customSetting\": false,\n        \"deepCloneable\": false,\n        \"deletable\": true,\n        \"deprecatedAndHidden\": false,\n        \"feedEnabled\": false,\n        \"hasSubtypes\": false,\n        \"isInterface\": false,\n        \"isSubtype\": false,\n        \"keyPrefix\": \"01p\",\n        \"label\": \"Apex Class\",\n        \"labelPlural\": \"Apex Classes\",\n        \"layoutable\": true,\n        \"mergeable\": false,\n        \"mruEnabled\": true,\n        \"name\": \"ApexClass\",\n        \"queryable\": true,\n        \"replicateable\": true,\n        \"retrieveable\": true,\n        \"searchable\": true,\n        \"triggerable\": false,\n        \"undeletable\": false,\n        \"updateable\": true,\n        \"urls\": {\n            \"compactLayouts\": \"/services/data/v59.0/tooling/sobjects/ApexClass/describe/compactLayouts\",\n            \"rowTemplate\": \"/services/data/v59.0/tooling/sobjects/ApexClass/{ID}\",\n            \"describe\": \"/services/data/v59.0/tooling/sobjects/ApexClass/describe\",\n            \"layouts\": \"/services/data/v59.0/tooling/sobjects/ApexClass/describe/layouts\",\n            \"sobject\": \"/services/data/v59.0/tooling/sobjects/ApexClass\"\n        }\n    },\n    \"recentItems\": []\n}"
    }
  ]
}