Create Question

/form_templates/{id}/questions

Create Question [POST]

Create a new question on a form template.  If an error occurs a 422 object is returned with a list of errors.

Authorization: Admin

Request

Body
{
	"title": "Are all electrical components firmly attached to panel?",
	"definition": "Check for loose wires, fittings...",
	"required": "true",
	"hasAnswerLogic": false,
	"formTemplateId": 480,
	"questionHeadingId": 4984,
	"atIndex": 10,
	"calculatedFromFormula": false,
	"selectionListId": "6347",
	"questionTypeId": "1"
}

Response 422

Body
{
	"errors": {
		"name": ["Cannot have duplicate Titles under the same heading."]
	}
}

Response 200

Body
{
	"item": {
		"id": 330414,
		"title": "Are all electrical components firmly attached to panel?",
		"definition": "Check for loose wires, fittings...",
		"required": true,
		"hasAnswerLogic": false,
		"type": {
			"name": "singleSelect",
			"displayName": "Single Select",
			"id": 1
		},
		"payload": {
			"default": null,
			"defaultSelectionId": 14824,
			"selectionListId": 6347,
			"selections": [{
				"id": 14822,
				"abbr": "P",
				"value": "Pass",
				"color": "079800",
				"score": 0,
				"priorityId": 0
			}, {
				"id": 14823,
				"abbr": "F",
				"value": "Fail",
				"color": "d60606",
				"score": 0,
				"priorityId": 3
			}, {
				"id": 14824,
				"abbr": "NA",
				"value": "Not Applicable",
				"color": "555555",
				"score": 0,
				"priorityId": -1
			}],
			"answerLogic": [],
			"statusLogic": []
		},
		"questionFilesCount": 0,
		"cannedCommentsCount": 0,
		"resourcesCount": 0,
		"questionHeading": {
			"id": 4984,
			"name": "Default"
		},
		"calculatedFromFormula": false,
		"ordinal": 409,
		"hasStatusLogic": false
	}
}

Still need help? Contact Us Contact Us