Export form fill data by user
Description
Creates a task to export form fill data submitted by a specific user. The user is identified via matching against a database.
The method returns a task_id. To get the result, you need to check the task status and download the resulting file.
Request URL
Method: POST
https://example.com/api/v1.1/forms/fill
Request Parameters
| Parameter | Type | Example | Required | Description |
|---|---|---|---|---|
| id | int | 1 | Yes, if shortname is not specified | Form ID |
| shortname | string | "form_6Ven2v7O" | Yes, if id is not specified | Form short name |
| db_id | int | 3 | Yes | Database ID for matching |
| file_format | string | "csv" | No | File format: csv or json |
| matching | string | "email" | No | Matching mode. If not specified, determined automatically from the provided field |
| profile_id | string | "507f1f77bcf86cd799439011" | No | Profile ID |
| string | "user@example.com" | No | User email | |
| phone | string | "+79001234567" | No | User phone |
| field_name | string | "custom_field" | No | Custom field name for matching |
| field_value | string | "value" | No | Custom field value |
At least one matching field (profile_id, email, phone, field_name + field_value) must be specified.
Matching Modes
| Value | Description |
|---|---|
email | Match by email |
phone | Match by phone |
profile_id | Match by profile ID |
custom | Match by custom field (field_name + field_value) |
Request Example
- JSON
- XML
{
"id": 1,
"db_id": 3,
"email": "user@example.com",
"matching": "email",
"file_format": "csv"
}
<xml>
<id>1</id>
<db_id>3</db_id>
<email>user@example.com</email>
<matching>email</matching>
<file_format>csv</file_format>
</xml>
Response Example
- JSON
- XML
{
"data": {
"task_id": "550e8400-e29b-41d4-a716-446655440000"
},
"error": 0,
"error_text": "Successful operation"
}
<xml>
<data>
<task_id>550e8400-e29b-41d4-a716-446655440000</task_id>
</data>
<error>0</error>
<error_text>Successful operation</error_text>
</xml>
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| error | int | Error code |
| error_text | string | Error text |
| data | object | Response data object |
data Object
| Parameter | Type | Description |
|---|---|---|
| task_id | string | Async task ID for retrieving fill data |
Step 2. Checking task status and getting download link
Request URL
Method: POST
https://example.com/api/v1.1/tasks/status
Request Parameters
| Parameter | Type | Example | Required | Description |
|---|---|---|---|---|
| task_id | string | "550e8400-e29b-41d4-a716-446655440000" | Yes | Task ID from step 1 |
Request Example
- JSON
- XML
{
"task_id": "550e8400-e29b-41d4-a716-446655440000"
}
<xml>
<task_id>550e8400-e29b-41d4-a716-446655440000</task_id>
</xml>
Response Example
- JSON
- XML
{
"data": {
"status": "completed",
"progress": 100,
"result": {
"form_id": 1,
"total": 1,
"url": "abCDefghIklMnop57498257/1_20002_form_export.zip"
}
},
"error": 0,
"error_text": "Successful operation"
}
<xml>
<data>
<status>completed</status>
<progress>100</progress>
<result>
<form_id>1</form_id>
<total>1</total>
<url>abCDefghIklMnop57498257/1_20002_form_export.zip</url>
</result>
</data>
<error>0</error>
<error_text>Successful operation</error_text>
</xml>
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| status | string | Task status (completed — task is done) |
| progress | int | Task progress in percent |
| result | object | Export result object. See result |
| error | int | Error code |
| error_text | string | Error text |
result Object
| Parameter | Type | Description |
|---|---|---|
| form_id | int | Form ID |
| total | int | Total number of fill records |
| url | string | Encrypted path to the data file |
Step 3. Downloading the file
To download the file, send a GET request to a URL composed of the platform's base URL, the entity prefix, and the url value from the step 2 response:
https://example.com/api/download/forms/ + value of url
For example:
https://example.com/api/download/forms/abCDefghIklMnop57498257/1_20002_form_export.zip
where:
https://example.com- platform domainapi/download/forms/- fixed prefix for form data exportabCDefghIklMnop57498257/1_20002_form_export.zip- value of theurlparameter from the step 2 response (encrypted path and file name)
The request must include the authorization header Authorization: Bearer <token>.