Skip to main content

Create Survey

API Overview

  • Function: Create a survey using plain text
  • Request Method: POST
  • Request URL: /api/surveys?appid={appid}&access_token={access_token}

Request Parameters

Parameter NameTypeRequiredLocationDescriptionExample
user_idintegerYesbodyUser ID60000000001, obtained from [Workspace - Avatar (top-right) - Personal Center]
orgintegerYesbodyTeam ID60000000002, obtained from [Workspace - Avatar (top-right) - Team Management - Click Team Name]
textstringYesbodySurvey content textReplace line breaks with "\n"
sceneintegerNobodySurvey scenarioSee Survey Scenarios

Request Body Example

{
"org":60000000002,
"user_id":60000000001,
"text":"Text Edit Survey Questions\n\nTo provide you with better service, we hope you can take a few minutes to share your feedback and suggestions with us. We highly value every user's opinion and look forward to your participation! Let's begin now!\n\nEnter question title[Single Choice]\nOption\nOption\n\nEnter question title[Multiple Choice]\nOption\nOption\n\nEnter question title[Dropdown]\nOption\nOption\n\n=== Page Break ===\n\nEnter question title[Single Line Text]\n\nEnter question title[Multiple Blanks]\nBlank1: ____\n\nEnter question title[Multiple Line Text]\n\nEnter question title[Rating Scale](5 means very satisfied, 1 means very dissatisfied, lower score indicates lower satisfaction)\n1~5\n\nEnter description[Paragraph Description]\n\nEnter question title[Location]\n\n"
}

Text Example

Note: When putting the text content below into the POST body, replace line breaks with \n. See more question type syntax below.

[Required] Survey Title

[Optional] Survey Introduction

This is the question title[Single Line Text]

This is the question title[Single Choice](This is the question description)
Option A
Option B

This is the question title[Rating Scale](This is the question description)
1~5

This is the question title[Multiple Blanks](This is the question description)
Content with blanks, Blank1: ____ Blank2: ____

===Page Break===

This is the question title[Cascade](This is the question description)
Level 1 Level 2
Level 1 Answer A
+Level 2 Answer A1
+Level 2 Answer A2
Level 1 Answer B
+Level 2 Answer B1
+Level 2 Answer B2

Response Parameters

Parameter NameTypeDescription
survey_idintegerSurvey ID
hashstringSurvey Hash

Response Examples

  • Successful Request
{
"code": "OK",
"error": {
"type": ""
},
"data": {
"survey_id": 716128,
"hash": "859f"
},
"request_id": "7972b868-8303-43ba-b095-54207040412c"
}
  • Failed Request
{
"code": "InvalidArgument",
"error": {
"type": "invalid_text_format",
},
"data": {},
"request_id": "ddec96d2-165e-4f3e-8a64-2057db116983"
}

Error Codes

error.type CodeDescription
permission_deniedNo Creation Permission
invalid_text_formatInvalid Text Format
invalid_argumentParameter Validation Failed
resource_exhaustedCreation Limit Exceeded

Question Type Syntax Guide

Single Choice

This is the question title[Single Choice](This is the question description)
Option A
Option B
Option C

Multiple Choice

This is the question title[Multiple Choice](This is the question description)
Option A
Option B
Option C
This is the question title[Dropdown](This is the question description)
Option A
Option B
Option C

Ranking

This is the question title[Ranking](This is the question description)
Option A
Option B
Option C

Single Line Text

This is the question title[Single Line Text](This is the question description)

Multiple Line Text

This is the question title[Multiple Line Text](This is the question description)

Date Time

This is the question title[Date Time](This is the question description)

Location

This is the question title[Location](This is the question description)

Text Description

This is the question title[Text Description](This is the question description)

Attachment

This is the question title[Attachment](This is the question description)

Signature

This is the question title[Signature](This is the question description)

Multiple Blanks

This is the question title[Multiple Blanks](This is the question description)
Content with blanks, Blank1: ____ Blank2: ____

Rating Scale

This is the question title[Rating Scale](This is the question description)
1~5

Cascade

This is the question title[Cascade](This is the question description)
Level 1 Level 2
Level 1 Answer A
+Level 2 Answer A1
+Level 2 Answer A2
Level 1 Answer B
+Level 2 Answer B1
+Level 2 Answer B2

Matrix Single Choice

Note: When putting the following syntax into the POST body, replace line breaks with \n, otherwise it will cause an error.

This is the question title[Matrix Single Choice](This is the question description)
Option A Option B Option C
Sub-question 1
Sub-question 2

Matrix Multiple Choice

This is the question title[Matrix Multiple Choice](This is the question description)
Option A Option B Option C
Sub-question 1
Sub-question 2

Matrix Rating Scale

This is the question title[Matrix Rating Scale](This is the question description)
1~5
Sub-question 1
Sub-question 2