Back to Collection Items
var
http: TChilkatHttp;
success: Integer;
sbResponseBody: TChilkatStringBuilder;
jResp: TChilkatJsonObject;
respStatusCode: Integer;
Activateable: Integer;
AssociateEntityType: WideString;
AssociateParentEntity: WideString;
Createable: Integer;
Custom: Integer;
CustomSetting: Integer;
DeepCloneable: Integer;
Deletable: Integer;
DeprecatedAndHidden: Integer;
FeedEnabled: Integer;
HasSubtypes: Integer;
IsInterface: Integer;
IsSubtype: Integer;
KeyPrefix: WideString;
Label: WideString;
LabelPlural: WideString;
Layoutable: Integer;
Mergeable: Integer;
MruEnabled: Integer;
Name: WideString;
Queryable: Integer;
Replicateable: Integer;
Retrieveable: Integer;
Searchable: Integer;
Triggerable: Integer;
Undeletable: Integer;
Updateable: Integer;
CompactLayouts: WideString;
RowTemplate: WideString;
Describe: WideString;
Layouts: WideString;
Sobject: WideString;
i: Integer;
count_i: Integer;
begin
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http := TChilkatHttp.Create(Self);
// Adds the "Authorization: Bearer <access_token>" header.
http.AuthToken := '<access_token>';
sbResponseBody := TChilkatStringBuilder.Create(Self);
success := http.QuickGetSb('https://domain.com/services/data/v{{version}}/tooling/sobjects/:SOBJECT_API_NAME',sbResponseBody.ControlInterface);
if (success = 0) then
begin
Memo1.Lines.Add(http.LastErrorText);
Exit;
end;
jResp := TChilkatJsonObject.Create(Self);
jResp.LoadSb(sbResponseBody.ControlInterface);
jResp.EmitCompact := 0;
Memo1.Lines.Add('Response Body:');
Memo1.Lines.Add(jResp.Emit());
respStatusCode := http.LastStatus;
Memo1.Lines.Add('Response Status Code = ' + IntToStr(respStatusCode));
if (respStatusCode >= 400) then
begin
Memo1.Lines.Add('Response Header:');
Memo1.Lines.Add(http.LastHeader);
Memo1.Lines.Add('Failed.');
Exit;
end;
// 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
Activateable := jResp.BoolOf('objectDescribe.activateable');
AssociateEntityType := jResp.StringOf('objectDescribe.associateEntityType');
AssociateParentEntity := jResp.StringOf('objectDescribe.associateParentEntity');
Createable := jResp.BoolOf('objectDescribe.createable');
Custom := jResp.BoolOf('objectDescribe.custom');
CustomSetting := jResp.BoolOf('objectDescribe.customSetting');
DeepCloneable := jResp.BoolOf('objectDescribe.deepCloneable');
Deletable := jResp.BoolOf('objectDescribe.deletable');
DeprecatedAndHidden := jResp.BoolOf('objectDescribe.deprecatedAndHidden');
FeedEnabled := jResp.BoolOf('objectDescribe.feedEnabled');
HasSubtypes := jResp.BoolOf('objectDescribe.hasSubtypes');
IsInterface := jResp.BoolOf('objectDescribe.isInterface');
IsSubtype := jResp.BoolOf('objectDescribe.isSubtype');
KeyPrefix := jResp.StringOf('objectDescribe.keyPrefix');
Label := jResp.StringOf('objectDescribe.label');
LabelPlural := jResp.StringOf('objectDescribe.labelPlural');
Layoutable := jResp.BoolOf('objectDescribe.layoutable');
Mergeable := jResp.BoolOf('objectDescribe.mergeable');
MruEnabled := jResp.BoolOf('objectDescribe.mruEnabled');
Name := jResp.StringOf('objectDescribe.name');
Queryable := jResp.BoolOf('objectDescribe.queryable');
Replicateable := jResp.BoolOf('objectDescribe.replicateable');
Retrieveable := jResp.BoolOf('objectDescribe.retrieveable');
Searchable := jResp.BoolOf('objectDescribe.searchable');
Triggerable := jResp.BoolOf('objectDescribe.triggerable');
Undeletable := jResp.BoolOf('objectDescribe.undeletable');
Updateable := jResp.BoolOf('objectDescribe.updateable');
CompactLayouts := jResp.StringOf('objectDescribe.urls.compactLayouts');
RowTemplate := jResp.StringOf('objectDescribe.urls.rowTemplate');
Describe := jResp.StringOf('objectDescribe.urls.describe');
Layouts := jResp.StringOf('objectDescribe.urls.layouts');
Sobject := jResp.StringOf('objectDescribe.urls.sobject');
i := 0;
count_i := jResp.SizeOfArray('recentItems');
while i < count_i do
begin
jResp.I := i;
i := i + 1;
end;
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}"
}
]
}