Comments (3)
This API will be consumed by two different clients
And It will provide access to the core AsyncVoter functionality. i.e.
- Vote's descriptions will only displayed after receive 3 casts.
Therefore I think this is not a regular CRUD API so it would be also useful to specify the JSON messages in each case.
from asyncvoter-api.
@arreche Feel free to post an update REST API including messages
from asyncvoter-api.
Start a voting session
Request
POST /stories
{
"name": "REST API",
"link": "https://github.com/AgileVentures/AsyncVoter/issues/53"
}
Response
201 Created
{
"id": "abc123...",
"name": "REST API",
"link": "https://github.com/AgileVentures/AsyncVoter/issues/53",
"status": "ready" //Waiting for votes
}
Register a vote
Request
POST /stories/abc123.../votes
{
"voter": "arreche", //Could be guessed from the auth in the future
"vote": "3"
}
Response
201 Created
{"id": "def456...",
"story": "abc123...", //Nesting the story JSON here maybe useful
"voter": "arreche",
"vote": 1}
Finish voting session
- Finished automatically after receiving 3 votes
- The system reacts sending a notification to clients (web/bot)
Request
POST /webhook/stories
Response on consensus
201 Created
{
"id": "abc123...",
"name": "REST API",
"link": "https://github.com/AgileVentures/AsyncVoter/issues/53",
"status": "consensus",
"points": "1",
"votes": [{"arreche": 1}, {"Zsuark": 1}, {"joaopapereira": 1}]
}
Response on disagreement
{
"id": "abc123...",
"name": "REST API",
"link": "https://github.com/AgileVentures/AsyncVoter/issues/53",
"status": "disagreement",
"votes": [{"arreche": 3}, {"Zsuark": 1}, {"joaopapereira": 1}]
}
Get a voting session
Request
GET /stories/abc123...
Response
200 OK
{
"id": "abc123...",
"name": "REST API",
"link": "https://github.com/AgileVentures/AsyncVoter/issues/53",
"status": "consensus",
"points": "1",
"votes": [{"arreche": 1}, {"Zsuark": 1}, {"joaopapereira": 1}]
}
List voting sessions
- Optionally it allows filtering vote sessions by status
Request
GET /stories?status=(ready | consensus | disagreement)
Response
200 OK
[{
"id": "abc123...",
"name": "REST API",
"link": "https://github.com/AgileVentures/AsyncVoter/issues/53",
"status": "consensus",
"points": "1",
"votes": [{"arreche": 1}, {"Zsuark": 1}, {"joaopapereira": 1}]
}]
from asyncvoter-api.
Related Issues (20)
- Refactor tests HOT 3
- Only active stories may be voted on
- Set environment variables across platforms
- issues with start vote feature HOT 1
- document the API HOT 2
- Specify required mongodb version
- Lock down the versions of a package's dependencies
- need CORS support for react interface
- Render new story when new issue is submitted HOT 1
- Secure master branch
- add source of story HOT 1
- add user ids to stories and votes
- create an api client
- EPIC create client code to work with api HOT 2
- deploying asyncvoter-api to azure/dokku HOT 1
- set up staging server
- allow user to update vote HOT 1
- prefer MONGO_URL to MONGODB
- Add Revealed field to API Story
- Update spec tests to test new revealed flag in story
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asyncvoter-api.