Get data
DataTable collection selecting using HTTP POST method.
Request data format
Request URL parameters:
Element/attribute | Type | Notes |
---|---|---|
ApiKey | string | Your API key, required for authentication. Required. |
TableName | string | Table name. Required. |
Columns | complex | Collection of column to select (Column elements). Optional. |
WhereConditions | complex | Collection of where conditions (Where elements). Optional. |
OrderByColumns | complex | Collection of order by rules (OrderBy elements). Optional. |
Limit | int | Number of rows in table. Optional. |
Columns element children:
Element/attribute | Type | Notes |
---|---|---|
Column | string | Column name. Required. |
Where element children:
Element/attribute | Type | Notes |
---|---|---|
ColumnName | string | Column name. Required. |
Operator | string | Operator name. Valid values are: Equals NotEqual Greater GreaterOrEqual Lower LowerOrEqua Like – only for text values Required. |
Value | string | Value to search. Required. |
OrderBy element children:
Element/attribute | Type | Notes |
---|---|---|
ColumnName | string | Column name. Required. |
Direction | string | Ordering direction. Valid values are: Ascending Descending Required. |
Response
The response from this method is always data in CSV format, rather than XML, because the amount of data returned can be substantial. CSV response minimizes overheads and allows for seamless integration with third party code/systems. Response content type is “text/csv”.
Returned data contains a header with column names in the first row only when Columns element have been specified in the request. If the Columns element have not been specified the CSV file will include data from all the columns in a data table without the header.
SV output is formatted using following settings:
- Field separator: comma (,)
- Quoting character: (“)
- Escape character: (“)
- Encoding: UTF-8
Examples
Request:
POST https://api.esv2.com/v2/Api/DataTablesGetData HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml
User-Agent: Jakarta Commons-HttpClient/3.1
Host: api.esv2.com
Content-Length: 563
<ApiRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<ApiKey>test_api_key1</ApiKey>
<TableName>Table1</TableName>
<Columns>
<Column>Column1</Column>
<Column>Column5</Column>
</Columns>
<WhereConditions>
<Where>
<ColumnName>Column1</ColumnName>
<Operator>Equals</Operator>
<Value>test</Value>
</Where>
</WhereConditions>
<OrderByColumns>
<OrderBy>
<ColumnName>Column1</ColumnName>
<Direction>Ascending</Direction>
</OrderBy>
</OrderByColumns>
<Limit>50</Limit>
</ApiRequest>
Response:
HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/csv; charset=utf-8
Content-Encoding: gzip
Vary: Accept-Encoding
Server: Microsoft-IIS/7.5
X-AspNetMvc-Version: 3.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Wed, 23 Jan 2013 12:18:23 GMT
Content-Length: 201
Column1,Column5
Example string,1/14/2012 12:00:00 AM