144 lines
4.8 KiB
JSON
144 lines
4.8 KiB
JSON
[
|
|
|
|
{
|
|
"method": "GET",
|
|
"path": "/users",
|
|
"scope": [[]],
|
|
"info": "returns the list of existing users",
|
|
"in": {},
|
|
"out": {
|
|
"users": { "info": "users list", "type": "any", "name": "Users" }
|
|
}
|
|
},
|
|
{
|
|
"method": "GET",
|
|
"path": "/user/{id}",
|
|
"scope": [],
|
|
"info": "returns info about an existing user",
|
|
"in": {
|
|
"{id}": { "info": "the target user id", "name": "ID", "type": "uint" }
|
|
},
|
|
"out": {
|
|
"id": { "info": "user id", "type": "uint", "name": "ID" },
|
|
"username": { "info": "username", "type": "string(3,30)", "name": "Username" },
|
|
"firstname": { "info": "first name", "type": "string(1,30)", "name": "Firstname" },
|
|
"lastname": { "info": "last name", "type": "string(1,30)", "name": "Lastname" },
|
|
"articles": { "info": "user articles", "type": "any", "name": "Articles" }
|
|
}
|
|
},
|
|
|
|
{
|
|
"method": "POST",
|
|
"path": "/user",
|
|
"scope": [["admin"]],
|
|
"info": "creates a new user",
|
|
"in": {
|
|
"username": { "info": "username", "type": "string(3,30)", "name": "Username" },
|
|
"firstname": { "info": "first name", "type": "string(1,30)", "name": "Firstname" },
|
|
"lastname": { "info": "last name", "type": "string(1,30)", "name": "Lastname" }
|
|
},
|
|
"out": {
|
|
"id": { "info": "user id", "type": "uint", "name": "ID" },
|
|
"username": { "info": "username", "type": "string(3,30)", "name": "Username" },
|
|
"firstname": { "info": "first name", "type": "string(1,30)", "name": "Firstname" },
|
|
"lastname": { "info": "last name", "type": "string(1,30)", "name": "Lastname" }
|
|
}
|
|
},
|
|
{
|
|
"method": "PUT",
|
|
"path": "/user/{id}",
|
|
"scope": [["admin"], ["self"]],
|
|
"info": "updates an existing user",
|
|
"in": {
|
|
"{id}": { "info": "the target user id", "type": "uint", "name": "ID" },
|
|
"username": { "info": "updated username", "type": "?string(3,30)", "name": "Username" },
|
|
"firstname": { "info": "updated first name", "type": "?string(1,30)", "name": "Firstname" },
|
|
"lastname": { "info": "updated last name", "type": "?string(1,30)", "name": "Lastname" }
|
|
},
|
|
"out": {
|
|
"id": { "info": "user id", "type": "uint", "name": "ID" },
|
|
"username": { "info": "username", "type": "string(3,30)", "name": "Username" },
|
|
"firstname": { "info": "first name", "type": "string(1,30)", "name": "Firstname" },
|
|
"lastname": { "info": "last name", "type": "string(1,30)", "name": "Lastname" }
|
|
}
|
|
},
|
|
|
|
{
|
|
"method": "DELETE",
|
|
"path": "/user/{id}",
|
|
"scope": [["admin"], ["self"]],
|
|
"info": "deletes an existing user",
|
|
"in": {
|
|
"{id}": { "info": "the target user id", "name": "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": "ID", "type": "uint" }
|
|
},
|
|
"out": {
|
|
"articles": { "info": "articles list", "type": "any", "name": "Articles" }
|
|
}
|
|
},
|
|
|
|
{
|
|
"method": "GET",
|
|
"path": "/articles",
|
|
"scope": [[]],
|
|
"info": "returns the list of existing articles",
|
|
"in": {},
|
|
"out": {
|
|
"articles": { "info": "articles list", "type": "any", "name": "Articles" }
|
|
}
|
|
}, {
|
|
"method": "GET",
|
|
"path": "/article/{id}",
|
|
"scope": [[]],
|
|
"info": "returns an existing article",
|
|
"in": {
|
|
"{id}": { "info": "the target article id", "name": "ID", "type": "uint" }
|
|
},
|
|
"out": {
|
|
"id": { "info": "the article id", "type": "uint", "name": "ID" },
|
|
"title": { "info": "the article title", "type": "string(5,255)", "name": "Title" },
|
|
"body": { "info": "the article body", "type": "string", "name": "Body" },
|
|
"author": { "info": "the author user id", "type": "uint", "name": "Author" },
|
|
"score": { "info": "absolute vote score", "type": "uint", "name": "Score" }
|
|
}
|
|
}, {
|
|
"method": "POST",
|
|
"path": "/article",
|
|
"scope": [["author"]],
|
|
"info": "post a new article",
|
|
"in": {
|
|
"title": { "info": "the article title", "type": "string(5,255)", "name": "Title" },
|
|
"body": { "info": "the article body", "type": "string", "name": "Body" }
|
|
},
|
|
"out": {
|
|
"id": { "info": "the article id", "type": "uint", "name": "ID" },
|
|
"title": { "info": "the article title", "type": "string(5,255)", "name": "Title" },
|
|
"body": { "info": "the article body", "type": "string", "name": "Body" },
|
|
"author": { "info": "the author user id", "type": "uint", "name": "Author" },
|
|
"score": { "info": "absolute vote score", "type": "uint", "name": "Score" }
|
|
}
|
|
}, {
|
|
"method": "DELETE",
|
|
"path": "/article/{id}",
|
|
"scope": [["admin"], ["author"]],
|
|
"info": "deletes an article",
|
|
"in": {
|
|
"{id}": { "info": "the target article id", "name": "ID", "type": "uint" }
|
|
},
|
|
"out": { }
|
|
}
|
|
|
|
] |