Wealthy Laughing Duck API API documentation
Wealthy Laughing Duck
This is a workshop project
Technologies used
The aim is to provide consistent API for different SPA implementations, such as Backbone, Angular & React
Users
A collection of users
Fetch list of all users
get /users
Fetch list of all users
HTTP status code 200
Body
Type: application/json
Schema:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": 1
},
"firstName": {
"type": "string",
"faker": "name.firstName"
},
"lastName": {
"type": "string",
"faker": "name.lastName"
},
"emailAddress": {
"type": "string",
"faker": "internet.email"
},
"userName": {
"type": "string",
"faker": "internet.userName"
},
"createdAt": {
"type": "string",
"faker": "date.past"
},
"updatedAt": {
"type": "string",
"faker": "date.past"
}
},
"required": [
"id",
"firstName",
"lastName",
"emailAddress",
"userName",
"createdAt",
"updatedAt"
]
}
}
Example:
[
{
"id": 10,
"firstName": "Ringo",
"lastName": "Starr",
"emailAddress": "george.harrison@beattles.com",
"userName": "rs",
"createdAt": "1940-07-07 06:03:07",
"updatedAt": "2013-03-04 07:03:18"
},
{
"id": 11,
"firstName": "George",
"lastName": "Harrison",
"emailAddress": "george.harrison@beattles.com",
"userName": "gh",
"createdAt": "1943-02-25 06:59:38",
"updatedAt": "2001-11-29 03:07:18"
},
{
"id": 12,
"firstName": "Paul",
"lastName": "McCartney",
"emailAddress": "paul.mccartney@beattles.com",
"userName": "pmc",
"createdAt": "1942-06-18 06:38:59",
"updatedAt": "2015-07-02 21:18:07"
},
{
"id": 13,
"firstName": "John",
"lastName": "Lennon",
"emailAddress": "jonh.lennon@beattles.com",
"userName": "jl",
"createdAt": "1940-10-09 19:22:26",
"updatedAt": "1980-12-08 13:17:25"
}
]
Fetch a single users by id
get /users/{id}
Fetch a single users by id
URI Parameters
- User ID: required (integer)
HTTP status code 200
Body
Type: application/json
Schema:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": 1
},
"firstName": {
"type": "string",
"faker": "name.firstName"
},
"lastName": {
"type": "string",
"faker": "name.lastName"
},
"emailAddress": {
"type": "string",
"faker": "internet.email"
},
"userName": {
"type": "string",
"faker": "internet.userName"
},
"createdAt": {
"type": "string",
"faker": "date.past"
},
"updatedAt": {
"type": "string",
"faker": "date.past"
}
},
"required": [
"id",
"firstName",
"lastName",
"emailAddress",
"userName",
"createdAt",
"updatedAt"
]
}
Example:
{
"id": 13,
"firstName": "John",
"lastName": "Lennon",
"emailAddress": "john.lennon@beattles.com",
"userName": "jl",
"createdAt": "1940-10-09 19:22:26",
"updatedAt": "1980-12-08 13:17:25"
}
Categories
Categories of incomes and outcomes used throughout the system
Fetch list of all income categories
get /categories/incomes
Fetch list of all income categories
HTTP status code 200
Body
Type: application/json
Schema:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "array",
"items": {
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": 1
},
"parentId": {
"oneOf": [{
"type": "null"
}, {
"type": "integer",
"minimum": 1
}]
},
"name": {
"type": "string",
"faker": {
"fake": "{{company.bsBuzz}} {{company.bsAdjective}} {{company.bsNoun}}"
}
},
"createdAt": {
"type": "string",
"faker": "date.past"
},
"updatedAt": {
"type": "string",
"faker": "date.past"
}
},
"required": [
"id",
"parentId",
"name",
"createdAt",
"updatedAt"
]
}
}
Example:
[
{
"id": 1,
"parentId": null,
"name": "salaries",
"createdAt": "2011-10-26 17:44:22",
"updatedAt": "2011-10-26 17:44:22"
},
{
"id": 2,
"parentId": 1,
"name": "regular salary",
"createdAt": "2011-10-26 17:45:41",
"updatedAt": "2011-10-26 17:45:41"
},
{
"id": 3,
"parentId": 1,
"name": "bonuses",
"createdAt": "2011-10-26 17:46:16",
"updatedAt": "2011-10-26 17:46:16"
}
]
Fetch a single income category by id
get /categories/incomes/{id}
Fetch a single income category by id
URI Parameters
- Income Category ID: required (integer)
HTTP status code 200
Body
Type: application/json
Schema:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": 1
},
"parentId": {
"oneOf": [{
"type": "null"
}, {
"type": "integer",
"minimum": 1
}]
},
"name": {
"type": "string",
"faker": {
"fake": "{{company.bsBuzz}} {{company.bsAdjective}} {{company.bsNoun}}"
}
},
"createdAt": {
"type": "string",
"faker": "date.past"
},
"updatedAt": {
"type": "string",
"faker": "date.past"
}
},
"required": [
"id",
"parentId",
"name",
"createdAt",
"updatedAt"
]
}
Example:
{
"id": 1,
"parentId": null,
"name": "salaries",
"createdAt": "2011-10-26 17:44:22",
"updatedAt": "2011-10-26 17:44:22"
}
Fetch list of all outcome categories
get /categories/outcomes
Fetch list of all outcome categories
HTTP status code 200
Body
Type: application/json
Schema:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "array",
"items": {
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": 1
},
"parentId": {
"oneOf": [{
"type": "null"
}, {
"type": "integer",
"minimum": 1
}]
},
"name": {
"type": "string",
"faker": {
"fake": "{{company.bsBuzz}} {{company.bsAdjective}} {{company.bsNoun}}"
}
},
"createdAt": {
"type": "string",
"faker": "date.past"
},
"updatedAt": {
"type": "string",
"faker": "date.past"
}
},
"required": [
"id",
"parentId",
"name",
"createdAt",
"updatedAt"
]
}
}
Example:
[
{
"id": 1,
"parentId": null,
"name": "salaries",
"createdAt": "2011-10-26 17:44:22",
"updatedAt": "2011-10-26 17:44:22"
},
{
"id": 2,
"parentId": 1,
"name": "regular salary",
"createdAt": "2011-10-26 17:45:41",
"updatedAt": "2011-10-26 17:45:41"
},
{
"id": 3,
"parentId": 1,
"name": "bonuses",
"createdAt": "2011-10-26 17:46:16",
"updatedAt": "2011-10-26 17:46:16"
}
]
Fetch a single income category by id
get /categories/outcomes/{id}
Fetch a single income category by id
URI Parameters
- Outcome Category ID: required (integer)
HTTP status code 200
Body
Type: application/json
Schema:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": 1
},
"parentId": {
"oneOf": [{
"type": "null"
}, {
"type": "integer",
"minimum": 1
}]
},
"name": {
"type": "string",
"faker": {
"fake": "{{company.bsBuzz}} {{company.bsAdjective}} {{company.bsNoun}}"
}
},
"createdAt": {
"type": "string",
"faker": "date.past"
},
"updatedAt": {
"type": "string",
"faker": "date.past"
}
},
"required": [
"id",
"parentId",
"name",
"createdAt",
"updatedAt"
]
}
Example:
{
"id": 1,
"parentId": null,
"name": "salaries",
"createdAt": "2011-10-26 17:44:22",
"updatedAt": "2011-10-26 17:44:22"
}
Incomes
A collection of incomes (money earned)
Fetch list of all incomes (might be very long)
Create an income
get /incomes
Fetch list of all incomes (might be very long)
HTTP status code 200
Body
Type: application/json
Schema:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": 1
},
"categoryId": {
"type": "integer",
"minimum": 1
},
"amount": {
"type": "number",
"faker": "finance.amount"
},
"description": {
"type": "string"
},
"createdAt": {
"type": "string",
"faker": "date.past"
},
"createdBy": {
"type": "integer",
"minimum": 1
}
},
"required": [
"id",
"categoryId",
"amount",
"description",
"createdAt",
"createdBy"
]
}
}
Example:
[
{
"id": 1,
"categoryId": 35,
"amount": 5462.84,
"description": "selling first singles",
"createdAt": "1961-08-10 00:00:00",
"createdBy": 13
},
{
"id": 2,
"categoryId": 36,
"amount": 346.82,
"description": "first audio recording profit",
"createdAt": "1957-02-21 00:00:00",
"createdBy": 14
},
{
"id": 3,
"categoryId": 37,
"amount": 8934.61,
"description": "Sgt. Peppers charity meeting",
"createdAt": "1967-08-10 00:00:00",
"createdBy": 13
}
]
post /incomes
Create an income
Body
Type: application/json
Schema:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": 1
},
"categoryId": {
"type": "integer",
"minimum": 1
},
"amount": {
"type": "number",
"faker": "finance.amount"
},
"description": {
"type": "string"
},
"createdAt": {
"type": "string",
"faker": "date.past"
},
"createdBy": {
"type": "integer",
"minimum": 1
}
},
"required": [
"id",
"categoryId",
"amount",
"description",
"createdAt",
"createdBy"
]
}
Example:
{
"id": 1,
"categoryId": 35,
"amount": 5462.84,
"description": "salary august 2011",
"createdAt": "2011-08-10 00:00:00",
"createdBy": 13
}
Fetch a single income by id
Update a single income by id
Delete a single income by id
get /incomes/{id}
Fetch a single income by id
URI Parameters
- Income ID: required (integer)
HTTP status code 200
Body
Type: application/json
Schema:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": 1
},
"categoryId": {
"type": "integer",
"minimum": 1
},
"amount": {
"type": "number",
"faker": "finance.amount"
},
"description": {
"type": "string"
},
"createdAt": {
"type": "string",
"faker": "date.past"
},
"createdBy": {
"type": "integer",
"minimum": 1
}
},
"required": [
"id",
"categoryId",
"amount",
"description",
"createdAt",
"createdBy"
]
}
Example:
{
"id": 1,
"categoryId": 35,
"amount": 5462.84,
"description": "salary august 2011",
"createdAt": "2011-08-10 00:00:00",
"createdBy": 13
}
put /incomes/{id}
Update a single income by id
URI Parameters
- Income ID: required (integer)
Body
Type: application/json
Schema:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": 1
},
"categoryId": {
"type": "integer",
"minimum": 1
},
"amount": {
"type": "number",
"faker": "finance.amount"
},
"description": {
"type": "string"
},
"createdAt": {
"type": "string",
"faker": "date.past"
},
"createdBy": {
"type": "integer",
"minimum": 1
}
},
"required": [
"id",
"categoryId",
"amount",
"description",
"createdAt",
"createdBy"
]
}
Example:
{
"id": 1,
"categoryId": 35,
"amount": 5462.84,
"description": "salary august 2011",
"createdAt": "2011-08-10 00:00:00",
"createdBy": 13
}
Outcomes
A collection of outcomes (money spent)
Fetch list of all outcomes (might be very long)
Create an outcome
get /outcomes
Fetch list of all outcomes (might be very long)
HTTP status code 200
Body
Type: application/json
Schema:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": 1
},
"categoryId": {
"type": "integer",
"minimum": 1
},
"amount": {
"type": "number",
"faker": "finance.amount"
},
"description": {
"type": "string"
},
"createdAt": {
"type": "string",
"faker": "date.past"
},
"createdBy": {
"type": "integer",
"minimum": 1
}
},
"required": [
"id",
"categoryId",
"amount",
"description",
"createdAt",
"createdBy"
]
}
}
Example:
[
{
"id": 1,
"categoryId": 35,
"amount": 5462.84,
"description": "selling first singles",
"createdAt": "1961-08-10 00:00:00",
"createdBy": 13
},
{
"id": 2,
"categoryId": 36,
"amount": 346.82,
"description": "first audio recording profit",
"createdAt": "1957-02-21 00:00:00",
"createdBy": 14
},
{
"id": 3,
"categoryId": 37,
"amount": 8934.61,
"description": "Sgt. Peppers charity meeting",
"createdAt": "1967-08-10 00:00:00",
"createdBy": 13
}
]
post /outcomes
Create an outcome
Body
Type: application/json
Schema:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": 1
},
"categoryId": {
"type": "integer",
"minimum": 1
},
"amount": {
"type": "number",
"faker": "finance.amount"
},
"description": {
"type": "string"
},
"createdAt": {
"type": "string",
"faker": "date.past"
},
"createdBy": {
"type": "integer",
"minimum": 1
}
},
"required": [
"id",
"categoryId",
"amount",
"description",
"createdAt",
"createdBy"
]
}
Example:
{
"id": 1,
"categoryId": 35,
"amount": 5462.84,
"description": "salary august 2011",
"createdAt": "2011-08-10 00:00:00",
"createdBy": 13
}
Fetch a single outcome by id
Update a single outcome by id
Delete a single outcome by id
get /outcomes/{id}
Fetch a single outcome by id
URI Parameters
- Outcome ID: required (integer)
HTTP status code 200
Body
Type: application/json
Schema:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": 1
},
"categoryId": {
"type": "integer",
"minimum": 1
},
"amount": {
"type": "number",
"faker": "finance.amount"
},
"description": {
"type": "string"
},
"createdAt": {
"type": "string",
"faker": "date.past"
},
"createdBy": {
"type": "integer",
"minimum": 1
}
},
"required": [
"id",
"categoryId",
"amount",
"description",
"createdAt",
"createdBy"
]
}
Example:
{
"id": 1,
"categoryId": 35,
"amount": 5462.84,
"description": "salary august 2011",
"createdAt": "2011-08-10 00:00:00",
"createdBy": 13
}
put /outcomes/{id}
Update a single outcome by id
URI Parameters
- Outcome ID: required (integer)
Body
Type: application/json
Schema:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": 1
},
"categoryId": {
"type": "integer",
"minimum": 1
},
"amount": {
"type": "number",
"faker": "finance.amount"
},
"description": {
"type": "string"
},
"createdAt": {
"type": "string",
"faker": "date.past"
},
"createdBy": {
"type": "integer",
"minimum": 1
}
},
"required": [
"id",
"categoryId",
"amount",
"description",
"createdAt",
"createdBy"
]
}
Example:
{
"id": 1,
"categoryId": 35,
"amount": 5462.84,
"description": "salary august 2011",
"createdAt": "2011-08-10 00:00:00",
"createdBy": 13
}