slashdb_api/db takes an existing database model and automatically constructs a web service API from it. This makes your data instantly accessible to mobile applications, websites or enterprise systems.

/db works in two modes:

  • Data Discovery – automatically reflects all objects in database as URL addressable resources
  • SQL Pass-thru – configure any SQL statement and map it to a URL

In both modes data becomes addressable via simple URL.

Data Discovery Mode

In this mode all records automatically become HTTP resources, which can be read and updated.

For example an individual Customer’s record in the Chinook database would be referenced like so:

Data becomes instantly available in several convenient data formats such as XML, JSON and comma-separated values text (CSV). The same record represented in JavaScript Object Notation (JSON) would be addressable as follows:

/db effectively constructs a graph representation of all relational databases behind it. The system reflects the data model’s relationships, so links between related records are natural to follow.

For example, customer’s invoices can be referenced as:,

or from the side of the Invoice table like this:

Drill-downs to vector slices and individual scalar values are also supported without sacrificing clarity of the URL link.

Customer’s name by itself, represented in XML can be reached using this URL:

Customers first name, last name and phone number:,LastName,Phone.html?limit=10

In-lining related records within a document of a parent record is another powerful mechanism that simply works out of the box. In a single request you can get a Customer record with all his/her Invoice records.

There are plenty more powerful features in Data Discovery, but sometimes you may want or need to run an SQL query or a stored procedure. This is covered in the next section.

SQL Pass-thru Mode

Using this mode, a SlashDB administrator or an application backend developer can define arbitrary SQL queries using the SlashDB configuration GUI. Once defined, those queries can be executed using a URL. For example this query returns customers from London:

As before the results are available in all supported formats simply by changing the extension of the URL:

Queries can be fully parameterized. In fact to get customers from another city, simply substitute that part of the URL:

See Also

We invite you to our live demo and to read a number of use cases, where /db offers unmatched benefits in software solution design.