Grid Metadata API

Store and retrieve metadata for specific grids for easy downstream application use.

Grid Metadata API

Grid Metadata API allows storage and retrivel of information related to specific grids. This information then can be used for Logistical planning, Risk management, Insurance premium calculations etc., without the need to maintain a separate system on the client side.

Typical workflow

sequenceDiagram API Client->>+Grids.One: PUT metadata "ALL" "{rate-multiplier:0.8}" Note right of Grids.One: Save in DB Grids.One-->>-API Client: Saved API Client->>+Grids.One: PUT metadata "gridid-42" "{rate-multiplier:0.2}" Note right of Grids.One: Save in DB Grids.One-->>-API Client: Saved API Client->>+Grids.One: GET metadata "<gridid-123>" Note right of Grids.One: Lookup 123, Not found, Lookup ALL, Return Grids.One-->>-API Client: "{rate-multiplier:0.8}" API Client->>+Grids.One: GET metadata "<gridid-42>" Note right of Grids.One: Lookup 42, Found, Return Grids.One-->>-API Client: "{rate-multiplier:0.2}"

Store Metadata

To store metadata about a grid/set of grids the following API call can be used. The metadata column accepts a json like string and can have length upto 512 bytes. This allows the storage and retrivel of multiple key=value pairs. The grid_ids column takes a special value "ALL" which will take the metadata and will return for all the grids, unless the grid has a overriding value specifically assigned. This method allows default values for the grid while giving the flexibility to override at individual grid level.

PUT/POST /grid/metadata ? 
                         config_id=<config_id> &
                         grid_ids=<id1,id2,id3> &
                         meta=<info>

Delete Metadata

To clear the metadata for a given grid or set of grids the following API call can be used. As with the API call above a special value "ALL" is allowed which will delete all the grid metadata associated with the given configuration.

DELETE /grid/metadata ? 
                         config_id=<config_id> &
                         grid_ids=<id1,id2,id3> 

Retrieve Metadata

To retrieve the metadata for a given grid or set of grids the following API call can be used. As with the API call above a special value "ALL" is allowed which will return the default values for the given configuration.

GET /grid/metadata ? 
                         config_id=<config_id> &
                         grid_ids=<id1,id2,id3> 

Ratelimiting

Some of our API calls may be public(requires free API key) , while others requires paid subscription. To maintain our serice levels both public and private API endpoints are ratelimited. Please consult your specific plan that you subscribed to for the rate limit details.

Authentication

Currently we support API Key based authentication. Please set your Autorization Bearer request header with value of your API key. Alternatively you can also pass api_key= as a request parameter, though we strongly discourage this mode of passing the key, since it will allow others to see your key.

In curl this would mean sending the Authorization header like below.

            
 curl -i <url> -H "Authorization: Bearer <api_key>"
            
            

If you are using PHP.

            
$authorization = "Authorization: Bearer <api_key>";
$ch = curl_init('<url>'); // Initialise cURL
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json' , $authorization ));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); // OR GET
$result = curl_exec($ch);
curl_close($ch);
            
            

In javascript you can use headers key to add the authorization header

            
$.ajax({
   url: '<url>'
   type: 'GET',
   contentType: 'application/json'
   headers: {
      'Authorization': 'Bearer <api_key>'
   },
   success: function (result) {
       // CallBack(result);
   },
   error: function (error) {

   }
});