Creating a questionnaire
The questionnaire will be shown to members after they sign up and contains a custom list of questions and answers.
PUT https://:subdomain.cobot.me/api/questionnaire
This will update or create a questionnaire for the space.
- Authentication required:
- yes, additionally user must be a space admin
- Scope required
- write_questions
Example
PUT https://co-up.cobot.me/api/questionnaire
Request:
{
"message": 'welcome message',
"questions": [{
"text": 'What do you like?',
"type": 'checkboxes',
"required": false,
"choices": ['cake', 'apple'],
"public": true
}]
}
Response:
{
"message": 'welcome message',
"questions": [{
"text": 'What do you like?',
"type": 'checkboxes',
"required": false,
"choices": ['cake', 'apple'],
"public": true
}]
}
- message
- optional text to display
- questions
- must contain at least one question
Question Attributes
- text
- the question
- type
- How the answer should be made, must be 'text', 'checkboxes' (multiple choice), 'drop-down' (single choice) or 'file' (upload)
- choices
- Must be an array with possible answers for _type_ 'checkboxes' or 'drop-down'
- public
- is optional to indicate if answers are publicly accessible, defaults to false
- required
- is optional to indicate if question must be answered, defaults to false
Getting a questionnaire
The Questionnaire will be shown to members after they sign up and contains a custom list of questions and answers.
GET https://:subdomain.cobot.me/api/questionnaire
- Authentication required:
- yes, additionally user must be a space admin or member
- Scope required
- read_questions
Response:
{
"message": 'welcome message',
"questions": [{
"text": 'What do you like?',
"type": 'checkboxes',
"required": false,
"choices": ['cake', 'apple'],
"public": true
}]
}
List answers for a member
As admin:
GET https://:subdomain.cobot.me/api/memberships/:membership_id/answers
As member:
GET https://:subdomain.cobot.me/api/membership/answers
This returns the answers a member has given to the questions the space has set up. Only answers that are part of the space's current questionnaire are returned.
- Authentication required:
- yes, additionally user must be a space admin or member
- Scope required
- read_answers
Example
As admin:
GET https://co-up.cobot.me/api/memberships/12345/answers
As member:
GET https://co-up.cobot.me/api/membership/answers
Response:
[{
"question": "What is your Twitter handle?",
"answer": "@cobot_me"
}]
If no answers have been given yet returns an empty array but still a 200 code.
List members with answers for a space
GET https://:subdomain.cobot.me/api/answers
This returns all current members and the answered publicly visible questions. If the access is authenticated it will return all answered.
You can pass an optional membership_ids
query parameter, containing a comma
separated list of membership ids to return answers for.
- Authentication required:
- optional as admin
Example
GET https://co-up.cobot.me/api/memberships/12345/answers
Response:
[{
membership: {
name: Cobot,
id: "0c4f75fa14924423810d6f12aeb56fbb"
address: {
name: nil,
company: 'Cobot',
country: 'Germany'
}},
answers: [{
"question": "What is your Twitter handle?",
"answer": "@cobot_me"
}]
}]
- name
-
Is the name of the address if set otherwise the company.
Update answers for a member
As admin:
PUT https://:subdomain.cobot.me/api/memberships/:membership_id/answers
As member:
PUT https://:subdomain.cobot.me/api/membership/answers
This will change answers that are send and discard answers that are not send. An empty list will have the same effect as using DELETE.
- Authentication required:
- yes, additionally user must be a space admin or user
- Scope required
- write_answers
Example
As admin:
PUT https://co-up.cobot.me/api/memberships/12345/answers
As member:
PUT https://:subdomain.cobot.me/api/membership/answers
Request:
[{
"question": "What is your Twitter handle?",
"answer": "@cobot_me"
}]
Response:
[{
"question": "What is your Twitter handle?",
"answer": "@cobot_me"
}]
Remove all answers for a member
As admin:
DELETE https://:subdomain.cobot.me/api/memberships/:membership_id/answers
As member:
DELETE https://:subdomain.cobot.me/api/membership/answers
- Authentication required:
- yes, additionally user must be a space admin or user
- Scope required
- write_answers
Example
As admin:
DELETE https://co-up.cobot.me/api/memberships/12345/answers
As member:
DELETE https://:subdomain.cobot.me/api/membership/answers
Returns an empty 204 response