Pagination
The pagination is available in API from 2025-02-27 and can be used in SDK from version 13.10.0.
The pagination can be enabled on selected API methods by explicitly specifying the EnablePagination
property on the request object and setting it to value true
. There are two other optional properties. The first one is PageSize
, which defines the size of each page; the value has boundaries from 1 to 5000. A value outside of the boundary will fail the request. The second optional property is PageIndex
, which is used to iterate through pages. The valid value is from 0 to N. Whether another page is available can be determined by comparing the count of returned items with the page size. Whenever the page size and the number of returned items are the same, there is probably a subsequent page. The empty page will return an empty list of results.
The feature is backward compatible, which means the property EnablePagination
must be set to true to explicitly request pagination.
The results of a paginated method are ordered by creation time in ascending order, from the oldest records to the newest. In this approach, a new entity will never interrupt the pagination and will be added as a new entity on the latest or a new page. Only the delete operation can shift entities toward the beginning of the enumeration. Creating a new entity is much more likely than deleting an existing one. Be aware of filters that can more likely affect the returned entities between pages.
A delete operation can shift entities on a page, which may lead to skipping some entities. Additionally, filters can further complicate this issue, as any updated entities might be excluded between page requests.
Supported methods
New properties on request
Property |
| Description |
---|---|---|
EnablePagination | optional | It must be set to |
PageSize | optional | Defines the size of a page; the value has boundaries from 1 to 5000. Negative, zero, and values higher than 5000 are not allowed. The default value is 2000. |
PageIndex | optional | Used to iterate through pages. The valid value is from 0 to N. Negative values are not allowed. The default value is 0. |
Example of usage by the SDK
The SDK uses IAsyncEnumerable<>
interface to process the requests for each page asynchronously.
var entitiesCount = 0;
var pageCount = 0;
var service = provider.GetRequiredService<IBfsLegalEntitiesService>();
await foreach (var response in service.GetLegalEntitiesInPagesAsync(new GetPersonArgs()))
{
entitiesCount += response.Result.Length;
pageCount++;
foreach (var entity in response.Result)
{
ProcessEntity(entity);
}
}
Example of request content
POST {{hostName}}/api/bfsapi.asmx HTTP/1.1
SOAPAction: "http://tempuri.org/GetPersons"
Content-Type: text/xml; charset=utf-8
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<GetPersons xmlns="http://tempuri.org/">
<req>
<Credentials>
<UserName>{{userName}}</UserName>
<Password>{{password}}</Password>
</Credentials>
<identify>{{identify}}</identify>
<Fields>
<BrickId>true</BrickId>
<FirstName>true</FirstName>
<LastName>true</LastName>
<CreatedDate>true</CreatedDate>
<UserName>true</UserName>
<PersonalNumber>true</PersonalNumber>
<CustomFields>true</CustomFields>
</Fields>
<EnablePagination>true</EnablePagination>
<PageIndex>0</PageIndex>
<PageSize>1000</PageSize>
</req>
</GetPersons>
</soap:Body>
</soap:Envelope>
Related content
Terms of License
Change Policy
© 2009 - 2024 Huddlestock Technologies AB All rights reserved