MIFOSX-322: update apidocs for client pagination and sorting.
This commit is contained in:
+106
-40
@@ -1908,7 +1908,7 @@ Request Body:
|
|||||||
<a id="clients_activate" name="clients_activate" class="old-syle-anchor"> </a>
|
<a id="clients_activate" name="clients_activate" class="old-syle-anchor"> </a>
|
||||||
<div class="method-section">
|
<div class="method-section">
|
||||||
<div class="method-description">
|
<div class="method-description">
|
||||||
<h2>Activate a Client</h2>
|
<h4>Activate a Client</h4>
|
||||||
<p>Clients can be created in a <i>Pending</i> state. This API exists to enable client activation (for when a client becomes approved member of microfinance institue).</p>
|
<p>Clients can be created in a <i>Pending</i> state. This API exists to enable client activation (for when a client becomes approved member of microfinance institue).</p>
|
||||||
<p>If the client happens to be alrady active this API will result in an error.</p>
|
<p>If the client happens to be alrady active this API will result in an error.</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -1983,6 +1983,74 @@ GET https://DomainName/api/v1/clients/{clientId}
|
|||||||
<div class="method-section">
|
<div class="method-section">
|
||||||
<div class="method-description">
|
<div class="method-description">
|
||||||
<h4>List Clients</h4>
|
<h4>List Clients</h4>
|
||||||
|
<p>The <i>list</i> capability of clients can support <b>pagination</b> and <b>sorting</b>.</p>
|
||||||
|
<h5>Optional Arguments</h5>
|
||||||
|
<dl class="argument-list">
|
||||||
|
<dt>offset</dt>
|
||||||
|
<dd>
|
||||||
|
Integer <span>optional</span>, defaults to 0
|
||||||
|
</dd>
|
||||||
|
<dd>Indicates from what result to start from.</dd>
|
||||||
|
|
||||||
|
<dt>limit</dt>
|
||||||
|
<dd>
|
||||||
|
Integer <span>optional</span>, defaults to 200
|
||||||
|
</dd>
|
||||||
|
<dd>Restricts the size of results returned.</dd>
|
||||||
|
|
||||||
|
<dt>orderBy</dt>
|
||||||
|
<dd>
|
||||||
|
String <span>optional</span>, one of <span>displayName, accountNo, officeId, officeName</span>
|
||||||
|
</dd>
|
||||||
|
<dd>Orders the results by the field indicated.</dd>
|
||||||
|
|
||||||
|
<dt>sortBy</dt>
|
||||||
|
<dd>
|
||||||
|
String <span>optional</span>, one of <span>ASC, DESC</span>
|
||||||
|
</dd>
|
||||||
|
<dd>Indicates what way to order results if <i>orderBy</i> is used.</dd>
|
||||||
|
|
||||||
|
<dt>officeId</dt>
|
||||||
|
<dd>
|
||||||
|
Integer <span>optional</span>
|
||||||
|
</dd>
|
||||||
|
<dd>Provides ability to restrict list of clients returned based on the office there associated with.</dd>
|
||||||
|
<dt>underHierarchy</dt>
|
||||||
|
<dd>
|
||||||
|
String <span>optional</span>
|
||||||
|
</dd>
|
||||||
|
<dd>Use the office hierarchy string to return all clients under a given hierarchy.</dd>
|
||||||
|
|
||||||
|
<dt>displayName</dt>
|
||||||
|
<dd>
|
||||||
|
String <span>optional</span>
|
||||||
|
</dd>
|
||||||
|
<dd>Use displayName of clients to restrict results.</dd>
|
||||||
|
|
||||||
|
<dt>firstName</dt>
|
||||||
|
<dd>
|
||||||
|
String <span>optional</span>
|
||||||
|
</dd>
|
||||||
|
<dd>Use firstName of clients to restrict results.</dd>
|
||||||
|
|
||||||
|
<dt>lastName</dt>
|
||||||
|
<dd>
|
||||||
|
String <span>optional</span>
|
||||||
|
</dd>
|
||||||
|
<dd>Use lastName of clients to restrict results.</dd>
|
||||||
|
|
||||||
|
<dt>externalId</dt>
|
||||||
|
<dd>
|
||||||
|
String <span>optional</span>
|
||||||
|
</dd>
|
||||||
|
<dd>Use externalId of clients to restrict results.</dd>
|
||||||
|
|
||||||
|
<dt>sqlSearch</dt>
|
||||||
|
<dd>
|
||||||
|
String <span>optional</span>
|
||||||
|
</dd>
|
||||||
|
<dd>Use an sql fragment valid for the underlying client schema to filter results. e.g. display_name like %K%</dd>
|
||||||
|
</dl>
|
||||||
<p>Example Requests:</p>
|
<p>Example Requests:</p>
|
||||||
<div class=apiClick>clients</div>
|
<div class=apiClick>clients</div>
|
||||||
<br>
|
<br>
|
||||||
@@ -1994,46 +2062,44 @@ GET https://DomainName/api/v1/clients/{clientId}
|
|||||||
GET https://DomainName/api/v1/clients
|
GET https://DomainName/api/v1/clients
|
||||||
</code>
|
</code>
|
||||||
<code class="method-response">
|
<code class="method-response">
|
||||||
[
|
{
|
||||||
{
|
"totalFilteredRecords": 2,
|
||||||
"id": 2,
|
"pageItems": [
|
||||||
"accountNo": "000000002",
|
{
|
||||||
"status": {
|
"id": 1,
|
||||||
"id": 300,
|
"accountNo": "000000001",
|
||||||
"code": "clientStatusType.active",
|
"status": {
|
||||||
"value": "Active"
|
"id": 300,
|
||||||
|
"code": "clientStatusType.active",
|
||||||
|
"value": "Active"
|
||||||
|
},
|
||||||
|
"active": true,
|
||||||
|
"activationDate": [
|
||||||
|
2013,
|
||||||
|
3,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"fullname": "Small shop",
|
||||||
|
"displayName": "Small shop",
|
||||||
|
"officeId": 1,
|
||||||
|
"officeName": "Head Office"
|
||||||
},
|
},
|
||||||
"activationDate": [
|
{
|
||||||
2009,
|
"id": 2,
|
||||||
3,
|
"accountNo": "000000002",
|
||||||
4
|
"status": {
|
||||||
],
|
"id": 100,
|
||||||
"fullname": "Client of group",
|
"code": "clientStatusType.pending",
|
||||||
"displayName": "Client of group",
|
"value": "Pending"
|
||||||
"officeId": 1,
|
},
|
||||||
"officeName": "Head Office"
|
"active": false,
|
||||||
},
|
"fullname": "Home Farm Produce",
|
||||||
{
|
"displayName": "Home Farm Produce",
|
||||||
"id": 1,
|
"officeId": 1,
|
||||||
"accountNo": "000000001",
|
"officeName": "Head Office"
|
||||||
"externalId": "786YYH7",
|
}
|
||||||
"status": {
|
]
|
||||||
"id": 300,
|
}
|
||||||
"code": "clientStatusType.active",
|
|
||||||
"value": "Active"
|
|
||||||
},
|
|
||||||
"activationDate": [
|
|
||||||
2009,
|
|
||||||
3,
|
|
||||||
4
|
|
||||||
],
|
|
||||||
"firstname": "Petra",
|
|
||||||
"lastname": "Yton",
|
|
||||||
"displayName": "Petra Yton",
|
|
||||||
"officeId": 1,
|
|
||||||
"officeName": "Head Office"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+6
-2
@@ -94,7 +94,11 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
|
|||||||
// have to scan entire database table.
|
// have to scan entire database table.
|
||||||
// sql += " order by c.display_name ASC, c.account_no ASC";
|
// sql += " order by c.display_name ASC, c.account_no ASC";
|
||||||
if (searchParameters.isOrderByRequested()) {
|
if (searchParameters.isOrderByRequested()) {
|
||||||
sqlBuilder.append(" order by ").append(searchParameters.getOrderBy()).append(' ').append(searchParameters.getSortOrder());
|
sqlBuilder.append(" order by ").append(searchParameters.getOrderBy());
|
||||||
|
|
||||||
|
if (searchParameters.isSortOrderProvided()) {
|
||||||
|
sqlBuilder.append(' ').append(searchParameters.getSortOrder());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchParameters.isLimited()) {
|
if (searchParameters.isLimited()) {
|
||||||
@@ -130,7 +134,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (externalId != null) {
|
if (externalId != null) {
|
||||||
extraCriteria += " and external_id like " + ApiParameterHelper.sqlEncodeString(externalId);
|
extraCriteria += " and c.external_id like " + ApiParameterHelper.sqlEncodeString(externalId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (displayName != null) {
|
if (displayName != null) {
|
||||||
|
|||||||
+5
-1
@@ -56,7 +56,11 @@ public final class SearchParameters {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOrderByRequested() {
|
public boolean isOrderByRequested() {
|
||||||
return StringUtils.isNotBlank(this.orderBy) && StringUtils.isNotBlank(this.sortOrder);
|
return StringUtils.isNotBlank(this.orderBy);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSortOrderProvided() {
|
||||||
|
return StringUtils.isNotBlank(this.sortOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSqlSearch() {
|
public String getSqlSearch() {
|
||||||
|
|||||||
Reference in New Issue
Block a user