Creating API using SQL

Overview

You can create an API requiring joins of multiple tables, grouping, ordering, etc by specifying its SQL template. A SQL template may also be referred in the pagination API. The following is an example of one such API.

  "dsSqlTemplates" : [
    {
      "name" : "contacts",
      "sql" : "SELECT c.id, c.myid as myId, c.contactid as contactId, c.createdat as createdAt, c.updatedat as updatedAt, u.userid as contactUserId, u.firstname as contactFirstName, u.lastname as contactLastName, u.pictureurl as contactPictureUrl FROM Contact_tbl c, user_tbl u WHERE (u.id=c.contactid) AND (c.myid={{_user_id_}})"
    }
  ],

Use the following API to invoke such templates.

POST /ds/sqltemplate/app1/ds1

Execute SQL using its Template

Parameters
Name Located in Description Required Schema
request body request Yes SQLTemplateRequest
Responses
Code Description Schema
200 OK object
201 Created
401 Unauthorized
403 Forbidden
404 Not Found