Pollo
Documentation for Pollo
General
Generate a group code
GET
http://pollo-backend.cornellappdev.com/api/v2/generate/code/
Headers
Authentication
string
'Bearer ' + accessToken
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
Authentication
string
'Bearer ' + accessToken
Create a draft
POST
http://pollo-backend.cornellappdev.com/api/v2/drafts/
Query Parameters
text
string
options
array
string[]
Headers
Authentication
string
'Bearer ' + accessToken
Update a draft
PUT
http://pollo-backend.cornellappdev.com/api/v2/drafts/:id
Path Parameters
id
string
Query Parameters
text
string
options
array
string[]
Headers
Authentication
string
'Bearer ' + accessToken
Delete a draft
DELETE
http://pollo-backend.cornellappdev.com/api/v2/drafts/:id
Path Parameters
id
string
Headers
Authentication
string
'Bearer ' + accessToken
Groups
Previously known as Session.
Create a group
POST
http://pollo-backend.cornellappdev.com/api/v2/sessions/
Query Parameters
name
string
code
string
Headers
Authentication
string
'Bearer ' + accessToken
Get a group
GET
http://pollo-backend.cornellappdev.com/api/v2/sessions/:id
Path Parameters
id
string
Headers
Authentication
string
'Bearer ' + accessToken
Get all groups
GET
http://pollo-backend.cornellappdev.com/api/v2/sessions/all/:role
Path Parameters
role
string
If role is member
, this will return all groups you are in. If role is admin
, this will return all groups you are an admin of.
Headers
Authorization
string
'Bearer ' + accessToken
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
id
string
Query Parameters
name
string
Headers
Authorization
string
'Bearer ' + accessToken
Delete a group
DELETE
http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/
Path Parameters
id
string
Headers
Authorization
string
'Bearer ' + accessToken
Leave a group
DELETE
http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/members/
Path Parameters
id
string
Headers
Authorization
string
'Bearer ' + accessToken
Get members
GET
http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/members/
Path Parameters
id
string
Headers
Authorization
string
'Bearer ' + accessToken
Get admins
GET
http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/admins/
Path Parameters
id
string
Headers
Authorization
string
'Bearer ' + accessToken
Add members
POST
http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/members/
Path Parameters
id
string
Query Parameters
memberIDs
array
int[]
Headers
Authorization
string
'Bearer ' + accessToken
Remove members
DELETE
http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/members/
Path Parameters
id
string
Query Parameters
memberIDs
array
int[]
Headers
Authorization
string
'Bearer ' + accessToken
Add admins
POST
http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/admins/
Path Parameters
id
string
Query Parameters
adminIDs
array
int[]
Headers
Authorization
string
'Bearer ' + accessToken
Remove admins
PUT
http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/admins/
Path Parameters
id
string
Query Parameters
adminIDs
array
int[]
Headers
Authorization
string
'Bearer ' + accessToken
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
id
string
Headers
Authorization
string
'Bearer ' + accessToken
Request Body
type
string
text
string
results
object
json
shared
boolean
Get a poll
GET
http://pollo-backend.cornellappdev.com/api/v2/polls/:id/
Path Parameters
id
string
Headers
Authorization
string
'Bearer ' + accessToken
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
id
string
Headers
Authorization
string
'Bearer ' + accessToken
Update a poll
PUT
http://pollo-backend.cornellappdev.com/api/v2/polls/:id/
Path Parameters
id
string
Headers
Authorization
string
'Bearer ' + accessToken
Request Body
text
string
results
string
shared
boolean
Delete a poll
DELETE
http://pollo-backend.cornellappdev.com/api/v2/polls/:id/
Path Parameters
id
string
Headers
Authorization
string
'Bearer ' + accessToken
Questions
Create a question
POST
http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/questions/
Path Parameters
id
string
group id
Headers
Authorization
string
'Bearer ' + accessToken
Request Body
text
string
Get a question
GET
http://pollo-backend.cornellappdev.com/api/v2/questions/:id/
Path Parameters
id
string
question id
Headers
Authorization
string
'Bearer ' + accessToken
Get all questions for a group
GET
http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/questions/
Path Parameters
id
string
group id
Headers
Authorization
string
'Bearer ' + accessToken
Get all questions for a group sorted by date (ascending)
GET
http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/questions/date/
Path Parameters
id
string
group id
Headers
Authorization
string
'Bearer ' + accessToken
Update a question
PUT
http://pollo-backend.cornellappdev.com/api/v2/questions/:id/
Path Parameters
id
string
question id
Headers
Authorization
string
'Bearer ' + accessToken
Request Body
text
string
Delete a question
DELETE
http://pollo-backend.cornellappdev.com/api/v2/questions/:id/
Path Parameters
id
string
question id
Headers
Authorization
string
'Bearer ' + accessToken
Users
Get me
GET
http://pollo-backend.cornellappdev.com/api/v2/users/
Headers
Authorization
string
'Bearer ' + accessToken
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
idToken
string
Refresh session
POST
http://pollo-backend.cornellappdev.com/api/v2/auth/refresh/
Headers
Authorization
string
'Bearer ' + refreshToken
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
code: string
and name?: string
/start/session/
Group
- The group that was created, use id
as a namespace
User sends to start a group
POST
id: number
or code: string
/join/session/
Group
User sends to join a group
Socket
To Server
Message
Body
Description
server/poll/start
Poll
object without id
Admin sends to start a poll
server/poll/end
empty
Admin sends to stop a poll
server/poll/results
empty
Admin sends to share results
server/poll/tally
Answer
object without id
User sends to reveal their chosen response to the server
server/poll/upvote
{ answerID,
googleID }
User sends to upvote an answer
server/poll/delete
pollID
*same as db ID
Admin sends to delete saved poll
server/poll/deleteLive
empty
Admin sends to delete live poll
To Student
Message
Body
Description
user/poll/start
{ poll: Poll
object }
User receives to display a poll
user/poll/end
{ poll: Poll
object }
User receives when poll has ended
user/poll/results/
CurrentState
object
User receives when if admin decides to share results
user/poll/results/live
CurrentState
object
User receives when there is a live FR question when user first joins socket
user/count
{ count: user count
}
User receives number of live users in socket
user/poll/delete
pollID
*same as db ID
User receives when poll is deleted
user/poll/deleteLive
empty
User receives when live poll is deleted
user/answer/success
empty
User receives when FR answer is successfully registered (pass filter)
user/answer/filter
{ text: string
, filter: string array
}
User receives when FR answer is not registered (doesn't pass filter)
To Admin
Message
Body
Description
admin/poll/start
{ poll: Poll
object }
Admin receives current poll upon entry (if there is one)
admin/poll/updateTally
CurrentState
object
Admin receives state of poll i.e. tallies
admin/poll/ended
{ poll: Poll
object }
Admin receives when poll has been ended
user/count
{ count: user 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