Uploading profiles to a file
Description
Retrieves information about all database or segment profiles.
Contains 3 requests.
Step 1. Creating profiles export task
Request URL
Method: POST
https://example.com/api/v1.1/profiles/get_all
Request parameters
Parameter | Type | Example | Required | Description |
---|---|---|---|---|
token | string | "abcdefghijklmnqrstuvwxyz" | Yes | APItoken |
source_type | string | "database" "segment" | Yes | Data source type |
source_id | int | 1 | Yes | Data source ID |
file_format | string | "csv" | No | Export file format. By default - csv |
custom_request | JSON object | {"occupation":"doctor"} | No | Profile fields for search filtering |
Request example
- JSON
- XML
{
"token": "abcdefghijklmnqrstuvwxyz",
"source_type": "database",
"source_id": 1,
"file_format": "csv"
}
<xml>
<token>abcdefghijklmnqrstuvwxyz</token>
<source_type>database</source_type>
<source_id>1</source_id>
<file_format>csv</file_format>
</xml>
Response example
- JSON
- XML
{
"data": {
"task_id": "task_b2f9fd6a-2499-4a63-b592-f15d4e3b69c5"
},
"error": 0,
"error_text": "Successful operation"
}
<xml>
<data>
<task_id>task_b2f9fd6a-2499-4a63-b592-f15d4e3b69c5</task_id>
</data>
<error>0</error>
<error_text>Successful operation</error_text>
</xml>
Response parameters
Parameter | Type | Description |
---|---|---|
task_id | string | Export task ID |
error | int | Error code |
error_text | string | Error text |
Step 2. Task status check
Request URL
Method: POST
https://example.com/api/v1.1/tasks/status
Request parameters
Parameter | Type | Example | Required | Description |
---|---|---|---|---|
token | string | "abcdefghijklmnqrstuvwxyz" | Yes | API token |
task_id | string | "task_b2f9fk6a-2479-4a63-b592-f15d4e3b69c5" | Yes | Export task ID |
Request example
- JSON
- XML
{
"token": "abcdefghijklmnqrstuvwxyz",
"task_id": "ecd371a8-2229-48bb-bc3e-de7d39cd3051"
}
<xml>
<token>abcdefghijklmnqrstuvwxyz</token>
<task_id>ecd371a8-2229-48bb-bc3e-de7d39cd3051</task_id>
</xml>
Response example
- JSON
- XML
{
"data": {
"status": "completed",
"progress": 100,
"result": {
"errors": [],
"source_id": 1,
"total": 1343,
"type": "database",
"urls": [
"/api/download/data/4cf435e8-9921-4666-a39e-03ecbf57527e/1_database_export.csv"
]
}
},
"error": 0,
"error_text": "Successful operation"
}
<xml>
<data>
<progress>100</progress>
<result>
<errors/>
<source_id>1</source_id>
<total>1343</total>
<type>database</type>
<urls>/api/download/data/4cf435e8-9921-4666-a39e-03ecbf57527e/1_database_export.csv</urls>
</result>
<status>completed</status>
</data>
<error>0</error>
<error_text>Successful operation</error_text>
</xml>
Response parameters
Parameter | Type | Description |
---|---|---|
status | string | Task status |
progress | int | Task progress |
total | int | Number of profiles |
urls | array | Export file link |
error | int | Error code |
error_text | string | Error text |
Step 3. Downloading result file
The link to download the file looks like following:
https://example.com/api/download/6b248de2-33b9-4715-9720-5f7e23f4a296/1_database_export.csv?token=abcdefghijklmnqrstuvwxyz
, where:
https://example.com
- link to the platform panelapi/download/6b248de2-33b9-4715-9720-5f7e23f4a296/1_database_export.csv
- link from theurls
parameter of the past request?token=abcdefghijklmnqrstuvwxyz
- user's API token (after the equal sign).
To download a file with profiles you should either open this link in your browser or send an empty GET request specifying this link in the URL.