Table Of Contents

7.15. Rest

7.15.1. Introduction

If you have not setup the rest api yet, follow this article.

The rest api is a convenient way to communicate with the quasardb daemon in a json format manner.

7.15.2. Routes

  • api/login

    Login to a secured cluster.

    The token sent back has a validity of 12hours.

    • Type: POST

    • Content-Type: application/json

    • URL structure: https://127.0.0.1:40443/api/login

    • Body, content of your private user security key file:

      {"username":"tintin","secret_key":"SIMC1BQCOgjU7rkMoMP3gVQACA6JcxRwLhok/5bgS0J8="}
      
    • Returns:

      {"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NDk0ODM1MDcsImp0aSI6ImJoZDlhY3NxNG1hcGloNWpiZHEwIn0.e0Jq1xYNCpE7qnXQwKhKC_Mot4NoyNPg-RSyYK4Exrg"}
      
  • api/cluster

    Get basic information about the cluster disk and memory usage, the nodes and their status

    • Type: GET

    • Content-Type: application/json

    • URL structure: http://127.0.0.1:40080/api/cluster

    • Returns:

      {"diskTotal":500695072768,"diskUsed":146396606464,"memoryTotal":16633151488,"memoryUsed":10571653120,"nodes":["127.0.0.1:2836"],"status":"stable"}
      
  • api/nodes/$id

    Get basic information about the node disk and memory usage. The $id being the uri of the node.

    • Type: GET

    • Content-Type: application/json

    • URL structure: http://127.0.0.1:40080/api/nodes/127.0.0.1:2836

    • Returns:

      {"cpuTotal":174985330000,"cpuUsed":59013680000,"diskTotal":500695072768,"diskUsed":146396614656,"id":"127.0.0.1:2836","memoryTotal":16633151488,"memoryUsed":10715885568,"os":"Linux 4.15.0-44-generic","quasardbVersion":"3.2.0"}
      
  • api/query

    Run a query on the cluster.

    • Type: POST

    • Content-Type: application/json

    • URL structure: http://127.0.0.1:40080/api/query

    • Body, the query you wish to run:

      {"query": "SELECT * FROM example"}
      
    • Returns:

      {"tables":[{"columns":[{"data":["2017-01-01T01:00:00+01:00","2019-02-05T14:24:16+01:00","2019-02-06T09:12:57+01:00"],"name":"timestamp"},{"data":[1234,1234,1234],"name":"my_int"}],"name":"example"}]}
      
arrow_backPrevious
7.14. R
Next arrow_forward
7.16. Spark connector