Skip to content

Latest commit

 

History

History
113 lines (85 loc) · 2.88 KB

step3-cassandra.md

File metadata and controls

113 lines (85 loc) · 2.88 KB
Exploring Stargate with HTTPie ℹ️ For technical support, please contact us via email or LinkedIn.
⬅️ Back Step 3 of 3 Finish
Exploring Stargate APIs from the command line - REST

In this section you will use our httpie configuration to take a look at the Stargate REST API.

  • REST - Create Rows
  • REST - Read Rows
  • REST - Update Rows
  • REST - Delete Rows

Did your token expire? Reset it with this command.

/workspace/httpie-katapod/token.sh

1. Add some rows

Great! The table is created. But it's kind of dull with no data. Go ahead and add a couple different rows with that data.

echo -n '
{
    "firstname": "Mookie",
    "lastname": "Betts",
    "favorite color": "blue"
}' | http POST localhost:8082/v2/keyspaces/library/users
echo -n '
{
    "firstname": "Janesha",
    "lastname": "Doesha",
    "favorite color": "grey"
}' | http POST localhost:8082/v2/keyspaces/library/users

Check to make sure they're really in there:

http localhost:8082/v2/keyspaces/library/users where=='{"firstname":{"$in":["Mookie","Janesha"]}}' -vvv

2. Update the rows

http PUT localhost:8082/v2/keyspaces/library/users/Janesha/Doesha "favorite color"=Fuchsia

Check our work:

http localhost:8082/v2/keyspaces/library/users where=='{"firstname":{"$in":["Mookie","Janesha"]}}' -vvv

3. Delete the rows

Janesha has moved away. Let's remove them from the database.

http DELETE localhost:8082/v2/keyspaces/library/users/Janesha/Doesha

So wait, are they gone?

http localhost:8082/v2/keyspaces/library/users/Janesha/Doesha

4. Delete the table

We don't need our table anymore, let's delete it.

http DELETE localhost:8082/v2/schemas/keyspaces/library/tables/users

Double checking - what tables are in my keyspace?

http localhost:8082/v2/schemas/keyspaces/library/tables
⬅️ Back Finish