Skip to main content

REST API to return data in JSON format

  • August 11, 2017
  • 2 replies
  • 15 views

nkarkare

Is there any REST API in Vertica that will return data in JSON format?

2 replies

sKwa
Forum|alt.badge.img+1
  • Participating Frequently
  • August 11, 2017

Hi!

Management API

The Management API is a REST API that you can use to view and manage Vertica databases with scripts or applications that accept REST and JSON. The response format for all requests is JSON.

The Management API provides a subset of the database administration tools found in the Management Console. Features include the ability to:

  • View host and network details for each node
  • View details on database version, structure, and state
  • View and update licenses
  • Start and stop databases on the entire cluster or individual nodes
  • View details about available database backups, start a new database backup, and restore backups from specific archives
  • View and set database configuration parameters
  • Add hosts to the database, remove hosts from the database, and replace hosts with standby hosts
  • Create and delete databases
  • View a list of running jobs
  • Run rebalance or workload analyzer on a database
  • Create and manage event listeners (also known as webhooks)

For example:

daniel@synapse:~$ curl -H "VerticaApiKey: <key>" --insecure https://localhost:5444/hosts | json_pp 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   624  100   624    0     0   2478      0 --:--:-- --:--:-- --:--:--  2486
{
   "href" : "/hosts",
   "links" : [
      "/:hostid"
   ],
   "mime-type" : "application/vertica.hosts.json-v2",
   "body" : [
      {
         "max_user_proc" : "31764",
         "vertica" : {
            "arch" : "iamd64",
            "release" : "6",
            "version" : "8.0.1",
            "brand" : "vertica"
         },
         "total_memory" : 7966,
         "nics" : [
            {
               "name" : "eth0",
               "speed" : "1000",
               "broadcast" : "192.168.9.255",
               "ipaddr" : "192.168.9.134",
               "netmask" : "255.255.255.0"
            },
            {
               "ipaddr" : "127.0.0.1",
               "broadcast" : "255.255.255.255",
               "netmask" : "255.0.0.0",
               "speed" : "locallink",
               "name" : "lo"
            }
         ],
         "cpu_info" : {
            "cpu_type" : " Intel(R) Core(TM) i5-4670K CPU @ 3.40GHz",
            "number_of_cpus" : 2
         },
         "hostname" : "synapse",
         "host_id" : "127.0.0.1"
      }
   ]
}


chrismalone
  • New Participant
  • August 18, 2017

Thank you for this detailed response