Pollo
Documentation for Pollo
General
Generate a group code
GET
http://pollo-backend.cornellappdev.com/api/v2/generate/code/
Headers
Name | Type | Description |
---|---|---|
Authentication | string |
|
Drafts
If options
are empty, assume free response question.
Get all drafts for a user
GET
http://pollo-backend.cornellappdev.com/api/v2/drafts/
Headers
Name | Type | Description |
---|---|---|
Authentication | string |
|
Create a draft
POST
http://pollo-backend.cornellappdev.com/api/v2/drafts/
Query Parameters
Name | Type | Description |
---|---|---|
text | string | |
options | array | string[] |
Headers
Name | Type | Description |
---|---|---|
Authentication | string |
|
Update a draft
PUT
http://pollo-backend.cornellappdev.com/api/v2/drafts/:id
Path Parameters
Name | Type | Description |
---|---|---|
id | string |
Query Parameters
Name | Type | Description |
---|---|---|
text | string | |
options | array | string[] |
Headers
Name | Type | Description |
---|---|---|
Authentication | string |
|
Delete a draft
DELETE
http://pollo-backend.cornellappdev.com/api/v2/drafts/:id
Path Parameters
Name | Type | Description |
---|---|---|
id | string |
Headers
Name | Type | Description |
---|---|---|
Authentication | string |
|
Groups
Previously known as Session.
Create a group
POST
http://pollo-backend.cornellappdev.com/api/v2/sessions/
Query Parameters
Name | Type | Description |
---|---|---|
name | string | |
code | string |
Headers
Name | Type | Description |
---|---|---|
Authentication | string |
|
Get a group
GET
http://pollo-backend.cornellappdev.com/api/v2/sessions/:id
Path Parameters
Name | Type | Description |
---|---|---|
id | string |
Headers
Name | Type | Description |
---|---|---|
Authentication | string |
|
Get all groups
GET
http://pollo-backend.cornellappdev.com/api/v2/sessions/all/:role
Path Parameters
Name | Type | Description |
---|---|---|
role | string | If role is |
Headers
Name | Type | Description |
---|---|---|
Authorization | string |
|
Each of the Group nodes has an extra field called updatedAt
indicating the latest activity in Unix time & field called isLive
indicating whether the group is live or not.
Update a group
PUT
http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/
Path Parameters
Name | Type | Description |
---|---|---|
id | string |
Query Parameters
Name | Type | Description |
---|---|---|
name | string |
Headers
Name | Type | Description |
---|---|---|
Authorization | string |
|
Delete a group
DELETE
http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/
Path Parameters
Name | Type | Description |
---|---|---|
id | string |
Headers
Name | Type | Description |
---|---|---|
Authorization | string |
|
Leave a group
DELETE
http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/members/
Path Parameters
Name | Type | Description |
---|---|---|
id | string |
Headers
Name | Type | Description |
---|---|---|
Authorization | string |
|
Get members
GET
http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/members/
Path Parameters
Name | Type | Description |
---|---|---|
id | string |
Headers
Name | Type | Description |
---|---|---|
Authorization | string |
|
Get admins
GET
http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/admins/
Path Parameters
Name | Type | Description |
---|---|---|
id | string |
Headers
Name | Type | Description |
---|---|---|
Authorization | string |
|
Add members
POST
http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/members/
Path Parameters
Name | Type | Description |
---|---|---|
id | string |
Query Parameters
Name | Type | Description |
---|---|---|
memberIDs | array | int[] |
Headers
Name | Type | Description |
---|---|---|
Authorization | string |
|
Remove members
DELETE
http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/members/
Path Parameters
Name | Type | Description |
---|---|---|
id | string |
Query Parameters
Name | Type | Description |
---|---|---|
memberIDs | array | int[] |
Headers
Name | Type | Description |
---|---|---|
Authorization | string |
|
Add admins
POST
http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/admins/
Path Parameters
Name | Type | Description |
---|---|---|
id | string |
Query Parameters
Name | Type | Description |
---|---|---|
adminIDs | array | int[] |
Headers
Name | Type | Description |
---|---|---|
Authorization | string |
|
Remove admins
PUT
http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/admins/
Path Parameters
Name | Type | Description |
---|---|---|
id | string |
Query Parameters
Name | Type | Description |
---|---|---|
adminIDs | array | int[] |
Headers
Name | Type | Description |
---|---|---|
Authorization | string |
|
Polls
Answer
is the user’s answer for that specific question. null
if the user is the admin of the question. For multiple choice, answer is the choice. For free response, answer is an array of answer ids.
correctAnswer
is the correct answer choice for multiple choice (ex. correctAnswer: 'A'
). Empty string if no correct answer selected for multiple choice or the question is free response.
Create a poll
POST
http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/polls/
Path Parameters
Name | Type | Description |
---|---|---|
id | string |
Headers
Name | Type | Description |
---|---|---|
Authorization | string |
|
Request Body
Name | Type | Description |
---|---|---|
type | string | |
text | string | |
results | object | json |
shared | boolean |
Get a poll
GET
http://pollo-backend.cornellappdev.com/api/v2/polls/:id/
Path Parameters
Name | Type | Description |
---|---|---|
id | string |
Headers
Name | Type | Description |
---|---|---|
Authorization | string |
|
Get all polls for a group sorted by date (ascending)
GET
http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/polls/
Admin user will receive all polls
Member user will receive all polls but with poll results hidden (set to {}
) if poll is unshared
Path Parameters
Name | Type | Description |
---|---|---|
id | string |
Headers
Name | Type | Description |
---|---|---|
Authorization | string |
|
Update a poll
PUT
http://pollo-backend.cornellappdev.com/api/v2/polls/:id/
Path Parameters
Name | Type | Description |
---|---|---|
id | string |
Headers
Name | Type | Description |
---|---|---|
Authorization | string |
|
Request Body
Name | Type | Description |
---|---|---|
text | string | |
results | string | |
shared | boolean |
Delete a poll
DELETE
http://pollo-backend.cornellappdev.com/api/v2/polls/:id/
Path Parameters
Name | Type | Description |
---|---|---|
id | string |
Headers
Name | Type | Description |
---|---|---|
Authorization | string |
|
Questions
Create a question
POST
http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/questions/
Path Parameters
Name | Type | Description |
---|---|---|
id | string | group id |
Headers
Name | Type | Description |
---|---|---|
Authorization | string |
|
Request Body
Name | Type | Description |
---|---|---|
text | string |
Get a question
GET
http://pollo-backend.cornellappdev.com/api/v2/questions/:id/
Path Parameters
Name | Type | Description |
---|---|---|
id | string | question id |
Headers
Name | Type | Description |
---|---|---|
Authorization | string |
|
Get all questions for a group
GET
http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/questions/
Path Parameters
Name | Type | Description |
---|---|---|
id | string | group id |
Headers
Name | Type | Description |
---|---|---|
Authorization | string |
|
Get all questions for a group sorted by date (ascending)
GET
http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/questions/date/
Path Parameters
Name | Type | Description |
---|---|---|
id | string | group id |
Headers
Name | Type | Description |
---|---|---|
Authorization | string |
|
Update a question
PUT
http://pollo-backend.cornellappdev.com/api/v2/questions/:id/
Path Parameters
Name | Type | Description |
---|---|---|
id | string | question id |
Headers
Name | Type | Description |
---|---|---|
Authorization | string |
|
Request Body
Name | Type | Description |
---|---|---|
text | string |
Delete a question
DELETE
http://pollo-backend.cornellappdev.com/api/v2/questions/:id/
Path Parameters
Name | Type | Description |
---|---|---|
id | string | question id |
Headers
Name | Type | Description |
---|---|---|
Authorization | string |
|
Users
Get me
GET
http://pollo-backend.cornellappdev.com/api/v2/users/
Headers
Name | Type | Description |
---|---|---|
Authorization | string |
|
Authentication
If invalid accessToken
is passed into request header, 401 error
is thrown.
Authenticate mobile
POST
http://pollo-backend.cornellappdev.com/api/v2/auth/mobile
Request Body
Name | Type | Description |
---|---|---|
idToken | string |
Refresh session
POST
http://pollo-backend.cornellappdev.com/api/v2/auth/refresh/
Headers
Name | Type | Description |
---|---|---|
Authorization | string |
|
Socket Protocol
Built with Socket.io. Documentation found here.
Socket Connection
Connect (default socket) Make sure to visit /join/session/
before joining a socket because this will create the socket if not created yet. You will need to emit userType
on connect to socket.
Disconnect (default socket)
Group
Rest
Method | Body | URL | Response | Description |
POST |
|
|
| User sends to start a group |
POST |
|
|
| User sends to join a group |
Socket
To Server
Message | Body | Description |
|
| Admin sends to start a poll |
| empty | Admin sends to stop a poll |
| empty | Admin sends to share results |
|
| User sends to reveal their chosen response to the server |
|
| User sends to upvote an answer |
|
| Admin sends to delete saved poll |
| empty | Admin sends to delete live poll |
To Student
Message | Body | Description |
| { poll: | User receives to display a poll |
| { poll: | User receives when poll has ended |
|
| User receives when if admin decides to share results |
|
| User receives when there is a live FR question when user first joins socket |
| { count: | User receives number of live users in socket |
|
| User receives when poll is deleted |
| empty | User receives when live poll is deleted |
| empty | User receives when FR answer is successfully registered (pass filter) |
| { text: | User receives when FR answer is not registered (doesn't pass filter) |
To Admin
Message | Body | Description |
| { poll: | Admin receives current poll upon entry (if there is one) |
|
| Admin receives state of poll i.e. tallies |
| { poll: | Admin receives when poll has been ended |
| { count: | User receives number of live users in socket |
Type Definitions
These objects are not saved outside of a socket.
Current State
Example of results. Note: answers is a mapping of googleID to selected option.
Answer
For MC: choice
should be C
and text should be Saturn
.
For FR: choice
and text
should be Saturn
.
Poll
options
is the text of the choices. If the choices are
where D
is a blank option, the choices would be:
Poll
is saved into the database after admin ends poll.
Last updated