Read - browse
Endpoint GET /<plural-segment>/list/{page}
Where <plural-segment> is the pluralized name of your domain class, e.g., for the class Sloth, the endpoint would be GET /sloths/list/{page}. The {page} parameter is of type ushort and represents the position in the paginated list.
Refer to the Endpoint segments section for information on changing the way the plural segment name is generated for your API types. By default, the pluralization follows standard English rules.
Response Codes
- 200 OK: Returns a
PagedResults<T>object containing the paginated list of DTOs. - 400 Bad Request: Returns a
BadRequestResultif the request is invalid.
Request Parameters
The browse endpoint requires the page parameter in the path and a query parameter containing values used for filtering the browsed list of objects. These values map to public properties of the domain class in a nullable form.
Additional Fields in Query Parameter
- Rows: (ushort) Specifies the requested page size used by pagination (
Skip/Take). - SortDirection: (string) Specifies the sorting direction (accepted values:
asc,desc). - SortBy: (string) Specifies the name of the class property to sort by.
DateTime Fields: DateTime fields are converted to query parameters DateFieldFrom and DateFieldTo for filtering (condition: DateFieldFrom >= DateField && DateFieldTo < DateField.AddDays(1)).
Nested Objects: Sorting by nested objects is supported (based on the nested type sort property). Filtering by nested object properties is not generated in the browse query by default.
Returned Data
The endpoint returns a PagedResults<T> object where T is a DTO class created based on the public properties of the domain class.
PagedResults Class
public class PagedResults<T> where T : new()
{
public int First { get; }
public int Rows { get; }
public int Total { get; }
public List<T> Data { get; }
public PagedResults(int first, int total, int rows, List<T> data)
{
First = first;
Total = total;
Rows = rows;
Data = data;
}
}
- First: Number of skipped items.
- Rows: Number of rows requested for a single page.
- Total: Total number of items of the specified type in the system.
- Data: List of DTOs.
where T is a DTO class created based on the public properties of the domain class. It includes only the public properties of the domain class.
Nested Objects: By default, nested objects are transformed into a simple DTO with Id and DisplayName fields. For more detailed exposure of nested object fields, refer to the “Configurations” section.
Example Domain Class:
public class Sloth : ISlothfulEntity
{
public Guid Id { get; private set; }
public string Name { get; private set; }
public int Age { get; private set; }
public string DisplayName => Name;
public Sloth(Guid id, string name, int age)
{
Id = id;
Name = name;
Age = age;
}
public void Update(string name, int age)
{
Name = name;
Age = age;
}
}
Generated Endpoint:
GET /sloths/list/{page}
Response Codes:
- 200
- 400
Request Parameters:
- Path:
page: ushort
- Query:
"rows": ushort
"sortDirection": string
"sortBy": string
"name": string
"id": guid?
"age": int?
Return Value:
{
"first": 0,
"rows": 10,
"total": 100,
"data": [
{
"id": "guid",
"name": "string",
"age": "integer",
"displayName": "string"
}
]
}