Survey service manager backend. Works with surveys, questions and answers. For more info see #Protocol.
Ensure that PostgreSql is accessible before running the service.
Postrges access url is specified in application.properties for spring.datasource.url
sudo ./gradlew build buildDocker
sudo docker run -p 8080:8080 -t com.surveyor.manager
./gradlew bootRun
GET /survey/{id} get full survey config by id.
Response:
{
"result" : true,
"response" :
{
"id" : "survey_id"
"name" : "suvey_name",
"country_code" : "CC",
"questions" :
[
{
"id" : "question_id",
"name" : "question_name",
"answers" :
[
{
"id" : "answer_id",
"name" : "answer_name"
}
...
]
}
...
]
}
}
DELETE /survey/{id} delete survey, all its questions and answers by id.
Response:
{
"result" : true,
"response" : "ok"
}
POST /survey create survey
BODY:
{
"name" : "suvey_name",
"country_code" : "CC",
"questions" :
[
{
"name" : "question_name",
"answers" : [{"name" : "answer_name"}...]
}
...
]
}
Response:
{
"result" : true,
"response" : "<created_survey_id>"
}
POST /survey/load same as /survey
. Load was planned to be method for creating whole survey
while just POST to /survey
for creating only survey headers (without questions and answers).
But now there is now difference between them.
PUT /survey/{id} edit survey by id
BODY:
send only information to be updated.
do not send questions as they are ignored. Use questions CRUD for editing questions.
{
"name" : "new_name"
}
Response:
{
"result" : true,
"response" : "ok"
}
POST /question create question
BODY:
{
"name" : "question_name",
"answers" : [{"name" : "answer_name"}...]
}
Response:
{
"result" : true,
"response" : "<created_questsion_id>"
}
PUT /question/{id} edit question by id
BODY:
do not send answers as they are ignored. Use answers CRUD for editing answers.
{
"name" : "new_name",
}
Response:
{
"result" : true,
"response" : "ok"
}
DELETE /question/{id} delete question by id
Response:
{
"result" : true,
"response" : "ok"
}
GET /question/{id} get question by id
Response:
{
"result" : true,
"response" :
{
"id" : "question_id",
"name" : "question_name",
"answers" :
[
{
"id" : "answer_id",
"name" : "answer_name"
}
...
]
}
}
POST /answer create answer
BODY:
{
"name" : "answer_name"
}
Response:
{
"result" : true,
"response" : "<created_answer_id>"
}
PUT /answer/{id} update answer by id
BODY:
{
"name" : "new_name"
}
Response:
{
"result" : true,
"response" : "ok"
}
DELETE /answer/{id} delete answer by id Response:
{
"result" : true,
"response" : "ok"
}
GET answer/{id} get answer by id
{
"result" : true,
"response" :
{
"id" : "answer_id"
"name" : "answer_name"
}
}
-
Create Survey -> get survey_id
See Survey's CRUD -
Create Question -> get question_id
See Question's CRUD -
Attach question to survey
GET /attach/question?question_id=<question_id>&survey_id=<survey_id> attach question with<question_id>
to survey with<survey_id>
Response:{ "result" : true, "response" : "ok" }
-
Create Answer -> get answer_id
See Answer's CRUD -
Attach answer to question GET /attach/answer?question_id=<question_id>&answer_id=<answer_id> attach answer with
<answer_id>
to question with<question_id>
Response:{ "result" : true, "response" : "ok" }