-
Notifications
You must be signed in to change notification settings - Fork 2
api users *
Matheus Gomes Maia edited this page May 15, 2018
·
6 revisions
-
URL
/api/users/
-
Method:
GET
-
URL Params
Optional:
query: ?skip=0&limit=50
-
Data Params
-
Success Response:
-
Code: 200
-
Content:
[ { "_id": "5af68aade1b237001abd78d4", "username": "matheusgmaia", "email": "[email protected]", "__v": 2, "eventHistory": [], "followers": [], "following": [], "favTeams": [ "5af66362b91878001bb2c26e", "5af66392b91878001bb2c26f" ], "createdAt": "2018-05-12T06:33:17.005Z" }, { "_id": "5af68aade1b237345abd78d4", "username": "viniboy", "email": "[email protected]", "__v": 2, "eventHistory": [], "followers": [], "following": [], "favTeams": [ "5af66362b91878001bb2c26e", "5af66392b91878001bb2c26f" ], "createdAt": "2018-05-14T07:30:20.005Z" } ]
-
-
/api/users/
URL
-
Method:
POST
-
URL Params
-
Data Params
Required:
{
"username": string,
"email" : string [unique, valid]
}
-
Success Response:
-
Code: 200
-
Content:
{ "__v": 0, "username": "matheusgmaia", "email": "[email protected]", "_id": "5af68aade1b237001abd78d4", "eventHistory": [], "followers": [], "following": [], "favTeams": [], "createdAt": "2018-05-12T06:33:17.005Z" }
-
-
URL
api/users/:userId
-
Method:
GET
-
URL Params
Required:
userid=string hex
-
Data Params
-
Success Response:
-
Code: 200
- Content:
-
Code: 200
{
"_id": "5af68aade1b237001abd78d4",
"username": "matheusgmaia",
"email": "[email protected]",
"__v": 2,
"eventHistory": [],
"followers": [],
"following": [],
"favTeams": [
{
"_id": "5af66362b91878001bb2c26e",
"name": "Campinense",
"imgSource": "aksdmaomd",
"__v": 0,
"createdAt": "2018-05-12T03:45:38.035Z"
},
{
"_id": "5af66392b91878001bb2c26f",
"name": "Palmeiras",
"imgSource": "aksdmaomd",
"__v": 0,
"createdAt": "2018-05-12T03:46:26.882Z"
}
],
"createdAt": "2018-05-12T06:33:17.005Z"
}
-
URL
/api/:userId
-
Method:
PUT
-
URL Params
Required:
userid=string hex
-
Data Params
Required:
{"username": "matheusgmaia33", "email": "[email protected]"}
-
Success Response:
-
Code: 200
-
Content: MODELO DO USUÁRIO
{ "_id": "5af68aade1b237001abd78d4", "username": "matheusgmaia33", "email": "[email protected]", "__v": 2, "eventHistory": [], "followers": [], "following": [], "favTeams": [ { "_id": "5af66362b91878001bb2c26e", "name": "Campinense", "imgSource": "aksdmaomd", "__v": 0, "createdAt": "2018-05-12T03:45:38.035Z" }, { "_id": "5af66392b91878001bb2c26f", "name": "Palmeiras", "imgSource": "aksdmaomd", "__v": 0, "createdAt": "2018-05-12T03:46:26.882Z" } ], "createdAt": "2018-05-12T06:33:17.005Z" }
-
-
URL
/api/users/:userId
-
Method:
DELETE
-
URL Params
Required:
userid=string hex
-
Success Response:
-
Code: 200
- Content: Modelo do usuário deletado
-
Code: 200
-
URL
/:userId/favTeam
-
Method:
PUT
-
URL Params
Required:
userid=string hex
-
Data Params
Optional: lista de ids de todos os times, array
favTeams: [team1.id, team2.id, team3.id, ...]