RESTful Requests

Generic format for sending REST requests to BlobCity

Each request end point takes a JSON request data as a POST request. The JSON has a generic format across all query types and operations. At a high level the JSON formats are split into data format and management format. The data format is used for queries that operate on data such as data reading and data modification. The management format is suitable for managing the database, including schema management and system level management of users, nodes, backup amongst other items.

Generic Management Query JSON Request

{
  "username" : "root",
  "password" : "root",
  "q" : "{query-type}",
  "p" : {
    
  }
}

The username and password of the user that will access the system needs to be always provided. The q parameter specifies the query code for the query. The p is a payload inside which additional parameters specific to the quest are passed. If the payload p does not abide by the format specifications required for the specific query code q, the api will respond with error.

All management queries follow this request format. The q must be replaced with the specific management operation to be performed and the p must contain additional information specific to the q operation being requested. The p is at all times a JSON object.

Generic Data Query JSON Request

{
  "username" : "root",
  "password" : "root",
  "ds" : "{datastore}",
  "c" : "{collection}",
  "q" : "{query-type}",
  "p" : {
   
  }
}

The data queries are similar to the management queries, except that they take additional parameters of name of datastore and name of collection passed as ds and c respectively. The ds is a mandatory parameter for all data queries, the c at times maybe optional depending on the type of query q. If the query type is not a data query, the ds and c parameters will be ignored from request processing. The payload p must again be a JSON at all times.

A join query that spans multiple collections needs to be executed as a SQL query for which the collection name should not be specified as the query is not limited to a single collection. Thereby making the c parameter an optional parameter as long as the p in this case is able to instruct the database of precise operation desired. The datastore name ds however needs to be specified for all data queries.

It is important to remember here, that no query can span across collections in two separate data stores. All queries, no matter how many collections they span, will have to operate under a single specified datastore. Thereby it is not possible to run a data query without specifying the ds name.

Both Management Queries and Data Queries are fired on the same REST API endpoint


What’s Next