POST

Create a survey.

URL : /v1.0/survey

Method : POST

Auth required : YES

Note see Survey Models

Data constraints

Field Type Requirements Description
Name* String Max length: 50 Name of the new survey
CompanyId* Integer   Id of your company
Start* String format: yyyy-MM-ddTHH:mm:ssZ Date and time when a new survey starts to be available
End* String format: yyyy-MM-ddTHH:mm:ssZ Date and time when a new survey starts to be unavailable
State* Integer   Valid value of Survey State enum
SurveySelectionRule String SurveySelectionRule interface JSON of SurveySelectionRule interface.
Questions** JSON Array of SurveyQuestion type objects Questions of the new survey.

* Required

** Each survey must contain Cover page and Thank you page

Example

POST /v1.0/survey HTTP/1.1
Host: <API_ENDPOINT>
Authorization: Bearer <API_TOKEN_HERE>
Content-Type: application/json
Cache-Control: no-cache
{
  "Name": "Test Survey",
	"CompanyId": 0,
	"Start": "2020-05-01T02:00:00.000Z",
	"End": "2020-06-01T02:00:00.000Z",
	"State": 2,
	"SurveySelectionRule": "{\"Frequency\":\"Quarterly\",\"EnabledLanguages\":\"[{\"id\":1045,\"label\":\"English\",\"code\":\"en\"}]\",\"Filters\":{\"Manager\":\"GUNNAR\"}}",
	"Questions": [
		{
			"Type": 1,
			"Texts": {
				"1045": "Welcome to the survey about upcoming Christmas party."
			}
		},
		{
			"Type": 3,
			"Texts": {
				"1045": "What is your favorite alcohol?"
			}
		},
		{
			"Type": 99,
			"Texts": {
				"1045": "Thank you for your time."
			}
		}
	]
}

Success Response

Code: 200 OK

Response: Integer

Response with Id of the new survey

1426

POST

Update a survey.

URL : /v1.0/survey/Update

Method : POST

Auth required : YES

Note see Survey Models

Data constraints

Field Type Requirements Description
Id* Integer   Id of the survey
SurveyDefinitionId* Integer   Each survey has fixed survey definition (not subject to change)
Name* String Max length: 50 Name of the new survey
CompanyId* Integer   Id of your company
Start* String format: yyyy-MM-ddTHH:mm:ssZ Date and time when a new survey starts to be available
End* String format: yyyy-MM-ddTHH:mm:ssZ Date and time when a new survey starts to be unavailable
State* Integer   Valid value of Survey State enum
SurveySelectionRule String SurveySelectionRule interface JSON of SurveySelectionRule interface.
Questions** JSON Array of SurveyQuestion type objects Questions of the new survey.

* Required

** Each survey must contain Cover page and Thank you page

Example

Please note that in the example payload below, three questions are being updated and one inserted.

POST /v1.0/survey/update HTTP/1.1
Host: <API_ENDPOINT>
Authorization: Bearer <API_TOKEN_HERE>
Content-Type: application/json
Cache-Control: no-cache
{
	"Name": "Test Survey",
	"CompanyId": 0,
	"Start": "2020-05-01T02:00:00.000Z",
	"End": "2020-06-01T02:00:00.000Z",
	"State": 2,
	"SurveySelectionRule": "{\"Frequency\":\"Quarterly\",\"EnabledLanguages\":\"[{\"id\":1045,\"label\":\"English\",\"code\":\"en\"}]\",\"Filters\":{\"Manager\":\"GUNNAR\"}}",
	"Questions": [
		{
			"Type": 1,
			"Key": "Q1",
			"Texts": {
				"1045": "Welcome to the survey about upcoming Christmas party."
			}
		},
		{
			"Type": 3,
			"Key": "Q2",
			"Texts": {
				"1045": "What is your favorite alcohol?"
			}
		},
		{
			"Type": 3,
			"Texts": {
				"1045": "What is your favorite Christmas dish?"
			}
		},
		{
			"Type": 99,
			"Key": "Q3",
			"Texts": {
				"1045": "Thank you for your time."
			}
		}
	],
	"Id": 0,
	"SurveyDefinitionId": 0
}

Success Response

Code: 200 OK

Response: Empty

Error Response

Code: 401 Unauthorized

{
  "Message": "Authorization has been denied for this request."
}