Illustration Image

Cassandra.Link

The best knowledge base on Apache Cassandra®

Helping platform leaders, architects, engineers, and operators build scalable real time data platforms.

1/9/2019

Reading time:2 min

brianmhess/ambien

by John Doe

It gives you rest...Buildingmvn clean packageRunningjava -jar target/ambien-0.1-SNAPSHOT-jar-with-dependencies.jar <options>Usage:version: 0.0.1Usage: ambien -host <hostname> -k <keyspaceName> -t <tableName> -o <outputDir> [options]OPTIONS: -host <hostname> Contact point for DSE [required] -k <keyspacename> Keyspace to use [required] -t <tablename> Table to use [required] -o <outputDir> Directory to write to (must be empty) [required] -configFile <filename> File with configuration options [none] -port <portNumber> CQL Port Number [9042] -user <username> Cassandra username [none] -pw <password> Password for user [none] -ssl-truststore-path <path> Path to SSL truststore [none] -ssl-truststore-pw <pwd> Password for SSL truststore [none] -ssl-keystore-path <path> Path to SSL keystore [none] -ssl-keystore-pw <pwd> Password for SSL keystore [none]This will produce a directory of source code in the supplied directory.After running Ambien, change directory to the output directory and run:mvn clean packageAnd then start the service with:java -jar target/ambien-0.0.1-SNAPSHOT.jarCurrent API callsThere is an index.html page which lists all the generated REST endpoints:http://hostname:8222/Print Hello World:http://hostname:8222/api/helloSelect all rows (GET):http://hostname:8222/api/allSelect some rows (GET and POST):http://hostname:8222/api/some/?some={some}Select by partition keys (GET and POST):http://hostname:8222/api/<partitionKey1>_<partitionKey2>_..._<partitionKeyN>/?partitionKey1={partitionKey1}&partitionKey2={partitionKey2}&...&partitionKeyN={partitionKeyN}Select by partition keys and clustering key(s) (GET and POST):http://hostname:8222/api/<pkey1>_<ccol1>?pkey={pkey1}&ccol1={ccol1}http://hostname:8222/api/<pkey1>_<ccol1>_<ccol2>?pkey1={pkey1}&ccol1={ccol1}&ccol2={ccol2}...Select by partition key and inequality on clustering key(s) (GET and POST):http://hostname:8222/api/<pkey1>_<ccol1>_lt?pkey1={pkey1}&ccol1={ccol1}http://hostname:8222/api/<pkey1>_<ccol1>_gt?pkey1={pkey1}&ccol1={ccol1}http://hostname:8222/api/<pkey1>_<ccol1>_lte?pkey1={pkey1}&ccol1={ccol1}http://hostname:8222/api/<pkey1>_<ccol1>_gte?pkey1={pkey1}&ccol1={ccol1}http://hostname:8222/api/<pkey1>_<ccol1>_<ccol2>_lt?pkey1={pkey1}&ccol1={ccol1}&ccol2={ccol2}http://hostname:8222/api/<pkey1>_<ccol1>_<ccol2>_gt?pkey1={pkey1}&ccol1={ccol1}&ccol2={ccol2}http://hostname:8222/api/<pkey1>_<ccol1>_<ccol2>_lte?pkey1={pkey1}&ccol1={ccol1}&ccol2={ccol2}http://hostname:8222/api/<pkey1>_<ccol1>_<ccol2>_gte?pkey1={pkey1}&ccol1={ccol1}&ccol2={ccol2}...Spring ActuatorYou can also access various metrics from the Actuator endpoints:http://hostname:8222/actuator

Illustration Image

It gives you rest...

Building

mvn clean package

Running

java -jar target/ambien-0.1-SNAPSHOT-jar-with-dependencies.jar <options>

Usage:

