Skip to content

Instantly share code, notes, and snippets.

@arunvelsriram
Last active February 15, 2023 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arunvelsriram/837931b40d372f9856730e37c23ea4fa to your computer and use it in GitHub Desktop.
Save arunvelsriram/837931b40d372f9856730e37c23ea4fa to your computer and use it in GitHub Desktop.
Aerospike Rest Gateway

Aerospike Rest Gateway

Swagger

How to use filter expressions?

https://github.com/aerospike/aerospike-rest-gateway/blob/29e5674f6ab2f6228fa498c0468e2d7b2e2e59af/docs/expressions.md

How to use pagination in scan?

Get first 10 records:

curl -X 'GET' \
  'http://localhost:8080/v1/scan/college?maxRecords=10' \
  -H 'accept: application/json' | jq

In the response nextToken contains the digest to the last key.

To get next 10 records pass the nextToken value as query parameter from:

curl -X 'GET' \
  'http://localhost:8080/v1/scan/college?maxRecords=10&from=<nextToken>' \
  -H 'accept: application/json' | jq

https://github.com/aerospike/aerospike-rest-gateway/blob/7db931677add27a75640011e74e991a00e9e7c54/src/test/java/com/aerospike/restclient/ScanTest.java#L146

How to use pagination in query?

Catch: getToken=true should be sent in order to receive nextToken in the response. Otherwise the pagination details in the response will not have nextToken.

To get first 10 records

curl -X 'POST' \
  'http://localhost:8080/v1/query/college/students?includeBinData=true&maxRecords=10&sendKey=true&compress=true&getToken=true' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{}' | jq

To get next 10 records

curl -X 'POST' \
  'http://localhost:8080/v1/query/college/students?includeBinData=true&maxRecords=10&sendKey=true&compress=true&getToken=true' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{"from": "<nextTokenFromPrevousResponse>"}' | jq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment