Add segmentation query
Description
Add segmentation query to external datatables.
Request URL
Method: POST
https://example.com/api/v1.1/datatables/query_segments/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 |
column | string | "author" | Yes | Column used to search for profiles |
sql | string | "SELECT * FROM table" | No | SQL query |
cache_time_min | int | 35 | No | Result caching time |
groups_id | []int | [ 0, 1 ] | No | List of group IDs to search for<br/>default – []<br/> |
parameters | object |
| No | Parameters of user variables used in SQL queries |
Request example
- JSON
- XML
{
"token": "abcdefghijklmnqrstuvwxyz",
"name": "Main Query",
"shortname": "query1",
"sql": "SELECT * FROM table",
"connector_id": 1,
"column": "price"
}
<xml>
<token>abcdefghijklmnqrstuvwxyz</token>
<name>Main Query</name>
<shortname>query1uery</shortname>
<sql>SELECT * FROM table</sql>
<connector_id>1</connector_id>
<column>price</column>
</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 |