Skip to content

Instantly share code, notes, and snippets.

@timakin
Last active August 29, 2015 14:21
Show Gist options
  • Save timakin/e05a8c66398c4b82e56c to your computer and use it in GitHub Desktop.
Save timakin/e05a8c66398c4b82e56c to your computer and use it in GitHub Desktop.
timakin_board
{
"title": "Timakin Board",
"type": "object",
"definitions": {
"EntryObject": {
"type": "object",
"properties": {
"body": {
"title": "Content of the posted entry.",
"type": "string",
"media": {
"mediaType": "text/plain"
}
},
"csrf_token": {
"title": "CSRF Token",
"type": "string",
"description": "A hidden valud for the protection of Cross-Site Request Forgery attacks."
}
},
"required": ["body", "csrf_token"]
},
"UserObject": {
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 0,
"exclusiveMinimum": true,
"maxLength": 20,
"pattern": "^[A-Za-z0-9]{0,20}$"
},
"password": {
"type": "string",
"minLength": 4,
"maxLength": 20,
"pattern": "^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])[A-Za-z0-9]{4,20}$"
}
},
"required": ["name", "password"]
}
},
"links": [
{
"rel": "root",
"href": "/"
},
{
"title": "Display Posts",
"method": "GET",
"href": "/board"
},
{
"title": "Post a new content",
"rel": "create",
"method": "POST",
"href": "/entry",
"schema": { "$ref": "#/definitions/EntryObject" }
},
{
"title": "Login",
"method": "POST",
"href": "/login",
"schema": { "$ref": "#/definitions/UserObject" }
},
{
"title": "Logout",
"method": "POST",
"href": "/logout"
},
{
"title": "Register",
"method": "POST",
"rel": "create",
"href": "/register",
"schema": { "$ref": "#/definitions/UserObject" }
},
{
"title": "Resign",
"method": "POST",
"href": "/resign",
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment