Skip to main content

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

ParameterTypeExampleRequiredDescription
tokenstring"abcdefghijklmnqrstuvwxyz"YesAPItoken
source_typestring"database"
"segment"
YesData source type
source_idint1YesData source ID
file_formatstring"csv"NoExport file format.
By default - csv
custom_requestJSON object{"occupation":"doctor"}NoProfile fields for search
filtering

Request example

{
"token": "abcdefghijklmnqrstuvwxyz",
"source_type": "database",
"source_id": 1,
"file_format": "csv"
}

Response example

{
"data": {
"task_id": "task_b2f9fd6a-2499-4a63-b592-f15d4e3b69c5"
},
"error": 0,
"error_text": "Successful operation"
}

Response parameters

ParameterTypeDescription
task_idstringExport task ID
errorintError code
error_textstringError text

Step 2. Task status check

Request URL

Method: POST

https://example.com/api/v1.1/tasks/status

Request parameters

ParameterTypeExampleRequiredDescription
tokenstring"abcdefghijklmnqrstuvwxyz"YesAPI token
task_idstring"task_b2f9fk6a-2479-4a63-b592-f15d4e3b69c5"YesExport task ID

Request example

{
"token": "abcdefghijklmnqrstuvwxyz",
"task_id": "ecd371a8-2229-48bb-bc3e-de7d39cd3051"
}

Response example

{
"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"
}

Response parameters

ParameterTypeDescription
statusstringTask status
progressintTask progress
totalintNumber of profiles
urlsarrayExport file link
errorintError code
error_textstringError 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 panel
  • api/download/6b248de2-33b9-4715-9720-5f7e23f4a296/1_database_export.csv - link from the urls 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.