This API is used to execute LyftrondataSql and query from a database registered inside the Lyftrondata app. The API will return data in batches in JSON form. User need to include Auth token in request header. The token can be retrieved using Get OAuth Token call.
Request Headers
Key |
Value |
Content-Type |
application/x-www-form-urlencoded |
Request Type |
Post |
URL |
http://{YourLyftrondataAppUrl}/api/1.0/tsql/executelyftrondatasql |
*** {Token Value} will be replaced by Auth token that was received in token request.
*** {YourLyftrondataAppUrl} will be replaced with your Lyftrondata App url.
Example
Request Parameters
Request body will contain the following parameters as a JSON object.
Parameter |
Type |
Required |
Description |
LyftrondataSql | String | Yes | Sql statement e.g. Select * From [mysql].[dbo].[users] |
CurrentDatabase | String | No | Name of Database |
MaxResult | String | Yes | Number of records |
PageNumber | String | No | Represent batch number for record set having the records. Default value is 1 |
PageSize | String | No | Represent number of records to be fetched in one request. Default value is 10 |
Example
Response Parameters
Parameter |
Description |
tsql |
Tsql used at server side. Value will be null always |
currentDatabase |
Name of database having table |
messages |
For any additional info from server. Default value is null |
totalRows |
Total number of records in table |
totalPages |
Total number of records divided by provided page size in request |
items |
Array of items having table columns and rows |
columns |
Having object of column of table having all the information related to column |
rows |
Having row object with values of each column |
Example
{ "tSql": "Select * From [MS_mySql].[dbo].[calls]", "currentDatabase": "[MS_mySql]", "messages": [ { "hasQuery": true, "executionTimeMs": 1046.3888, "message": "Command(s) completed successfully.", "rowsAffected": -1 } ], "totalRows": 16, "totalPages": 2, "items": [ { "columns": [ { "name": "duration_seconds", "type": { "dbType": "int", "initializedWithDefaultSize": true, "length": 4, "isNullable": true, "precision": 10, "scale": 0, "isSensitive": false, "encryptingConnectionName": null, "isEncrypted": false, "sizeInBytes": 4, "providerSpecificData": null, "serializerTypeId": 35 }, "columnIndex": 0 }, { "name": "name", "type": { "dbType": "nvarchar", "initializedWithDefaultSize": false, "length": 0, "isNullable": true, "precision": 0, "scale": 0, "isSensitive": false, "encryptingConnectionName": null, "isEncrypted": false, "sizeInBytes": 500, "providerSpecificData": null, "serializerTypeId": 35 }, "columnIndex": 1 }, { "name": "reason", "type": { "dbType": "nvarchar", "initializedWithDefaultSize": false, "length": 0, "isNullable": true, "precision": 0, "scale": 0, "isSensitive": false, "encryptingConnectionName": null, "isEncrypted": false, "sizeInBytes": 500, "providerSpecificData": null, "serializerTypeId": 35 }, "columnIndex": 2 } ], "rows": [], "rowsAffected": -1, "maxResults": 100, "generateFormattedRows": true } ], "success": true, "errors": [] }