Pretty straightforward bearer token authentication
- need to set
Authentication
header toBearer b64-token-from-signin
- not all endpoints require authentication
- like github/stackoverflow, website should work normally even if user isn't logged in
Sends a login token so user can authenticate other endpoints
{
"login" : "[email protected]",
"password" : "dansk99"
}
- login: email/username
- password: plaintext password
- could use a hash but has to be consistent
- 200: Gives user their bearer token (see #Authentication
- 400: Something is missing or invalid, should show user the response message
Given relevant information, create a new user account
{
"username" : "dvtate",
"password" : "dansk99",
"email" : "[email protected]"
}
done
- 200: should redirect them to login page, not sure if we wanna add email verification phase eventually
- 400: Invalid form data
Gives some relevant information about specified user
- in future will likely have activity data and usage statistics (gameification)
:username
: identification for target user
/api/user/describe/dvtate
{ "userId": 2671706909569302, "email": "[email protected]", "username": "dvtate", "bio": "**OMG** _this_ *is* `Markdown`", "createdTs": 1581126916165 }
userId
: will likely remove this field eventuallyemail
: might hide this field toousername
: same as parambio
: if notnull
it's a user-defined markdown text about them- should be rendered appropriately
createdTs
: join date as an epoch ms
- 200: relevant information as json
- 400: invalid username
Change user information/settings
Field to edit and new value
{
"username" : "dvtate2"
}
- username: change username
- password: set a new password
- bio: change bio md
- email: change email
done
- 200: success
- 400:
- 401:
Bounties/Tasks are posted as "threads" and they have comments and other things assocaitedwith them.
Post a new bounty/task
{
"title" : "Make a game",
"tags" : ["C++", "SDL", "Linux", "game"],
"spec" : "need to be able to drive car on the moon"
}
title
: quick name for bounty (limit 140 chars)tags
: list of relevant tagsspec
: markdown specification for deliverables
On success, responds with bountyThreadId
23421431242131
- 200:
- 400:
- 401:
Get a quick description of bountyThread.
- if we were stackoverflow this would be used to generate list of questions
{ "title": "Make a game", "tags": "[\"C++\",\"SDL\",\"Linux\",\"game\"]", "specBody": "need to be able to drive car on moon", "opUserId": 7171715303648065, "ts": 1581482876109, "views": 8, "comments": 1, "solutions": 0, "watching": 0, "score": 1, "userVote": 1 }
- 200
- 400
Get everything we have about given thread
- if we were stackoverflow this would be used to generate actual page for question
{ "title": "Make a game", "tags": "[\"C++\",\"SDL\",\"Linux\",\"game\"]", "specBody": "Guns and bombs and space ships. Teleport with buttons. Arrow keys for movement. 3d", "opUserId": 7171715303648065, "views": 8, "ts": 1581482876109, "score": 1, "watching": [], "comments": [ { "bountyCommentId": 1, "authorUserId": 7171715303648065, "body": "this is a bad question, but ig it doens't matter bc it's just a test...", "review": "comment", "ts": 1581486140843 } ], "userVote": 1 }
- 200,400
Vote a post up/down or remove your vote
bountyThreadId
: relevant bountyThreaddirection
:up
(+1),down
(-1), ornull
(0)
done
- 200, 401, 400
Equivalent to "I'm working on this"
done
- 200, 401, 400
Comment/Solve the task
{
"type" : "solution",
"body" : "[my solution](http://github.com/dvtate/yoda)"
}
- type: either
- "solution" if user wants to solve task
- "comment" perhapse user wants clarification from OP
- body: markdown body
done
- 200, 401, 400