Uploading profiles to a file
Description
Retrieves information about all database or segment profiles.
Contains 3 requests.
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
{
"token": "e97ce55afc5e4e07bd64afb2227f8a5c",
"source_type": "database",
"source_id": 1,
"file_format": "json"
}
Response example
{
"data": {
"task_id": "task_b2f9fd6a-2499-4a63-b592-f15d4e3b69c5"
},
"error": 0,
"error_text": "Successful operation"
}
Response parameters
Parameter | Type | Description |
---|---|---|
task_id | string | Export task ID |
error | int | Error code |
error_text | string | Error text |
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
{
"token": "abcdefghijklmnqrstuvwxyz",
"task_id": "task_b2f9fk6a-2479-4a63-b592-f15d4e3b69c5"
}
Response example
{
"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"
}
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 |
3 - downloading result file
Request URL
Method: GET
https://example.com/api/download/6b248de2-33b9-4715-9720-5f7e23f4a296/1_database_export.csv
The download link is retrieved from the second response.
Request parameters must contain API token.