PowerBuilder / Salesforce Platform APIs / Get List View Records and Metadata API Name
Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_FieldApiName
string ls_LookupId
integer li_Sortable
integer li_IsAscending
integer li_Cloneable
integer li_Createable
integer li_Deletable
string ls_ETag
string ls_FilterLogicString
string ls_Label
string ls_Id
string ls_ListViewApiName
string ls_ObjectApiName
string ls_V_Type
integer li_Updateable
integer li_Site
integer li_ColumnWidthsType
integer li_BillingCountry
integer li_Owner_Alias
integer li_Phone
integer li_Name
integer li_ColumnWrapSite
integer li_ColumnWrapType
integer li_ColumnWrapBillingCountry
integer li_ColumnWrapOwner_Alias
integer li_ColumnWrapPhone
integer li_ColumnWrapName
string ls_Visibility
integer li_VisibilityEditable
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}}/ui-api/list-info/:SOBJECT_API_NAME/:LIST_VIEW_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)
// {
// "cloneable": true,
// "createable": true,
// "deletable": true,
// "displayColumns": [
// {
// "fieldApiName": "Name",
// "label": "Account Name",
// "lookupId": "Id",
// "sortable": true
// },
// {
// "fieldApiName": "Site",
// "label": "Account Site",
// "lookupId": null,
// "sortable": true
// },
// {
// "fieldApiName": "Phone",
// "label": "Phone",
// "lookupId": null,
// "sortable": true
// },
// {
// "fieldApiName": "Type",
// "label": "Type",
// "lookupId": null,
// "sortable": true
// },
// {
// "fieldApiName": "BillingCountry",
// "label": "Billing Country",
// "lookupId": null,
// "sortable": true
// },
// {
// "fieldApiName": "Owner.Alias",
// "label": "Account Owner Alias",
// "lookupId": "Owner.Id",
// "sortable": true
// }
// ],
// "eTag": "55ebdd0de6c2f1e17f63bf4581d64f76",
// "filterLogicString": null,
// "filteredByInfo": [
// ],
// "label": "All Accounts",
// "listReference": {
// "id": "00B58000002ssinEAA",
// "listViewApiName": "AllAccounts",
// "objectApiName": "Account",
// "type": "listView"
// },
// "objectApiNames": [
// ],
// "orderedByInfo": [
// {
// "fieldApiName": "BillingCountry",
// "isAscending": false,
// "label": "Billing Country"
// }
// ],
// "updateable": true,
// "userPreferences": {
// "columnWidths": {
// "Site": -1,
// "Type": -1,
// "BillingCountry": -1,
// "Owner.Alias": -1,
// "Phone": -1,
// "Name": -1
// },
// "columnWrap": {
// "Site": false,
// "Type": false,
// "BillingCountry": false,
// "Owner.Alias": false,
// "Phone": false,
// "Name": false
// }
// },
// "visibility": "Public",
// "visibilityEditable": true
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
li_Cloneable = loo_JResp.BoolOf("cloneable")
li_Createable = loo_JResp.BoolOf("createable")
li_Deletable = loo_JResp.BoolOf("deletable")
ls_ETag = loo_JResp.StringOf("eTag")
ls_FilterLogicString = loo_JResp.StringOf("filterLogicString")
ls_Label = loo_JResp.StringOf("label")
ls_Id = loo_JResp.StringOf("listReference.id")
ls_ListViewApiName = loo_JResp.StringOf("listReference.listViewApiName")
ls_ObjectApiName = loo_JResp.StringOf("listReference.objectApiName")
ls_V_Type = loo_JResp.StringOf("listReference.type")
li_Updateable = loo_JResp.BoolOf("updateable")
li_Site = loo_JResp.IntOf("userPreferences.columnWidths.Site")
li_ColumnWidthsType = loo_JResp.IntOf("userPreferences.columnWidths.Type")
li_BillingCountry = loo_JResp.IntOf("userPreferences.columnWidths.BillingCountry")
li_Owner_Alias = loo_JResp.IntOf("userPreferences.columnWidths.~"Owner.Alias~"")
li_Phone = loo_JResp.IntOf("userPreferences.columnWidths.Phone")
li_Name = loo_JResp.IntOf("userPreferences.columnWidths.Name")
li_ColumnWrapSite = loo_JResp.BoolOf("userPreferences.columnWrap.Site")
li_ColumnWrapType = loo_JResp.BoolOf("userPreferences.columnWrap.Type")
li_ColumnWrapBillingCountry = loo_JResp.BoolOf("userPreferences.columnWrap.BillingCountry")
li_ColumnWrapOwner_Alias = loo_JResp.BoolOf("userPreferences.columnWrap.~"Owner.Alias~"")
li_ColumnWrapPhone = loo_JResp.BoolOf("userPreferences.columnWrap.Phone")
li_ColumnWrapName = loo_JResp.BoolOf("userPreferences.columnWrap.Name")
ls_Visibility = loo_JResp.StringOf("visibility")
li_VisibilityEditable = loo_JResp.BoolOf("visibilityEditable")
i = 0
li_Count_i = loo_JResp.SizeOfArray("displayColumns")
do while i < li_Count_i
loo_JResp.I = i
ls_FieldApiName = loo_JResp.StringOf("displayColumns[i].fieldApiName")
ls_Label = loo_JResp.StringOf("displayColumns[i].label")
ls_LookupId = loo_JResp.StringOf("displayColumns[i].lookupId")
li_Sortable = loo_JResp.BoolOf("displayColumns[i].sortable")
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("filteredByInfo")
do while i < li_Count_i
loo_JResp.I = i
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("objectApiNames")
do while i < li_Count_i
loo_JResp.I = i
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("orderedByInfo")
do while i < li_Count_i
loo_JResp.I = i
ls_FieldApiName = loo_JResp.StringOf("orderedByInfo[i].fieldApiName")
li_IsAscending = loo_JResp.BoolOf("orderedByInfo[i].isAscending")
ls_Label = loo_JResp.StringOf("orderedByInfo[i].label")
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}}/ui-api/list-info/:SOBJECT_API_NAME/:LIST_VIEW_API_NAME
Postman Collection Item JSON
{
"name": "Get List View Records and Metadata API Name",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/ui-api/list-info/:SOBJECT_API_NAME/:LIST_VIEW_API_NAME",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"ui-api",
"list-info",
":SOBJECT_API_NAME",
":LIST_VIEW_API_NAME"
],
"variable": [
{
"key": "SOBJECT_API_NAME",
"value": "",
"description": "Object API name"
},
{
"key": "LIST_VIEW_API_NAME",
"value": "",
"description": "List view API name"
}
]
},
"description": "Returns record data and metadata for a list view."
},
"response": [
{
"name": "Get List View Records and Metadata API Name",
"originalRequest": {
"method": "GET",
"header": [
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/ui-api/list-info/:SOBJECT_API_NAME/:LIST_VIEW_API_NAME",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"ui-api",
"list-info",
":SOBJECT_API_NAME",
":LIST_VIEW_API_NAME"
],
"variable": [
{
"key": "SOBJECT_API_NAME",
"value": "Account",
"description": "Object API name"
},
{
"key": "LIST_VIEW_API_NAME",
"value": "AllAccounts",
"description": "List view API name"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Date",
"value": "Fri, 06 Oct 2023 09:58:32 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": "ETag",
"value": "\"55ebdd0de6c2f1e17f63bf4581d64f76--gzip\""
},
{
"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 \"cloneable\": true,\n \"createable\": true,\n \"deletable\": true,\n \"displayColumns\": [\n {\n \"fieldApiName\": \"Name\",\n \"label\": \"Account Name\",\n \"lookupId\": \"Id\",\n \"sortable\": true\n },\n {\n \"fieldApiName\": \"Site\",\n \"label\": \"Account Site\",\n \"lookupId\": null,\n \"sortable\": true\n },\n {\n \"fieldApiName\": \"Phone\",\n \"label\": \"Phone\",\n \"lookupId\": null,\n \"sortable\": true\n },\n {\n \"fieldApiName\": \"Type\",\n \"label\": \"Type\",\n \"lookupId\": null,\n \"sortable\": true\n },\n {\n \"fieldApiName\": \"BillingCountry\",\n \"label\": \"Billing Country\",\n \"lookupId\": null,\n \"sortable\": true\n },\n {\n \"fieldApiName\": \"Owner.Alias\",\n \"label\": \"Account Owner Alias\",\n \"lookupId\": \"Owner.Id\",\n \"sortable\": true\n }\n ],\n \"eTag\": \"55ebdd0de6c2f1e17f63bf4581d64f76\",\n \"filterLogicString\": null,\n \"filteredByInfo\": [],\n \"label\": \"All Accounts\",\n \"listReference\": {\n \"id\": \"00B58000002ssinEAA\",\n \"listViewApiName\": \"AllAccounts\",\n \"objectApiName\": \"Account\",\n \"type\": \"listView\"\n },\n \"objectApiNames\": [],\n \"orderedByInfo\": [\n {\n \"fieldApiName\": \"BillingCountry\",\n \"isAscending\": false,\n \"label\": \"Billing Country\"\n }\n ],\n \"updateable\": true,\n \"userPreferences\": {\n \"columnWidths\": {\n \"Site\": -1,\n \"Type\": -1,\n \"BillingCountry\": -1,\n \"Owner.Alias\": -1,\n \"Phone\": -1,\n \"Name\": -1\n },\n \"columnWrap\": {\n \"Site\": false,\n \"Type\": false,\n \"BillingCountry\": false,\n \"Owner.Alias\": false,\n \"Phone\": false,\n \"Name\": false\n }\n },\n \"visibility\": \"Public\",\n \"visibilityEditable\": true\n}"
}
]
}