500 Internal Server Error
Body

Error Message

create upload set
POST /api/uploaded-data/

create new upload set

Request body

Object
surveyId
string

The identifier of the survey this upload is based on

title:
string

The title of this upload set

data
Array of string

initialize as empty

Examples

Responses

200 OK
Body
Object
insertedId
string

The identifier of the created upload set

500 Internal Server Error
Example 1
$ curl  -X POST
	-H "Content-Type: application/json"
	-d '{"surveyID": "5ca3d2e2d2a3ff32b0226814",
	     "title": "Winter 2019 - CSCC09 Course Evaluations"
	     "data": []}'
	http://localhost:3000/api/uploaded-data/
create processed data set
POST /api/processed-data/

create a new processed data set

Request body

Object
surveyID
string

The identifier of the survey this data is based on

surveyTitle
string

The title of this data set

questions
Array

The survey questions

Array of string
data
Array

The survey answers

Array of string

Responses

200 OK
Body
Object
insertedId
string

The identifier of the created processed data set

500 Internal Server Error
Example 1
$ curl  -X POST
	-H "Content-Type: application/json"
	-d '{"surveyID": "5ca3d2e2d2a3ff32b0226814",
	     "title": "Winter 2019 - CSCC09 Course Evaluations"
	     "data": []}'
	     http://localhost:3000/api/processed-data/
create document
POST /db/

create a document and insert into an existing collection

Request parameters

collectionName
string optional

The name of the collection within the database

Example:
/db/surveys/

Request body

JSON of document for insert

Responses

200 OK
Body
Object
insertedId
string

The identifier of the created processed data set

500 Internal Server Error
Example 1
$ curl  -X POST
	-H "Content-Type: application/json"
	-d '{"surveyID": "5ca3d2e2d2a3ff32b0226814",
	     "title": "Winter 2019 - CSCC09 Course Evaluations"
	     "data": []}'
	http://localhost:3000/db/uploaded-data/
create image completed survey
POST /api/process/

process image of a completed survey

Request parameters

uploadId
string optional
Example:
/api/process/194j9f201/

Request body

multipart/form-data
image/png

Image of completed survey

Responses

200 OK
Body
Object
modifiedCount
integer

The number of upload sets modified

500 Internal Server Error
Example 1
$ curl -X POST 
	-F 'image=@Samples/Survey1.jpg'
	https://localhost:3000/process/5ca3d2e2d2a3ff32b0226814/
read surveys
GET /api/survey/

retrieve all surveys

Responses

200 OK
Body
Object
_id
string

The identifier of the survey

title
string

The title of the survey

author
string

The user identifier that created the survey

questions
Array

list of question objects

Object
quesitonTypeID
string

The identifier of the question type

question
string

The text of the question

options
Array

list of option objects

Object
option
string

The text representing an optional answer to the question

locX
number

The top-left x-coordinate of checkbox for this answer

locY
number

The top-left y-coordinate of checkbox for this answer

width
number

The width of the checkbox for this answer

height
number

The height of the checkbox for this answer

500 Internal Server Error
Example 1
$ curl https://localhost:3000/api/survey/
read upload set
GET /api/uploaded-data/

retrieve all upload sets

Responses

200 OK
Body
Object
_id
string

The identifier of the upload set

surveyID
string

The identifier of the survey this upload set is based on

title
string

The title of the survey

data
Array

list of objects

Object
uploadID
string

The identifier of the survey upload

data
Array

list of objects

Object
question
string

The question

answers
Array of string

The checked answers

500 Internal Server Error
Example 1
$ curl https://localhost:3000/api/uploaded-data/5ca3d2e2d2a3ff32b0226814/
read processed data set
GET /api/processed-data/

retrieve all processed data

Responses

200 OK
Body
Object
_id
string

The identifier of the processed data set

surveyID
string

The identifier of the survey this data based on

surveyTitle
string

The title of the survey

questions
Array of string

The questions

data
Array

The answers from the surveys

Array of string
500 Internal Server Error
Example 1
$ curl https://localhost:3000/api/processed-data/
read collection
GET /db/

retrieve all documents from given collection /db/:collectionName/

