docs icon indicating copy to clipboard operation
docs copied to clipboard

Provide instructions for Windows and Linux users

Open csplinter opened this issue 4 years ago • 3 comments

See mailing list for feedback https://groups.google.com/a/lists.stargate.io/g/stargate-users/c/CzIOmkQyAso/m/bCYpYFE8BgAJ

csplinter avatar Oct 03 '20 19:10 csplinter

Windows: Here are the Windows Command Prompt equivalents, basically " instead of ' and " to escape the " inside a string.

Windows Command Prompt Get token curl -L -X POST "http://localhost:8081/v1/auth" -H "Content-Type: application/json" --data "{"username": "cassandra","password": "cassandra"}"

create keyspace curl --location --request POST "localhost:8082/v2/schemas/keyspaces" --header "X-Cassandra-Token: $AUTH_TOKEN" --header "Content-Type: application/json" --data "{"name": "users_keyspace","replicas": 1}"

create table in keyspace curl --location --request POST "localhost:8082/v2/schemas/keyspaces/users_keyspace/tables" --header "X-Cassandra-Token: $AUTH_TOKEN" --header "Content-Type: application/json" --data "{"name": "users","columnDefinitions":[{"name":"firstname","typeDefinition": "text"},{"name": "lastname","typeDefinition": "text"},{"name": "email","typeDefinition": "text"},{"name": "favorite color","typeDefinition": "text"}],"primaryKey":{"partitionKey":["firstname"],"clusteringKey":["lastname"]},"tableOptions":{"defaultTimeToLive": 0,"clusteringExpression":[{"column": "lastname", "order": "ASC" }]}}"

insert data into table curl --location --request POST "localhost:8082/v2/keyspaces/users_keyspace/users" --header "X-Cassandra-Token: $AUTH_TOKEN" --header "Content-Type: application/json" --data "{"firstname": "Mookie","lastname": "Betts","email": "[email protected]","favorite color": "blue"}'

read data from table curl -G --location "http://localhost:8082/v2/keyspaces/users_keyspace/users" --header "X-Cassandra-Token: $AUTH_TOKEN" --header "Content-Type: application/json" --data-urlencode "where={"firstname": {"$eq": "Mookie"}}"

update data in table curl --location --request PUT "localhost:8082/v2/keyspaces/users_keyspace/users/Mookie/Betts" --header "X-Cassandra-Token: $AUTH_TOKEN" --header "Content-Type: application/json" --data "{"email": "[email protected]"}"

delete data from table curl --location --request DELETE "localhost:8082/v2/keyspaces/users_keyspace/users/Mookie" --header "X-Cassandra-Token: $AUTH_TOKEN" --header "Content-Type: application/json"

polandll avatar Oct 08 '20 23:10 polandll

Using double quotes instead of single quotes in our curl commands should help with portability.

dougwettlaufer avatar Oct 10 '20 01:10 dougwettlaufer

For some URLs, especially those that include special characters such as ampersand, exclamation mark, or question mark, you should quote the URL you are specifying on the command line. For example:

shell> curl 'http://couchdb:5984/_uuids?count=5' Note

On Microsoft Windows, use double-quotes anywhere you see single-quotes in the following examples. Use doubled double-quotes (“”) anywhere you see single double-quotes. For example, if you see:

shell> curl -X PUT 'http:/127.0.0.1:5984/demo/doc' -d '{"motto": "I love gnomes"}' you should replace it with:

shell> curl -X PUT "http://127.0.0.1:5984/demo/doc" -d "{""motto"": ""I love gnomes""}" If you prefer, ^" and " may be used to escape the double-quote character in quoted strings instead.

polandll avatar Feb 03 '21 00:02 polandll