How to get all list items
• 2 minutes to read
Built-In lists
The advantage of using the List endpoint, when it comes to build in lists, it that it is very straightforward and easy to choose the correct method. The Agent APIs, including the RESTful Agent API and proxy clients, have methods that are named the same as the list.
The method will return the list items with no added work. For example, the RESTful Agent API GetCountries endpoint gets all countries.
Use the list name to get all list items for built-in lists.
GET https://{{env}}.superoffice.com/{{tenant}}/api/v1/List/Category/Items
Authorization: Bearer {{token}}
Accept: application/json; charset=utf-8
POST https://{{env}}.superoffice.com/{{tenant}}/api/v1/Agents/List/GetCategories HTTP/1.1
Authorization: Bearer {{token}}
Accept: application/json; charset=utf-8
Content-Type: application/json; charset=utf-8
How to get all list items using the SuperOffice.WebApi proxy client.
var config = new WebApiOptions(tenant.WebApiUrl);
config.Authorization = new AuthorizationAccessToken("8A:Cust12345.Example-Token", OnlineEnvironment.SOD);
var agent = new ListAgent(config);
var listEntity = agent.GetCategoriesAsync().Result;
User-defined lists
Use the prefix udlist
and suffix {listId}
to get all list items for user-defined lists. For example, given a user-defined list named "MyCustomList" has an Id value of 94, the list name to use is udlist94
.
See the relevant examples below.
Must use the MDOList endpoint for user-defined lists.
GET https://{{env}}.superoffice.com/{{tenant}}/api/v1/MDOList/udlist94 HTTP/1.1
Authorization: Bearer {{token}}
Accept: application/json; charset=utf-8
Must use the MDOList endpoint for user-defined lists. Both of the following options work.
POST https://{{env}}.superoffice.com/{{tenant}}/api/v1/Agents/MDO/GetList HTTP/1.1
Authorization: Bearer {{token}}
Accept: application/json; charset=utf-8
Content-Type: application/json; charset=utf-8
{
"Name": "udlist",
"ForceFlatList": false,
"AdditionalInfo": "94",
"OnlyHistory": false
}
or
POST https://{{env}}.superoffice.com/{{tenant}}/api/v1/Agents/MDO/GetList HTTP/1.1
Authorization: Bearer {{token}}
Accept: application/json; charset=utf-8
Content-Type: application/json; charset=utf-8
{
"Name": "udlist94",
"ForceFlatList": false,
"AdditionalInfo": "",
"OnlyHistory": false
}
How to get all list items using the SuperOffice.WebApi proxy client.
var config = new WebApiOptions(tenant.WebApiUrl);
config.Authorization = new AuthorizationAccessToken("8A:Cust12345.Example-Token", OnlineEnvironment.SOD);
var agent = new MDOAgent(config);
var listEntity = agent.GetListAsync("udlist94").Result;
Back