Requests
All requests to HTTP Report API should be performed according to the HTTPS (not HTTP) protocol using the GET method at https://content.mql5.com/v1/reports/.
Request paths #
Apart from the common address, the {WEBSITE_ID} website ID and the {DATA_TYPE} requested data type are specified in the request path:
| https://content.mql5.com/v1/reports/website/{WEBSITE_ID}/{DATA_TYPE} | 
{WEBSITE_ID} can be obtained in the website settings (ID field) of the Finteza panel. The following values are used for {DATA_TYPE}:
- table – tabular data
- daily – time data
- total – summary data
If the developer key is not specified, Finteza does not accept requests.
Required request parameters #
All requests to HTTP Report API should have the following parameters:
| Parameter | Type | Description | 
|---|---|---|
| metrics | string | List of metrics (comma-separated), for example, metrics=visits,events. | 
| date_from | unixtime | Data request initial date. Specified in seconds since 1970.01.01, for example, date_from=1549027860. | 
| date_to | unixtime | Data request end date. Specified in seconds since 1970.01.01, for example, date_from=1549027860. | 
Sample request featuring the required parameters:
| https://content.mql5.com/v1/reports/website/dxnnhxrwpcwsgwowveipxmslrznjfhzarp/table
 | 
Request authorization #
HTTP Report API is RESTful API. Finteza server does not store client connection status. This means a client should send authorization data each time the request is sent. The authorization data consists of the developer key {API_KEY} passed in the Authorization header:
| curl --header "Authorization: Basic {API_KEY}" https://content.mql5.com/v1/reports/website/dxnnhxrwpcwsgwowveipxmslrznjfhzarp/table?metrics=webvisits,events&date_from=1549027860&date_to=1549632660 | 
Use it each time you send data request.
Conditional parameters #
When requesting any type of data, you can specify additional conditions for their sorting and arrangement, for example, by device type, OS or language.
| Parameter | Type | Description | 
|---|---|---|
| where | array | Array of conditions in the form ?where[key]=value, where the key is a name of the field sorting is to be based on. The following operators can be used for the condition value: 
 | 
| group | string | List of fields for arranging data (comma-separated). | 
Sample data request combined with sorting:
| GET https:///content.mql5.com/v1/reports/website/dxnnhxrwpcwsgwowveipxmslrznjfhzarp/table
 | 
You can additionally arrange incoming data by any field using the ?group parameter.
Responses to requests #
Responses with requested data are passed in JSON format (ContentType: application/json) using UTF-8 encoding.
The initial request parameters (dates, conditions and groupings) are additionally duplicated in the main data container apart from requested data:
| {
 | 
Response code #
The following codes can be returned in response to a Finteza request:
| Response code | Description | 
|---|---|
| 200 OK | Request accepted and processed. | 
| 400 Bad Request | Request rejected, invalid parameters, error. | 
| 403 Forbidden | Request rejected, no access to data. | 
| 404 Not Found | Request rejected, unknown URL request. |