Uploading profiles to a file
Description
Retrieves information about all database or segment profiles.
To get the result, you need to check the task status and download the resulting file.
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 |
|---|---|---|---|---|
| source_type | string | "database" "segment" | Yes | Data source type |
| source_id | int | 1 | Yes | Data source ID |
| file_format | string | "csv" | No | File format for export. Default is csv. |
| custom_request | JSON object | {"occupation":"doctor"} | No | Profile fields for refined search |
Request example
- JSON
- XML
{
"source_type": "database",
"source_id": 1,
"file_format": "csv"
}
<xml>
<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. Checking export status and retrieving link
Request URL
Method: POST
https://example.com/api/v1.1/tasks/status
Request parameters
| Parameter | Type | Example | Required | Description |
|---|---|---|---|---|
| task_id | string | "task_b2f9fk6a-2479-4a63-b592-f15d4e3b69c5" | Yes | Task ID |
Request example
- JSON
- XML
{
"task_id": "task_b2f9fk6a-2479-4a63-b592-f15d4e3b69c5"
}
<xml>
<task_id>task_b2f9fk6a-2479-4a63-b592-f15d4e3b69c5</task_id>
</xml>
Response example
- JSON
- XML
{
"data": {
"status": "success",
"progress": 100,
"result": {
"source_id": 1,
"total": 10,
"type": "database",
"urls": [
"/api/download/6b248de2-39b9-4715-9720-5f4e23f4a296/1_database_export.csv"
]
}
},
"error": 0,
"error_text": "Successful operation"
}
<xml>
<data>
<status>success</status>
<progress>100</progress>
<result>
<source_id>1</source_id>
<total>10</total>
<type>database</type>
<urls>/api/download/6b248de2-39b9-4715-9720-5f4e23f4a296/1_database_export.csv</urls>
</result>
</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 | Download link |
| error | int | Error code |
| error_text | string | Error text |
Step 3. Downloading the file
The link to download the file looks like following:
https://example.com/api/download/6b248de2-33b9-4715-9720-5f7e23f4a296/1_database_export.csv, where:
https://example.com— platform domainapi/download/6b248de2-33b9-4715-9720-5f7e23f4a296/1_database_export.csv— link from theurlsparameter of the previous request
To download the file with profiles, send a GET request to the specified link with the authorization header Authorization: Bearer <token>.