Request parameters

collectionName
string optional
Example:
/db/processed-data

Responses

200 OK
Body

objects of the retrieved documents

500 Internal Server Error
Example 1
$ curl https://localhost:3000/db/processed-data/
read upload set id
GET /api/uploaded-data/

retrieve upload set with given id

Request parameters

id
string optional
Example:
/api/uploaded-data/5ca3d2f2d2a3ff32b0226814/

Responses

200 OK
Body
Object
_id
string

The identifier of the upload set

surveyID
string

The identifier of the survey this upload set is based on

survey
Object

object of survey that matches the surveyID

title
string

The title of the survey

data
Array

list of objects

Object
question
string

The question

answers
Array of string

The checked answers

500 Internal Server Error
Example 1
$ curl https://localhost:3000/api/uploaded-data/5ca3d2e2d2a3ff32b0226814/
read processed data set id
GET /api/processed-data/

retrieve processed data set with given id

Request parameters

id
string optional
Example:
api/processed-data/5ca362e2d2a3ff32b0226814/

Responses

200 OK
Body
Object
_id
string

The identifier of the processed data set

surveyID
string

The identifier of the survey this data based on

surveyTitle
string

The title of the survey

questions
Array of string

The questions

data
Array

The answers from the surveys

Array of string
500 Internal Server Error
Example 1
$ curl https://localhost:3000/api/processed-data/5ca3d2e2d2a3ff32b0226814/
read collection id
GET /db/

retrieve document with given id from given collection /db/:collectionName/:id

Request parameters

collectionName
string required
Example:
/db/processed-data/
id
string required
Example:
/db/processed-data/320jfaoj38faj

Responses

200 OK
Body

object of retrieved document

Object
500 Internal Server Error
Example 1
$ curl https://localhost:3000/db/processed-data/5ca3d2e2d2a3ff32b0226814/
update questions id
PATCH /api/surveys/

update questions on the survey with given id /api/surveys/:id

Request parameters

id
string optional
Example:
api/surveys/5ca332e2d2a3ff32b0226814

Responses

200 OK
Body

Update successful

500 Internal Server Error
Example 1
$ curl -X PATCH
	-H "Content-Type: application/json" 
	-d '[{
		"question": "Did you enjoy this course?",
		"questionTypeID": 1,
		"options": [
			{
			"option": "Yes",
			"locX": 130,
			"locY": 140,
			"width": 30,
			"height": 25
			},
			{
			"option": "No",
			"locX": 150,
			"locY": 140,
			"width": 30,
			"height": 25
			},
		]
	}]' 
	https://localhost:3000/api/surveys/5ca3d2e2d2a3ff32b0226814
update processed data set id
PATCH /api/processed-data/

update answers in the processed data set with given id /api/processed-data/:id

Request parameters

id
string required
Example:
/api/processed-data/5ca3d2e2d3a3ff32b0226814/

Responses

200 OK
Body

Update successful

500 Internal Server Error
Example 1
$ curl -X PATCH
	-H "Content-Type: application/json" 
	-d '[{"data": ["Likely", "Yes", "No"]}]' 
	https://localhost:3000/api/processed-data/5ca3d2e2d2a3ff32b0226814/
update collection
PATCH /db/

update documents that matches given selector criteria /db/:collectionName

Request parameters

collectionName
string required

/db/surveys/

Request body

Object
selector
Object

object of field values to match

document
Object

object of value to update in collection

Responses

200 OK
Body

Update successful

500 Internal Server Error
Example 1
$ curl -X PATCH
	-H "Content-Type: application/json" 
	-d '{"selector": {"title":"Demo survey"}, 
	     "document": {"title":"Sample survey"}}' 
	https://localhost:3000/db/surveys/
delete document
DELETE /db/

delete a single document that matches given criteria /db/:collectionName

Request parameters

collectionName
string required
Example:
/db/surveys/

Request body

object of match criteria

Responses

200 OK
Body

Delete {numRemoved} items

500 Internal Server Error
Example 1
$ curl -X DELETE
	-H "Content-Type: application/json"  
	-d '{"title": "Demo Survey"}'
	https://localhost:3000/db/surveys/