Illustration Image

Cassandra.Link

The best knowledge base on Apache Cassandra®

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

6/24/2020

Reading time:N/A min

hychrisli/REST-Cassandra

by John Doe

RESTful Web Service on Cassandra. CMPE 282 Assignment.GoalSupport http methods GET/POST/PUT/DELETE through Java based REST APIFunctionalityGET /.../rest/employee/GET /.../rest/projectGET /.../rest/employee/mGET /.../rest/project/nPOST /.../rest/employeePOST /.../rest/projectPUT /.../rest/employee/mPUT /.../rest/project/nDELETE /.../rest/employee/mDELETE /.../rest/project/nCassandra SetupCREATE KEYSPACE mydb WITH replication={'class': 'SimpleStrategy', 'replication_factor': '1'};CREATE TABLE Employee ( id int, firstname text, lastname text, PRIMARY KEY(id));INSERT INTO Employee (id, firstname, lastname) VALUES (1, 'John', 'Smith');INSERT INTO Employee (id, firstname, lastname) VALUES (2, 'Laura', 'Williams');CREATE TABLE Project (id int, name text, budget float, PRIMARY KEY(id));INSERT INTO Project (id, name, budget) VALUES (1, 'Apache Cassandra', 32300.00);INSERT INTO Project (id, name, budget) VALUES (2, 'Apache Spark', 42390.00);

Illustration Image

RESTful Web Service on Cassandra. CMPE 282 Assignment.

Goal

  • Support http methods GET/POST/PUT/DELETE through Java based REST API

Functionality

  • GET /.../rest/employee/
  • GET /.../rest/project
  • GET /.../rest/employee/m
  • GET /.../rest/project/n
  • POST /.../rest/employee
  • POST /.../rest/project
  • PUT /.../rest/employee/m
  • PUT /.../rest/project/n
  • DELETE /.../rest/employee/m
  • DELETE /.../rest/project/n

Cassandra Setup

CREATE KEYSPACE mydb WITH replication={'class': 'SimpleStrategy', 'replication_factor': '1'};

CREATE TABLE Employee ( id int, firstname text, lastname text, PRIMARY KEY(id)); INSERT INTO Employee (id, firstname, lastname) VALUES (1, 'John', 'Smith'); INSERT INTO Employee (id, firstname, lastname) VALUES (2, 'Laura', 'Williams');

CREATE TABLE Project (id int, name text, budget float, PRIMARY KEY(id)); INSERT INTO Project (id, name, budget) VALUES (1, 'Apache Cassandra', 32300.00); INSERT INTO Project (id, name, budget) VALUES (2, 'Apache Spark', 42390.00);

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

rest