Skip to main content

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:

  1. Using 'from' parameter to define different distribution channels for multi-channel distribution and channel-specific statistics;
  2. 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;
  3. 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 NameTypeRequiredLocationDescriptionExample
survey_idintegerYesuriSurvey ID292192
titlestringYesbodyParameter name, used in survey URL wesurvey.com/s2/xx/xx?from=weixinfrom
descriptionstringYesbodyDescription, used to distinguish purposes of multiple custom parametersSource

Request Body Example

{
"title":"from",
"description":"Source"
}

Response Parameters

Parameter NameTypeDescriptionExample
survey_idintegerSurvey ID734167
question_idstringQuestion ID, used for subsequent updates and creationcustom-arg-01
typestringTypetext
titlestringParameter Namefrom
descriptionstringDescriptionSource
created_atstringCreation Time2024-08-13 19:28:54
updated_atstringUpdate Time2024-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 CodeDescription
permission_deniedNo Permission
survey_create_custom_args_validateParameter Validation Failed
not_allow_systemSystem Reserved Field
title_format_errorOnly English letters, numbers, underscores, and hyphens are allowed. Q1, q1 format not allowed
title_existsParameter Name Already Exists
max_create_numHistorical Creation Limit Exceeded
num_exceedCreation Limit Exceeded (Based on Purchased Version)