144 lines
4.3 KiB
JSON
144 lines
4.3 KiB
JSON
[
|
|
|
|
{
|
|
"method": "GET",
|
|
"path": "/users",
|
|
"scope": [[]],
|
|
"info": "returns the list of existing users",
|
|
"in": {},
|
|
"out": {
|
|
"users": { "info": "users list", "type": "any" }
|
|
}
|
|
},
|
|
{
|
|
"method": "GET",
|
|
"path": "/user/{id}",
|
|
"scope": [],
|
|
"info": "returns info about an existing user",
|
|
"in": {
|
|
"{id}": { "info": "the target user id", "name": "user_id", "type": "uint" }
|
|
},
|
|
"out": {
|
|
"id": { "info": "user id", "type": "uint" },
|
|
"username": { "info": "username", "type": "string(3,30)" },
|
|
"firstname": { "info": "first name", "type": "string(1,30)" },
|
|
"lastname": { "info": "last name", "type": "string(1,30)" },
|
|
"articles": { "info": "user articles", "type": "any" }
|
|
}
|
|
},
|
|
|
|
{
|
|
"method": "POST",
|
|
"path": "/user",
|
|
"scope": [["admin"]],
|
|
"info": "creates a new user",
|
|
"in": {
|
|
"username": { "info": "username", "type": "string(3,30)" },
|
|
"firstname": { "info": "first name", "type": "string(1,30)" },
|
|
"lastname": { "info": "last name", "type": "string(1,30)" }
|
|
},
|
|
"out": {
|
|
"id": { "info": "new user's id", "type": "uint" },
|
|
"username": { "info": "new user's username", "type": "string(3,30)" },
|
|
"firstname": { "info": "new user's first name", "type": "string(1,30)" },
|
|
"lastname": { "info": "new user's last name", "type": "string(1,30)" }
|
|
}
|
|
},
|
|
{
|
|
"method": "PUT",
|
|
"path": "/user/{id}",
|
|
"scope": [["admin"], ["self"]],
|
|
"info": "updates an existing user",
|
|
"in": {
|
|
"{id}": { "info": "the target user id", "type": "uint", "name": "user_id" },
|
|
"username": { "info": "updated username", "type": "?string(3,30)" },
|
|
"firstname": { "info": "updated first name", "type": "?string(1,30)" },
|
|
"lastname": { "info": "updated last name", "type": "?string(1,30)" }
|
|
},
|
|
"out": {
|
|
"id": { "info": "new user's id", "type": "uint" },
|
|
"username": { "info": "new user's username", "type": "string(3,30)" },
|
|
"firstname": { "info": "new user's first name", "type": "string(1,30)" },
|
|
"lastname": { "info": "new user's last name", "type": "string(1,30)" }
|
|
}
|
|
},
|
|
|
|
{
|
|
"method": "DELETE",
|
|
"path": "/user/{id}",
|
|
"scope": [["admin"], ["self"]],
|
|
"info": "deletes an existing user",
|
|
"in": {
|
|
"{id}": { "info": "the target user id", "name": "user_id", "type": "uint" }
|
|
},
|
|
"out": {}
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
|
"method": "GET",
|
|
"path": "/user/{id}/articles",
|
|
"scope": [[]],
|
|
"info": "returns the list of existing articles a user wrote",
|
|
"in": {
|
|
"{id}": { "info": "author user id", "name": "author_id", "type": "uint" }
|
|
},
|
|
"out": {
|
|
"articles": { "info": "articles list", "type": "any" }
|
|
}
|
|
},
|
|
|
|
{
|
|
"method": "GET",
|
|
"path": "/articles",
|
|
"scope": [[]],
|
|
"info": "returns the list of existing articles",
|
|
"in": {},
|
|
"out": {
|
|
"articles": { "info": "articles list", "type": "any" }
|
|
}
|
|
}, {
|
|
"method": "GET",
|
|
"path": "/article/{id}",
|
|
"scope": [[]],
|
|
"info": "returns an existing article",
|
|
"in": {
|
|
"{id}": { "info": "the target article id", "name": "article_id", "type": "uint" }
|
|
},
|
|
"out": {
|
|
"id": { "info": "the article id", "type": "uint" },
|
|
"title": { "info": "the article title", "type": "string(5,255)" },
|
|
"body": { "info": "the article body", "type": "string" },
|
|
"author": { "info": "the author user id", "type": "uint" },
|
|
"score": { "info": "absolute vote score", "type": "uint" }
|
|
}
|
|
}, {
|
|
"method": "POST",
|
|
"path": "/article",
|
|
"scope": [["author"]],
|
|
"info": "post a new article",
|
|
"in": {
|
|
"title": { "info": "the article title", "type": "string(5,255)" },
|
|
"body": { "info": "the article body", "type": "string" }
|
|
},
|
|
"out": {
|
|
"id": { "info": "the article id", "type": "uint" },
|
|
"title": { "info": "the article title", "type": "string(5,255)" },
|
|
"body": { "info": "the article body", "type": "string" },
|
|
"author": { "info": "the author user id", "type": "uint" },
|
|
"score": { "info": "absolute vote score", "type": "uint" }
|
|
}
|
|
}, {
|
|
"method": "DELETE",
|
|
"path": "/article/{id}",
|
|
"scope": [["admin"], ["author"]],
|
|
"info": "deletes an article",
|
|
"in": {
|
|
"{id}": { "info": "the target article id", "name": "article_id", "type": "uint" }
|
|
},
|
|
"out": { }
|
|
}
|
|
|
|
] |