The GridDB WebAPI makes it simple to access GridDB data across the internet or from a programming language/envrionment where a GridDB connection does not exist or isn’t feasible to use. In this blog post, we’re going to showcase installation, some brief API examples with CURL, Postman, and R as well as how to setup the WebAPI behind a reverse proxy to enable SSL or other HTTP security features not directly supported by the WebAPI server.


We’ll assume that you have already installed and setup GridDB. To download and untar the binary tarball from GitHub:

$ sudo su - gsadm
$ cd /var/lib/gridstore
$ curl -o
$ tar zxvf griddb_webapi-2.2.0-bin.tar.gz

Now edit webapi/conf/repository.json, changing the name parameter to your cluster name, usually “defaultCluster”, and making any other changes as required.

Now you can start the WebAPI:

$ nohup java -jar lib/griddb-webapi-ce-2.2.0.jar &

By using nohup, the WebAPI processs won’t die when your terminal exits for any reason.

Inserting Data

First, we create the container schema:

$ curl -X POST --basic -u admin:admin -H "Content-type:application/json" -d \
    "columns": [
            "name": "timestamp",
            "type": "TIMESTAMP"
            "name": "name",
            "type": "STRING"
            "name": "value",
            "type": "FLOAT"
    "container_name": "test",
    "container_type": "TIME_SERIES",
    "rowkey": true

Now we can PUT our data rows:

$ curl -X PUT --basic -u admin:admin -H "Content-type:application/json" -d \
    ["2021-01-16T10:25:00.253Z", "foo", 100.5 ],
    ["2021-01-16T10:35:00.691Z", "foo", 173.9 ],
    ["2021-01-16T10:45:00.032Z", "bar", 123.9 ]

Fetching Data

We can now directly fetch or query data; direct fetches are the fastest method to retrieve data:

$ curl -X POST --basic -u admin:admin -H "Content-type:application/json" -d  '{"limit":1000}'  
{"columns":[{"name":"timestamp","type":"TIMESTAMP"},{"name":"name","type":"STRING"},{"name":"value","type":"FLOAT"}],"rows":[["2021-01-16T10:25:00.253Z","foo",100.5],["2021-01-16T10:35:00.691Z","foo",173.9],["2021-01-16T10:45:00.032Z","bar",123.9]],"offset":0,"limit":1000,"total":3}[owen@hpelnxdev webapi_blog]$ 

Using TQL allows you to use all of GridDB’s time series or aggregation functions:

$ curl -X POST --basic -u admin:admin -H "Content-type:application/json" -d \
 '[{"name":"test", "stmt":"select max(value)", "columns":[]}]' 


The WebAPI also supports querying with more familiar SQL statements:

$ curl -X POST --basic -u admin:admin -H "Content-type:application/json" -d \
'[{"type":"sql-select","stmt":"select * from test"}]' 

Deleting Data

You can delete both entire containers or individual rows. To delete individual or multiple rows:

$ curl -X DELETE --basic -u admin:admin -H "Content-type:application/json" -d \
$ curl -X DELETE --basic -u admin:admin -H "Content-type:application/json" -d \


R is a popular programming language for data analysis and the WebAPI makes it easy use data stored in GridDB into your R program. Using the HTTR library, we can use the same endpoints we used with curl and then we can convert the returned JSON into a R data frame for calculation:


r <- POST(
    url = "",
    config = authenticate("admin", "admin"),
    encode = "json",
    body = '{"limit" : 1000 }',
    add_headers("Content-Type" = "application/json")

df <-, content(r)$rows))
colnames(df) <- c("timestamp", "name", "value")
df$value <- as.numeric(as.character(df$value))


The above R script outputs:

timestamp name value
1 2021-01-16T10:25:00.253Z  foo 100.5
2 2021-01-16T10:35:00.691Z  foo 173.9
3 2021-01-16T10:45:00.032Z  bar 123.9
[1] 132.7667


The GridDB WebAPI makes it simple to access data stored in GridDB from remote networks without complicated VPNs or from environments where it is not possible to use one of the many programming language specific GridDB clients. All scripts used in this post can be downloaded from the GitHub Repo.

If you have any questions about the blog, please create a Stack Overflow post here .
Make sure that you use the “griddb” tag so our engineers can quickly reply to your questions.