Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.



Table of contents

Table of Contents



Warning

This edge is only active for the instances that have the survey module active.

If it's not active, all endpoints will return a success = 0 message.




Getting the default feedback survey

Returns the default feedback survey link.

Info
iconfalse

Status
colourYellow
titleGET
 /survey/default_scale


Request

Expand


Request

Endpoint: /survey/default_scale

Method:

Status
colourYellow
titleGET

Only logged in:

Status
colourGreen
titleYES

Account privilege restriction: Any privilege

Headers:

Expand


Header nameValue
X-Requested-With
XMLHttpRequest
X-Auth-TokenToken obtained from Login endpoint




Response

Expand


Response

Http Code

Response

Description

Status
colourBlue
title200


Expand
titleSuccess response


Code Block
titleSuccess response
linenumberstrue
{
    "success": 1,
    "message": "link_to_survey"
}



Success response

Expand
titleBase Object

Base object:

Object propertyDescription
successRepresents if the call was successful
messageRepresents the link to survey to be used for answering the survey




Status
colourRed
title403


Code Block
Forbidden


User cannot access the resource





Assigning / getting the scale for the user

Returns the survey data for the currently assigned scale or assigns a new one if a link is given.

Info
iconfalse

Status
colourYellow
titleGET
 /survey/get


Request

Expand


Request

Endpoint: /survey/get

Method:

Status
colourYellow
titleGET

Only logged in:

Status
colourGreen
titleYES

Account privilege restriction: Any privilege

Headers:

Expand


Header nameValue
X-Requested-With
XMLHttpRequest
X-Auth-TokenToken obtained from Login endpoint



Parameters:

Expand


ParameterRequiredTypeDescription
survey_link
Status
subtletrue
colourRed
titleNO
StringSurvey link for the survey to be assigned to current user




Response

Expand


Response

Http Code

Response

Description

Status
colourBlue
title200


Expand
titleSuccess response


Code Block
titleSuccess response
linenumberstrue
{
    "success": 1,
    "instance_id": 28,
    "scale": {
        "id": 15,
        "title": "Feedback form",
        "description": "<p>Please fill out this feedback form!</p>",
        "type": 2
    },
    "items": [
        {
            "id": 20,
            "title": "What do you think about our gym?",
            "position": 1,
            "answers": {
                "2": {
                    "id": 2,
                    "title": "Goodn't :(",
                    "position": 1,
                    "value": 0
                },
                "13": {
                    "id": 13,
                    "title": "Good",
                    "position": 2,
                    "value": 0
                }
            },
            "actual_answer": "",
            "actual_value": ""
        },
        {
            "id": 21,
            "title": "What do you think about our offers?",
            "position": 2,
            "answers": {
                "2": {
                    "id": 2,
                    "title": "Goodn't :(",
                    "position": 1,
                    "value": 0
                },
                "13": {
                    "id": 13,
                    "title": "Good",
                    "position": 2,
                    "value": 0
                }
            },
            "actual_answer": "",
            "actual_value": ""
        }
    ]
}



Success response

Expand
titleBase Object

Base object:

Object propertyDescription
successRepresents if the call was successful
instance_idInternal survey instance ID
scaleThe survey object containing its data
itemsArray containing the survey items to which the user should respond to



Expand
titlescale object

scale object:

Object propertyDescription
idInternal ID of the survey
titleSurvey title
descriptionSurvey HTML description
type

Internal type of the survey:

  • 1 - Single use per user
  • 2 - Multiple use per user



Expand
titleitems object

items object:

Object propertyDescription
idInternal ID of the survey item
titleSurvey item title
positionPosition in the survey
answers

Array of answers for the survey item

If it's empty, the user should be able to type in any response he wants.

actual_answer

An old answer given to that item (in case the user abandoned the survey before and now it came back)

Internal form - Mosly as an ID, used mostly for fixed answer questions

actual_value

An old answer given to that item (in case the user abandoned the survey before and now it came back)

Human readable form - Mostly as a text, used for open response questions



Expand
titleanswers object

answers object:

Object of type ID - Properties

Object propertyDescription
idInternal ID of the answer
titleTitle of the answer
positionPosition in the answer group
value

Internal value of the answer



Status
colourRed
title403


Code Block
Forbidden


User cannot access the resource





Responding to a survey

Info
iconfalse

Status
colourGreen
titlePOST
 /survey/save


Request

Expand


Request

Endpoint: /survey/save

Method:

Status
colourGreen
titlePOST

Only logged in:

Status
colourGreen
titleYES

Account privilege restriction: Any privilege

Headers:

Expand


Header nameValue
X-Requested-With
XMLHttpRequest
X-Auth-TokenToken obtained from Login endpoint



Parameters:

Expand


ParameterRequiredTypeDescription
instance_id
Status
subtletrue
colourGreen
titleYES
IntegerInstance ID given at the Get scale for user endpoint.
items
Status
subtletrue
colourGreen
titleYES
Array of answer objects

Array of answer objects with the survey responses.

Answer object description:

ParameterRequiredTypeDescription
id
Status
subtletrue
colourGreen
titleYES
IntegerSurvey item ID
actual_answer
Status
subtletrue
colourRed
titleNO
Integer

Survey answer ID

Used when the answer array is not empty when getting the survey data - Fixed answer question

actual_value
Status
subtletrue
colourRed
titleNO
String

Survey answer - Plain text

Used when the answer array is empty when getting the survey data - Open response question





Response

Expand


Response

Http Code

Response

Description

Status
colourBlue
title200


Expand
titleSuccess response


Code Block
titleSuccess response
linenumberstrue
{
    "success": 1,
}



Success response

Expand
titleBase Object

Base object:

Object propertyDescription
successRepresents if the call was successful



Status
colourRed
title403


Code Block
Forbidden


User cannot access the resource