Create Custom Parameter
Important Note
This feature is available in the Business plan. If you haven't upgraded yet, please upgrade before using this feature.
WeSurvey supports adding custom parameters to survey links for tracking response sources, user information, and other custom content. The custom fields can be accessed through various methods including Excel export, data webhook, and response retrieval API.
Use Cases
Main use cases include:
- Using 'from' parameter to define different distribution channels for multi-channel distribution and channel-specific statistics;
- For existing APPs, passing APP userid in the link to distribute different links to different users and identify each respondent. For example, passing user information in games to distribute rewards after survey completion or record user profiles;
- For existing Member/Employee/Offline Store systems, including Member/Employee/Store information as parameters when configuring links to track response sources and relay submission data.
For detailed instructions, please refer to the Help Documentation
API Overview
- Function: Create custom parameter
- Request Method: POST
- Request URL: /api/surveys/{survey_id}/custom_args?appid={appid}&access_token={access_token}
Request Parameters
| Parameter Name | Type | Required | Location | Description | Example |
|---|---|---|---|---|---|
| survey_id | integer | Yes | uri | Survey ID | 292192 |
| title | string | Yes | body | Parameter name, used in survey URL wesurvey.com/s2/xx/xx?from=weixin | from |
| description | string | Yes | body | Description, used to distinguish purposes of multiple custom parameters | Source |
Request Body Example
{
"title":"from",
"description":"Source"
}
Response Parameters
| Parameter Name | Type | Description | Example |
|---|---|---|---|
| survey_id | integer | Survey ID | 734167 |
| question_id | string | Question ID, used for subsequent updates and creation | custom-arg-01 |
| type | string | Type | text |
| title | string | Parameter Name | from |
| description | string | Description | Source |
| created_at | string | Creation Time | 2024-08-13 19:28:54 |
| updated_at | string | Update Time | 2024-08-13 19:28:54 |
Response Examples
- Successful Request
{
"code": "OK",
"error": {
"type": ""
},
"data": {
"survey_id": 734167,
"question_id": "custom-arg-01",
"type": "text",
"title": "from",
"description": "Source",
"created_at": "2024-08-13 19:28:54",
"updated_at": "2024-08-13 19:28:54"
},
"request_id": "5ysDN6KqOvaO63kj20240813192854"
}
- Failed Request
{
"code": "InvalidArgument",
"error": {
"type": "survey_create_custom_args_validate"
},
"data": {},
"request_id": "sq0YOhA5jdeUwqZc20240813192953"
}
Error Codes
| error.type Code | Description |
|---|---|
| permission_denied | No Permission |
| survey_create_custom_args_validate | Parameter Validation Failed |
| not_allow_system | System Reserved Field |
| title_format_error | Only English letters, numbers, underscores, and hyphens are allowed. Q1, q1 format not allowed |
| title_exists | Parameter Name Already Exists |
| max_create_num | Historical Creation Limit Exceeded |
| num_exceed | Creation Limit Exceeded (Based on Purchased Version) |