GetCatalogItemsPage
Retrieves page of catalog items from the server, with language fields limited to the text for the current or default language.
Service | Operation |
---|---|
itemCatalog | GET_CATALOG_ITEMS_PAGE |
Method Parameters
Parameter | Description |
---|---|
context | The json context for the page request. |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string context = "{\"pagination\":{\"rowsPerPage\":50,\"pageNumber\":1},\"searchCriteria\":{\"category\":\"sword\"},\"sortCriteria\":{\"createdAt\":1,\"updatedAt\":-1}}";
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error));
};
_bc.ItemCatalogService.GetCatalogItemsPage(context, successCallback, failureCallback);
const char *context = "{\"pagination\":{\"rowsPerPage\":50,\"pageNumber\":1},\"searchCriteria\":{\"category\":\"sword\"},\"sortCriteria\":{\"createdAt\":1,\"updatedAt\":-1}}";
_bc->getItemCatalogService()->getCatalogItemsPage(context, this);
NSString *context = "{\"pagination\":{\"rowsPerPage\":50,\"pageNumber\":1},\"searchCriteria\":{\"category\":\"sword\"},\"sortCriteria\":{\"createdAt\":1,\"updatedAt\":-1}}";
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc itemCatalogService] getCatalogItemsPage:context
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil];
String context = "{\"pagination\":{\"rowsPerPage\":50,\"pageNumber\":1},\"searchCriteria\":{\"category\":\"sword\"},\"sortCriteria\":{\"createdAt\":1,\"updatedAt\":-1}}";
this; // implements IServerCallback
_bc.getItemCatalogService().getCatalogItemsPage(context, this);
public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
System.out.print(String.format("Failed | %d %d %s", statusCode, reasonCode, jsonError.toString()));
}
var context = {
"pagination": {
"rowsPerPage": 50,
"pageNumber": 1
},
"searchCriteria": {
"category": "sword"
},
"sortCriteria": {
"createdAt": 1,
"updatedAt": -1
}
};
_bc.itemCatalog.getCatalogItemsPage(context, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var context = {
"pagination": {
"rowsPerPage": 50,
"pageNumber": 1
},
"searchCriteria": {
"category": "sword"
},
"sortCriteria": {
"createdAt": 1,
"updatedAt": -1
}
};
ServerResponse result = await _bc.itemCatalogService.getCatalogItemsPage(context:context);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
var context = {
"pagination": {
"rowsPerPage": 50,
"pageNumber": 1
},
"searchCriteria": {
"category": "sword"
},
"sortCriteria": {
"createdAt": 1,
"updatedAt": -1
}
};
var itemCatalogProxy = bridge.getItemCatalogServiceProxy();
var postResult = itemCatalogProxy.getCatalogItemsPage(context);
if (postResult.status == 200) {
// Success!
}
{
"service": "itemCatalog",
"operation": "GET_CATALOG_ITEMS_PAGE",
"data": {
"context": {
"pagination": {
"rowsPerPage": 50,
"pageNumber": 1
},
"searchCriteria": {
"category": "sword"
},
"sortCriteria": {
"createdAt": 1,
"updatedAt": -1
}
}
}
}
JSON Response
{
"data": {
"context": "eyJzZWFyY2hDcml0ZXJpYSI6eyJnYW1lSWQiOiIyMzQwMyJ9LCJzb3J0Q3JpdGVyaWEiOnsiY3JlYXRlZEF0IjoxLCJ1cGRhdGVkQXQiOi0xfSwicGFnaW5hdGlvbiI6eyJyb3dzUGVyUGFnZSI6MSwicGFnZU51bWJlciI6MSwiZG9Db3VudCI6dHJ1ZX0sIm9wdGlvbnMiOm51bGx9",
"results": {
"count": 7,
"page": 1,
"items": [
{
"defId": "medal_bronze_1",
"name": "Small Bronze Medal",
"desc": "",
"type": "ITEM",
"category": "collectable",
"tags": [
"medal"
],
"buyPrice": {
"coins": 2000
},
"sellPrice": {
"coins": 200
},
"image": "https://api.braincloudservers.com/files/portal/g/23403/metadata/itemDefinitions/medal_bronze_1.png",
"resourceGroup": null,
"resourceTag": null,
"meta": {
"level": "bronze"
},
"initData": {
"exp": 0
},
"pState": "PUBLISHED",
"publishedAt": 1566584361752,
"createdAt": 1566584032523,
"updatedAt": 1566584437921,
"version": 4,
"stackable": true,
"consumable": false,
"uses": null,
"coolDownSecs": 0,
"recoverySecs": 0,
"activatable": false,
"statusName": null,
"activeSecs": null,
"tradable": false,
"blockchain": false,
"blockchainDefId": null
}
],
"moreAfter": true,
"moreBefore": false
}
},
"status": 200
}