#teamwall
An open source software used to build a wall of picture for your team
You will need Leiningen 2.0.0 or above installed.
You will also need Mongo database running.
To start a web server for the application, run:
lein run
The web server should be reachable at localhost:3000
.
First step is to login to retrieve an API token which will be used for every other request.
To login, a GET request needs to be done against the path:
/login
Params | Type | Description |
---|---|---|
url param | the email address used to register | |
password | url param | the password used to register |
cURL example:
$ curl "localhost:3000/login?email=email&password=password"
A JSON string representing a literal object with three keys:
- token: a string representing the unique API token
- user: a map representing the current user
- ttl: the token time-to-live
Example:
{
"token" : "JSzvjh_Qq0zGjLu7pL-9tvGrl84DwgMNT4vZ_F4IxC",
"ttl" : "3600000"
}
Note: ttl is in milliseconds, 3600000
is one hour.
Cause | Status |
---|---|
Success | 200 OK |
Error | 403 Forbidden |
The route is used to provide information about the current logged user. It is mainly used when you log in back using the cookie stored token.
To get all the team members, a GET request needs to be done against the path:
/current-user
Params | Type | Description |
---|---|---|
token | url param | the API token received during the login |
cURL example:
$ curl "localhost:3000/current-user?token=JSzvjh_Qq0zGjLu7pL-9tvGrl84DwgMNT4vZ_F4IxC"
A JSON string representing a literal object. This object has two keys:
- username
Example:
{
"username" : "User 1",
"email" : "user1@mycompany.com"
}
Cause | Status |
---|---|
Success | 200 OK |
Field token missing or invalid | 403 Forbidden |
The route is used to provided information about the members of the team the logged user belongs to. The team is bound by a shared email domain.
To get all the team members, a GET request needs to be done against the path:
/team-members
Params | Type | Description |
---|---|---|
token | url param | the API token received during the login |
cURL example:
$ curl "localhost:3000/team-members?token=JSzvjh_Qq0zGjLu7pL-9tvGrl84DwgMNT4vZ_F4IxC"
A JSON string representing an array of literal objects. Each object has two keys:
- username
Example:
[ {
"username" : "User 1",
"email" : "user1@mycompany.com"
}, {
"username" : "User 2",
"email" : "user2@mycompany.com"
} ]
Cause | Status |
---|---|
Success | 200 OK |
Field token missing or invalid | 403 Forbidden |
Route used to upload a new photo for the user linked to the provided token.
To upload a new photo, a POST request needs to be done against the path:
/new-photo
Params | Type | Description |
---|---|---|
token | url param | the API token received during the login |
photo | multipart/form-data | the new photo to upload |
cURL example:
$ curl --form photo=@photo.png "localhost:3000/new-photo?token=JSzvjh_Qq0zGjLu7pL-9tvGrl84DwgMNT4vZ_F4IxC"
No response.
Cause | Status |
---|---|
Success | 200 OK |
Field token missing or invalid | 403 Forbidden |
Field photo missing | 400 Bad Request |
This route is used to get the last photo of a giver user.
To get the latest photo, a GET request needs to be done against the path:
/<email>/last-photo
Params | Type | Description |
---|---|---|
url segment | the email address of one of your team member | |
token | url param | the API token received during the login |
cURL example:
$ curl "http://localhost:3000/user1@mycompany.com/last-photo?token=JSzvjh_Qq0zGjLu7pL-9tvGrl84DwgMNT4vZ_F4IxC"
Return an image. The url is made so it can be used as html image source.
Cause | Status |
---|---|
Success | 200 OK |
Email address not in the same team | 400 Bad Request |
Field token missing or invalid | 403 Forbidden |
No photo available | 404 Not Found |
Copyright © 2014 Benjamin Van Ryseghem <benjamin [dot] vanryseghem [at] gmail [dot] com>