version: 0.0.1
Usage: ambien -host <hostname> -k <keyspaceName> -t <tableName> -o <outputDir> [options]
OPTIONS:
  -host <hostname>               Contact point for DSE [required]
  -k <keyspacename>              Keyspace to use [required]
  -t <tablename>                 Table to use [required]
  -o <outputDir>                 Directory to write to (must be empty) [required]
  -configFile <filename>         File with configuration options [none]
  -port <portNumber>             CQL Port Number [9042]
  -user <username>               Cassandra username [none]
  -pw <password>                 Password for user [none]
  -ssl-truststore-path <path>    Path to SSL truststore [none]
  -ssl-truststore-pw <pwd>       Password for SSL truststore [none]
  -ssl-keystore-path <path>      Path to SSL keystore [none]
  -ssl-keystore-pw <pwd>         Password for SSL keystore [none]

This will produce a directory of source code in the supplied directory. After running Ambien, change directory to the output directory and run:

mvn clean package

And then start the service with:

java -jar target/ambien-0.0.1-SNAPSHOT.jar

Current API calls

There is an index.html page which lists all the generated REST endpoints:

http://hostname:8222/

Print Hello World:

http://hostname:8222/api/hello

Select all rows (GET):

http://hostname:8222/api/all

Select some rows (GET and POST):

http://hostname:8222/api/some/?some={some}

Select by partition keys (GET and POST):

http://hostname:8222/api/<partitionKey1>_<partitionKey2>_..._<partitionKeyN>/?partitionKey1={partitionKey1}&partitionKey2={partitionKey2}&...&partitionKeyN={partitionKeyN}

Select by partition keys and clustering key(s) (GET and POST):

http://hostname:8222/api/<pkey1>_<ccol1>?pkey={pkey1}&ccol1={ccol1}
http://hostname:8222/api/<pkey1>_<ccol1>_<ccol2>?pkey1={pkey1}&ccol1={ccol1}&ccol2={ccol2}
...

Select by partition key and inequality on clustering key(s) (GET and POST):

http://hostname:8222/api/<pkey1>_<ccol1>_lt?pkey1={pkey1}&ccol1={ccol1}
http://hostname:8222/api/<pkey1>_<ccol1>_gt?pkey1={pkey1}&ccol1={ccol1}
http://hostname:8222/api/<pkey1>_<ccol1>_lte?pkey1={pkey1}&ccol1={ccol1}
http://hostname:8222/api/<pkey1>_<ccol1>_gte?pkey1={pkey1}&ccol1={ccol1}
http://hostname:8222/api/<pkey1>_<ccol1>_<ccol2>_lt?pkey1={pkey1}&ccol1={ccol1}&ccol2={ccol2}
http://hostname:8222/api/<pkey1>_<ccol1>_<ccol2>_gt?pkey1={pkey1}&ccol1={ccol1}&ccol2={ccol2}
http://hostname:8222/api/<pkey1>_<ccol1>_<ccol2>_lte?pkey1={pkey1}&ccol1={ccol1}&ccol2={ccol2}
http://hostname:8222/api/<pkey1>_<ccol1>_<ccol2>_gte?pkey1={pkey1}&ccol1={ccol1}&ccol2={ccol2}
...

Spring Actuator

You can also access various metrics from the Actuator endpoints:

http://hostname:8222/actuator

Related Articles

spring
angular
rest

GitHub - jhipster/jhipster-sample-app-cassandra: This is a sample application created with JHipster, with the Cassandra option

jhipster

3/7/2024

Checkout Planet Cassandra

Claim Your Free Planet Cassandra Contributor T-shirt!

Make your contribution and score a FREE Planet Cassandra Contributor T-Shirt! 
We value our incredible Cassandra community, and we want to express our gratitude by sending an exclusive Planet Cassandra Contributor T-Shirt you can wear with pride.

Join Our Newsletter!

Sign up below to receive email updates and see what's going on with our company

Explore Related Topics

AllKafkaSparkScyllaSStableKubernetesApiGithubGraphQl

Explore Further

cassandra