-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c68370
commit e172fe6
Showing
3 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# \[OVERDRIVE\] Session 4 API Documentation | ||
|
||
This is the API documentation for the AEC 2024 Skill 08 Session 4 API. | ||
|
||
## Events | ||
|
||
The API provides an endpoint to subscribe to the actions of an event and sending an answer to a voting poll. | ||
|
||
### Subscribe to an Event | ||
|
||
This endpoint uses HTTP Long Polling, meaning the connection will remain open until an action is available. Clients should make a request to this endpoint and wait for a response. Once a response is received, the client should immediately make another request to continue receiving actions. | ||
|
||
For the initial request, it is possible to pass the query parameter `wait=false` to get the current action immediately. | ||
|
||
``` | ||
GET /events/:id/subscribe | ||
``` | ||
|
||
Example Response | ||
|
||
```json | ||
{ | ||
"action": { | ||
"type": "vote", | ||
"question": "Which protocol is used to transfer web pages over the internet?", | ||
"answerA": "HTTP", | ||
"answerB": "FTP" | ||
} | ||
} | ||
``` | ||
|
||
### Answer a Poll | ||
|
||
This endpoint allows clients to answer a poll. The client should make a POST request to this endpoint with the answer in the request body. | ||
|
||
``` | ||
POST /events/:id/vote | ||
``` | ||
|
||
Request Body | ||
|
||
``` | ||
{ | ||
answer: "a" | "b" | ||
} | ||
``` |
File renamed without changes.