Back to Collection Items
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oHttp = ObjCreate("Chilkat.Http")
Local $bSuccess
; Adds the "Authorization: Bearer <access_token>" header.
$oHttp.AuthToken = "<access_token>"
$oSbResponseBody = ObjCreate("Chilkat.StringBuilder")
$bSuccess = $oHttp.QuickGetSb("https://domain.com/services/data/v{{version}}/tooling/sobjects/:SOBJECT_API_NAME",$oSbResponseBody)
If ($bSuccess = False) Then
ConsoleWrite($oHttp.LastErrorText & @CRLF)
Exit
EndIf
$oJResp = ObjCreate("Chilkat.JsonObject")
$oJResp.LoadSb($oSbResponseBody)
$oJResp.EmitCompact = False
ConsoleWrite("Response Body:" & @CRLF)
ConsoleWrite($oJResp.Emit() & @CRLF)
Local $iRespStatusCode = $oHttp.LastStatus
ConsoleWrite("Response Status Code = " & $iRespStatusCode & @CRLF)
If ($iRespStatusCode >= 400) Then
ConsoleWrite("Response Header:" & @CRLF)
ConsoleWrite($oHttp.LastHeader & @CRLF)
ConsoleWrite("Failed." & @CRLF)
Exit
EndIf
; 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
Local $bActivateable = $oJResp.BoolOf("objectDescribe.activateable")
Local $sAssociateEntityType = $oJResp.StringOf("objectDescribe.associateEntityType")
Local $sAssociateParentEntity = $oJResp.StringOf("objectDescribe.associateParentEntity")
Local $bCreateable = $oJResp.BoolOf("objectDescribe.createable")
Local $bCustom = $oJResp.BoolOf("objectDescribe.custom")
Local $bCustomSetting = $oJResp.BoolOf("objectDescribe.customSetting")
Local $bDeepCloneable = $oJResp.BoolOf("objectDescribe.deepCloneable")
Local $bDeletable = $oJResp.BoolOf("objectDescribe.deletable")
Local $bDeprecatedAndHidden = $oJResp.BoolOf("objectDescribe.deprecatedAndHidden")
Local $bFeedEnabled = $oJResp.BoolOf("objectDescribe.feedEnabled")
Local $bHasSubtypes = $oJResp.BoolOf("objectDescribe.hasSubtypes")
Local $bIsInterface = $oJResp.BoolOf("objectDescribe.isInterface")
Local $bIsSubtype = $oJResp.BoolOf("objectDescribe.isSubtype")
Local $sKeyPrefix = $oJResp.StringOf("objectDescribe.keyPrefix")
Local $sLabel = $oJResp.StringOf("objectDescribe.label")
Local $sLabelPlural = $oJResp.StringOf("objectDescribe.labelPlural")
Local $bLayoutable = $oJResp.BoolOf("objectDescribe.layoutable")
Local $bMergeable = $oJResp.BoolOf("objectDescribe.mergeable")
Local $bMruEnabled = $oJResp.BoolOf("objectDescribe.mruEnabled")
Local $sName = $oJResp.StringOf("objectDescribe.name")
Local $bQueryable = $oJResp.BoolOf("objectDescribe.queryable")
Local $bReplicateable = $oJResp.BoolOf("objectDescribe.replicateable")
Local $bRetrieveable = $oJResp.BoolOf("objectDescribe.retrieveable")
Local $bSearchable = $oJResp.BoolOf("objectDescribe.searchable")
Local $bTriggerable = $oJResp.BoolOf("objectDescribe.triggerable")
Local $bUndeletable = $oJResp.BoolOf("objectDescribe.undeletable")
Local $bUpdateable = $oJResp.BoolOf("objectDescribe.updateable")
Local $sCompactLayouts = $oJResp.StringOf("objectDescribe.urls.compactLayouts")
Local $sRowTemplate = $oJResp.StringOf("objectDescribe.urls.rowTemplate")
Local $sDescribe = $oJResp.StringOf("objectDescribe.urls.describe")
Local $sLayouts = $oJResp.StringOf("objectDescribe.urls.layouts")
Local $sSobject = $oJResp.StringOf("objectDescribe.urls.sobject")
Local $i = 0
Local $iCount_i = $oJResp.SizeOfArray("recentItems")
While $i < $iCount_i
$oJResp.I = $i
$i = $i + 1
Wend
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}"
}
]
}