Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
integer li_LocationColumn
integer li_LocationLine
string ls_Name
string ls_V_type
integer j
integer li_Count_j
string ls_StrVal
string ls_ReturnType
string ls_V_Type
string ls_V_Url
string ls_Id
string ls_NamespacePrefix
string ls_Name
integer li_ApiVersion
string ls_Status
integer li_IsValid
integer li_BodyCrc
string ls_Body
integer li_LengthWithoutComments
string ls_CreatedDate
string ls_CreatedById
string ls_LastModifiedDate
string ls_LastModifiedById
string ls_SystemModstamp
string ls_ManageableState
string ls_SymbolTableId
string ls_Key
string ls_SymbolTableName
string ls_Namespace
string ls_ParentClass
integer li_Column
integer li_Line
string ls_TableDeclarationName
string ls_TableDeclarationType
integer li_MetadataApiVersion
string ls_MetadataStatus
string ls_Urls
string ls_FullName
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/:RECORD_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)
// {
// "attributes": {
// "type": "ApexClass",
// "url": "/services/data/v59.0/tooling/sobjects/ApexClass/01p4H00000A4kfqQAB"
// },
// "Id": "01p4H00000A4kfqQAB",
// "NamespacePrefix": "smon",
// "Name": "GenericEventPostMock",
// "ApiVersion": 59,
// "Status": "Active",
// "IsValid": false,
// "BodyCrc": -1,
// "Body": "/*\nThis file is generated and isn't the actual source code for this\nmanaged global class.\nThis read-only file shows the class's global constructors,\nmethods, variables, and properties.\nTo enable code to compile, all methods return null.\n*/\nglobal class GenericEventPostMock implements System.HttpCalloutMock {\n global GenericEventPostMock(Integer statusCode) {\n\n }\n global System.HttpResponse respond(System.HttpRequest req) {\n return null;\n }\n}\n",
// "LengthWithoutComments": -1,
// "CreatedDate": "2023-11-20T08:03:40.000+0000",
// "CreatedById": "00558000000yFyDAAU",
// "LastModifiedDate": "2023-11-20T08:03:40.000+0000",
// "LastModifiedById": "00558000000yFyDAAU",
// "SystemModstamp": "2023-11-26T14:10:11.000+0000",
// "ManageableState": "installed",
// "SymbolTable": {
// "constructors": [
// {
// "annotations": [
// ],
// "location": {
// "column": 12,
// "line": 5
// },
// "modifiers": [
// "global"
// ],
// "name": "GenericEventPostMock",
// "parameters": [
// {
// "name": "statusCode",
// "type": "Integer"
// }
// ],
// "references": [
// ],
// "type": null
// }
// ],
// "externalReferences": [
// ],
// "id": "smon.GenericEventPostMock",
// "innerClasses": [
// ],
// "interfaces": [
// "System.HttpCalloutMock"
// ],
// "key": "smon.GenericEventPostMock",
// "methods": [
// {
// "annotations": [
// ],
// "location": {
// "column": 25,
// "line": 9
// },
// "modifiers": [
// "global"
// ],
// "name": "respond",
// "parameters": [
// {
// "name": "req",
// "type": "System.HttpRequest"
// }
// ],
// "references": [
// ],
// "returnType": "System.HttpResponse",
// "type": null
// }
// ],
// "name": "GenericEventPostMock",
// "namespace": "smon",
// "parentClass": "",
// "properties": [
// ],
// "tableDeclaration": {
// "annotations": [
// {
// "name": "IsTest"
// }
// ],
// "location": {
// "column": 14,
// "line": 2
// },
// "modifiers": [
// "testMethod",
// "global"
// ],
// "name": "GenericEventPostMock",
// "references": [
// ],
// "type": "smon.GenericEventPostMock"
// },
// "variables": [
// ]
// },
// "Metadata": {
// "apiVersion": 59,
// "packageVersions": [
// ],
// "status": "Active",
// "urls": null
// },
// "FullName": "smon__GenericEventPostMock"
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
ls_V_Type = loo_JResp.StringOf("attributes.type")
ls_V_Url = loo_JResp.StringOf("attributes.url")
ls_Id = loo_JResp.StringOf("Id")
ls_NamespacePrefix = loo_JResp.StringOf("NamespacePrefix")
ls_Name = loo_JResp.StringOf("Name")
li_ApiVersion = loo_JResp.IntOf("ApiVersion")
ls_Status = loo_JResp.StringOf("Status")
li_IsValid = loo_JResp.BoolOf("IsValid")
li_BodyCrc = loo_JResp.IntOf("BodyCrc")
ls_Body = loo_JResp.StringOf("Body")
li_LengthWithoutComments = loo_JResp.IntOf("LengthWithoutComments")
ls_CreatedDate = loo_JResp.StringOf("CreatedDate")
ls_CreatedById = loo_JResp.StringOf("CreatedById")
ls_LastModifiedDate = loo_JResp.StringOf("LastModifiedDate")
ls_LastModifiedById = loo_JResp.StringOf("LastModifiedById")
ls_SystemModstamp = loo_JResp.StringOf("SystemModstamp")
ls_ManageableState = loo_JResp.StringOf("ManageableState")
ls_SymbolTableId = loo_JResp.StringOf("SymbolTable.id")
ls_Key = loo_JResp.StringOf("SymbolTable.key")
ls_SymbolTableName = loo_JResp.StringOf("SymbolTable.name")
ls_Namespace = loo_JResp.StringOf("SymbolTable.namespace")
ls_ParentClass = loo_JResp.StringOf("SymbolTable.parentClass")
li_Column = loo_JResp.IntOf("SymbolTable.tableDeclaration.location.column")
li_Line = loo_JResp.IntOf("SymbolTable.tableDeclaration.location.line")
ls_TableDeclarationName = loo_JResp.StringOf("SymbolTable.tableDeclaration.name")
ls_TableDeclarationType = loo_JResp.StringOf("SymbolTable.tableDeclaration.type")
li_MetadataApiVersion = loo_JResp.IntOf("Metadata.apiVersion")
ls_MetadataStatus = loo_JResp.StringOf("Metadata.status")
ls_Urls = loo_JResp.StringOf("Metadata.urls")
ls_FullName = loo_JResp.StringOf("FullName")
i = 0
li_Count_i = loo_JResp.SizeOfArray("SymbolTable.constructors")
do while i < li_Count_i
loo_JResp.I = i
li_LocationColumn = loo_JResp.IntOf("SymbolTable.constructors[i].location.column")
li_LocationLine = loo_JResp.IntOf("SymbolTable.constructors[i].location.line")
ls_Name = loo_JResp.StringOf("SymbolTable.constructors[i].name")
ls_V_type = loo_JResp.StringOf("SymbolTable.constructors[i].type")
j = 0
li_Count_j = loo_JResp.SizeOfArray("SymbolTable.constructors[i].annotations")
do while j < li_Count_j
loo_JResp.J = j
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("SymbolTable.constructors[i].modifiers")
do while j < li_Count_j
loo_JResp.J = j
ls_StrVal = loo_JResp.StringOf("SymbolTable.constructors[i].modifiers[j]")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("SymbolTable.constructors[i].parameters")
do while j < li_Count_j
loo_JResp.J = j
ls_Name = loo_JResp.StringOf("SymbolTable.constructors[i].parameters[j].name")
ls_V_type = loo_JResp.StringOf("SymbolTable.constructors[i].parameters[j].type")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("SymbolTable.constructors[i].references")
do while j < li_Count_j
loo_JResp.J = j
j = j + 1
loop
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("SymbolTable.externalReferences")
do while i < li_Count_i
loo_JResp.I = i
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("SymbolTable.innerClasses")
do while i < li_Count_i
loo_JResp.I = i
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("SymbolTable.interfaces")
do while i < li_Count_i
loo_JResp.I = i
ls_StrVal = loo_JResp.StringOf("SymbolTable.interfaces[i]")
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("SymbolTable.methods")
do while i < li_Count_i
loo_JResp.I = i
li_LocationColumn = loo_JResp.IntOf("SymbolTable.methods[i].location.column")
li_LocationLine = loo_JResp.IntOf("SymbolTable.methods[i].location.line")
ls_Name = loo_JResp.StringOf("SymbolTable.methods[i].name")
ls_ReturnType = loo_JResp.StringOf("SymbolTable.methods[i].returnType")
ls_V_type = loo_JResp.StringOf("SymbolTable.methods[i].type")
j = 0
li_Count_j = loo_JResp.SizeOfArray("SymbolTable.methods[i].annotations")
do while j < li_Count_j
loo_JResp.J = j
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("SymbolTable.methods[i].modifiers")
do while j < li_Count_j
loo_JResp.J = j
ls_StrVal = loo_JResp.StringOf("SymbolTable.methods[i].modifiers[j]")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("SymbolTable.methods[i].parameters")
do while j < li_Count_j
loo_JResp.J = j
ls_Name = loo_JResp.StringOf("SymbolTable.methods[i].parameters[j].name")
ls_V_type = loo_JResp.StringOf("SymbolTable.methods[i].parameters[j].type")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("SymbolTable.methods[i].references")
do while j < li_Count_j
loo_JResp.J = j
j = j + 1
loop
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("SymbolTable.properties")
do while i < li_Count_i
loo_JResp.I = i
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("SymbolTable.tableDeclaration.annotations")
do while i < li_Count_i
loo_JResp.I = i
ls_Name = loo_JResp.StringOf("SymbolTable.tableDeclaration.annotations[i].name")
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("SymbolTable.tableDeclaration.modifiers")
do while i < li_Count_i
loo_JResp.I = i
ls_StrVal = loo_JResp.StringOf("SymbolTable.tableDeclaration.modifiers[i]")
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("SymbolTable.tableDeclaration.references")
do while i < li_Count_i
loo_JResp.I = i
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("SymbolTable.variables")
do while i < li_Count_i
loo_JResp.I = i
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("Metadata.packageVersions")
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/:RECORD_ID
Postman Collection Item JSON
{
"name": "Access Records",
"request": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/tooling/sobjects/:SOBJECT_API_NAME/:RECORD_ID",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"tooling",
"sobjects",
":SOBJECT_API_NAME",
":RECORD_ID"
],
"variable": [
{
"key": "SOBJECT_API_NAME",
"value": ""
},
{
"key": "RECORD_ID",
"value": ""
}
]
}
},
"response": [
{
"name": "Access Records",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/tooling/sobjects/:SOBJECT_API_NAME/:RECORD_ID",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"tooling",
"sobjects",
":SOBJECT_API_NAME",
":RECORD_ID"
],
"variable": [
{
"key": "SOBJECT_API_NAME",
"value": "ApexClass"
},
{
"key": "RECORD_ID",
"value": "01p4H00000A4kfqQAB"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Date",
"value": "Mon, 11 Dec 2023 10:38:26 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=308/15000"
},
{
"key": "Last-Modified",
"value": "Sun, 26 Nov 2023 14:10:11 GMT"
},
{
"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 \"attributes\": {\n \"type\": \"ApexClass\",\n \"url\": \"/services/data/v59.0/tooling/sobjects/ApexClass/01p4H00000A4kfqQAB\"\n },\n \"Id\": \"01p4H00000A4kfqQAB\",\n \"NamespacePrefix\": \"smon\",\n \"Name\": \"GenericEventPostMock\",\n \"ApiVersion\": 59,\n \"Status\": \"Active\",\n \"IsValid\": false,\n \"BodyCrc\": -1,\n \"Body\": \"/*\\nThis file is generated and isn't the actual source code for this\\nmanaged global class.\\nThis read-only file shows the class's global constructors,\\nmethods, variables, and properties.\\nTo enable code to compile, all methods return null.\\n*/\\nglobal class GenericEventPostMock implements System.HttpCalloutMock {\\n global GenericEventPostMock(Integer statusCode) {\\n\\n }\\n global System.HttpResponse respond(System.HttpRequest req) {\\n return null;\\n }\\n}\\n\",\n \"LengthWithoutComments\": -1,\n \"CreatedDate\": \"2023-11-20T08:03:40.000+0000\",\n \"CreatedById\": \"00558000000yFyDAAU\",\n \"LastModifiedDate\": \"2023-11-20T08:03:40.000+0000\",\n \"LastModifiedById\": \"00558000000yFyDAAU\",\n \"SystemModstamp\": \"2023-11-26T14:10:11.000+0000\",\n \"ManageableState\": \"installed\",\n \"SymbolTable\": {\n \"constructors\": [\n {\n \"annotations\": [],\n \"location\": {\n \"column\": 12,\n \"line\": 5\n },\n \"modifiers\": [\n \"global\"\n ],\n \"name\": \"GenericEventPostMock\",\n \"parameters\": [\n {\n \"name\": \"statusCode\",\n \"type\": \"Integer\"\n }\n ],\n \"references\": [],\n \"type\": null\n }\n ],\n \"externalReferences\": [],\n \"id\": \"smon.GenericEventPostMock\",\n \"innerClasses\": [],\n \"interfaces\": [\n \"System.HttpCalloutMock\"\n ],\n \"key\": \"smon.GenericEventPostMock\",\n \"methods\": [\n {\n \"annotations\": [],\n \"location\": {\n \"column\": 25,\n \"line\": 9\n },\n \"modifiers\": [\n \"global\"\n ],\n \"name\": \"respond\",\n \"parameters\": [\n {\n \"name\": \"req\",\n \"type\": \"System.HttpRequest\"\n }\n ],\n \"references\": [],\n \"returnType\": \"System.HttpResponse\",\n \"type\": null\n }\n ],\n \"name\": \"GenericEventPostMock\",\n \"namespace\": \"smon\",\n \"parentClass\": \"\",\n \"properties\": [],\n \"tableDeclaration\": {\n \"annotations\": [\n {\n \"name\": \"IsTest\"\n }\n ],\n \"location\": {\n \"column\": 14,\n \"line\": 2\n },\n \"modifiers\": [\n \"testMethod\",\n \"global\"\n ],\n \"name\": \"GenericEventPostMock\",\n \"references\": [],\n \"type\": \"smon.GenericEventPostMock\"\n },\n \"variables\": []\n },\n \"Metadata\": {\n \"apiVersion\": 59,\n \"packageVersions\": [],\n \"status\": \"Active\",\n \"urls\": null\n },\n \"FullName\": \"smon__GenericEventPostMock\"\n}"
}
]
}