Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Voting Endpoint #11

Open
austinpray opened this issue Jun 6, 2015 · 5 comments
Open

Voting Endpoint #11

austinpray opened this issue Jun 6, 2015 · 5 comments
Milestone

Comments

@austinpray
Copy link
Member

No description provided.

@austinpray austinpray added this to the 1.0.0 milestone Jun 14, 2015
@austinpray
Copy link
Member Author

@smspence @ridhoq

Let's decide on the voting endpoint.

POST /votes

Request

{"action": "water"}

Response

Some success or failure object that is consistent throughout the app.

Votes for the next action to be water

GET /votes

Response

{
  "actions": {
    "water": 1,
    "nothing": 0
  }
}

Gets all the votes

@smspence
Copy link
Contributor

I was thinking the response from POST /votes could look like this:

{
   "success" : bool,
   "status_code" : int,
   "status_message" : string
}

Example response:

{
   "success": true,
   "status_code": 1,
   "status_message": "The vote was successfully recorded."
}

Or maybe we can omit the success bool and just use status_code to communicate success or failure. Thoughts?

@austinpray
Copy link
Member Author

{
   "success" : bool,
   "status_code" : int
}

These are not necessary because we have this built into HTTP

http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

@austinpray
Copy link
Member Author

We should probably just do this for the errors: http://jsonapi.org/format/#errors

@austinpray
Copy link
Member Author

Lookin pretty good:

screenshot 2015-06-19 23 36 51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants