Find All Counters¶
This method returns all counter names and their current values.
Method¶
GET
Endpoint URL¶
The xxxx.backendless.app
is a subdomain assigned to your application. For more information see the Client-side Setup section of this documentation.
https://xxxx.backendless.app/api/counters?pattern=<name-pattern>&cursor=<cursor>&pageSize=<pageSize>
where:
Argument | Description |
---|---|
<name-pattern> |
Backendless supports two formats for pattern: glob and regular expressions. You can specify the pattern matching format to use with a prefix as shown below: pattern=glob:customer*_new-york or pattern=regex:customer[0-9]\_new-york . If the prefix format is not specified, Backendless treats the pattern as glob. |
<cursor> |
Atomic counters are allocated across different Random Access Memory locations. Every location has a specific number that the Backendless uses to read and write data. The cursor literally represents an identifier of the location to iterate. The cursor should be used in conjunction with the pageSize parameter described below. To iterate through all available counters, always pass 0 to this parameter; By doing so, you instruct the method to start the search from the very beginning. |
<pageSize> |
This parameter accepts an integer value which identifies the number of keys to return in the response. The pageSize doesn't guarantee to return all requested counter names due to the nature of the Random Access Memory. When you set the pageSize to 15 and iterate through a collection which contains 15 counters, this method may return 6 counters and also the last cursor location as an integer value. For instance, the returned cursor location may be 182 , and the next 9 keys can be located anywhere from 182 to 380 . To get the other keys in the next method call you must set the cursor parameter to the previously returned value which is 182 , but this time after the invocation you may get only 4 counter names and the cursor position 350 . To get the rest of the keys in the next invocation, you must set the cursor to 350 and iterate through the store, until you get the other 5 counter names and cursor position 0 . In some cases you can get more counters than specified in the pageSize parameter. The cursor position 0 returned in the response indicates that you have reached the end of the store and there are no counters left to get. Optional parameter. |
Request Headers¶
None.
Request Body¶
None.
Response Body¶
Returns an object containing the following data:
{
"result":[
{"users_counter_key1":34},
{"users_counter_key2":4},
...
]
"cursor":324
}
where:
Argument | Description |
---|---|
"result" |
An array containing objects; Every object contains a key-value pair, where the key is a string value representing the name of the counter, and the value is the current numerical state of the counter expressed as an integer value. |
"counter" |
The current iteration location returned in the response body. |
Example¶
The example below will search for customers having the following glob pattern customer*_new-york
and return 10
or less atomic counter names(if exist) and their current values.
curl --location --request GET "https://xxxx.backendless.app/api/counters?pattern=glob:customer*_new-york&cursor=0&pageSize=10"