Add template query
Description
Add template query to external datatables.
Request URL
Method: POST
https://example.com/api/v1.1/datatables/query_templates/add/
Request parameters
Parameter | Type | Example | Required | Description |
---|---|---|---|---|
token | string | "abcdefghijklmnqrstuvwxyz" | Yes | API token |
name | string | "Main query" | Yes | Query name |
shortname | string | "query1" | Yes | Query shortname |
description | string | "query to the DB" | No | Query description |
connector_id | int | 2 | Yes | External DB ID |
sql | string | "SELECT * FROM table" | No | SQL query |
groups_id | []int | [ 0, 1 ] | No | List of group IDs to search for default – [] |
Request example
- JSON
- XML
{
"token": "abcdefghijklmnqrstuvwxyz",
"name": "Main Query",
"shortname": "query1",
"sql": "SELECT * FROM table",
"connector_id": 1
}
<xml>
<token>abcdefghijklmnqrstuvwxyz</token>
<name>Main Query</name>
<shortname>query1uery</shortname>
<sql>SELECT * FROM table</sql>
<connector_id>1</connector_id>
</xml>
Response example
- JSON
- XML
{
"data": {
"saved_id": 1
},
"error": 0,
"error_text": "Successful operation",
}
<xml>
<data>
<saved_id>1</saved_id>
</data>
<error>0</error>
<error_text>Successful operation</error_text>t>
</xml>
Response parameters
Parameter | Type | Description |
---|---|---|
error | int | Error code |
error_text | string | Error text |
saved_id | int | Created query ID |