Pretty-printed write and query update

pull/1733/head
Philip O'Toole 2015-02-24 20:04:19 -08:00
parent d67df1060b
commit 5df5a401f6
1 changed files with 21 additions and 4 deletions

View File

@ -33,20 +33,37 @@ For those adventurous enough, you can
### Creating your first database
```JSON
curl -G 'http://localhost:8086/query' --data-urlencode "q=CREATE DATABASE mydb"
curl -G 'http://localhost:8086/query' \
--data-urlencode "q=CREATE DATABASE mydb"
```
### Setting up the database's retention policy
```JSON
curl -G 'http://localhost:8086/query' --data-urlencode "q=CREATE RETENTION POLICY mypolicy ON mydb DURATION 7d REPLICATION 1 DEFAULT"
curl -G 'http://localhost:8086/query' \
--data-urlencode "q=CREATE RETENTION POLICY mypolicy \
ON mydb DURATION 7d REPLICATION 1 DEFAULT"
```
### Insert some data
```JSON
curl -d '{"database" : "mydb", "retentionPolicy" : "mypolicy", "points": [{"name": "cpu", "tags": {"region":"uswest","host": "server01"},"fields": {"value": 100}}]}' -H "Content-Type: application/json" http://localhost:8086/write
curl -H "Content-Type: application/json" http://localhost:8086/write -d '
{
"database": "mydb",
"retentionPolicy": "mypolicy",
"points": [
{
"name": "cpu",
"tags": {
"region":"uswest",
"host": "server01"},
"fields": {"value": 100}
}
]
}'
```
### Query for the data
```JSON
curl -G http://localhost:8086/query?pretty=true --data-urlencode "db=mydb" --data-urlencode "q=SELECT * FROM cpu"
curl -G http://localhost:8086/query?pretty=true \
--data-urlencode "db=mydb" --data-urlencode "q=SELECT * FROM cpu"
```
## Helpful Links