Get Score¶
Description¶
This operation returns the score of a value from a sorted set.
Method¶
POST
Endpoint URL¶
Important
Make sure to replace xxxx in the domain name in the request specification below to the one assigned to your application.
https://xxxx.backendless.app/api/hive/[hive-name]/sorted-set/[key]/get-score
where:
Argument | Description |
---|---|
[hive-name] |
Name of a hive where the operation is performed. |
[key] |
Key name identifying a sorted set. |
Request Headers¶
Content-Type:application/json
where:
Argument | Description |
---|---|
Content-Type |
Must be set to application/json . This header is mandatory. |
Request Body¶
A JSON object with the structure shown below:
{
"value": [item]
}
where:
Argument | Description |
---|---|
[item] |
A value to get the score for. |
Response Body¶
The score of the specified item. Otherwise, returns null
if the specified key or the value in the sorted set does not exist.
Example¶
The example below returns the score of the "JoeTheGamer"
item from the players
sorted set.
curl --location --request GET "https://xxxx.backendless.app/api/hive/leaderboard/sorted-set/players/get-score" \
--header 'Content-Type: application/json \
--data-raw '[
"value": "JoeTheGamer"
]'
where:
Argument | Description |
---|---|
leaderboard |
Name of a hive in the system. |
players |
Name of a sorted set where the operation takes place. |
"JoeTheGamer" |
Value to get the score of. |
Codeless Reference¶
where:
Argument | Description |
---|---|
hive name |
Name of a hive where the operation is performed. |
key name |
Key name identifying a sorted set. |
value |
Value to get the score of. |
Returns the score of an item. Returns null
if the value does not exist in the sorted set.
Consider the following Sorted Set storage:
The example below retrieves the score of a value "Julia"
from the "players"
sorted set:
The output will look as shown below after the Codeless logic runs: