The front end team has been given a prototype API to help them implement their React application. The prototype is built similar to JSON Server and not a actual long-term solution for persisting and retrieving data. It's now your team's job to build a production ready API to replace the prototype.
If you complete all tickets in your backlog, you should have the following endpoints implemented.
Your front end developers are expecting data back from your API that looks exactly like what's listed below. If certain properties don't match, the client application will break. NOTE Don't worry about any differences in dummy data the prototype uses vs the data in your database. The only thing that is important is that the shape of each resource should match exactly.
To see examples from the prototype API you can use this base URL:
https://bangazon-prototype-api.herokuapp.com/
Description |
Endpoint |
Method |
Request Body |
Response Body |
Get all customers |
api/customers |
GET |
|
Customer Array |
Search for customer |
api/customers?q={someSearchTerm} |
GET |
|
Customer Array |
Get customer by Id |
api/customers/{id} |
GET |
|
Customer Object |
Get customer and include product listings |
api/customers/{id}?include=products |
GET |
|
Customer Object w/ Products Array |
Add a customer |
api/customers |
POST |
Customer Object |
Customer Object |
Update a customer |
api/customers/{id} |
PUT |
Customer Object |
Customer Object |
Make customer inactive |
api/customer/{id} |
DELETE |
|
|
Description |
Endpoint |
Method |
Request Body |
Response Body |
Get all payment types |
api/paymentTypes |
GET |
|
PaymentType Array |
Get payment type by id |
api/paymentTypes/{id} |
GET |
|
PaymentType Object |
Add new payment type |
api/paymentTypes |
POST |
PaymentType Object |
PaymentType Object |
Remove a payment type |
api/paymentTypes/{id} |
DELETE |
|
|
Description |
Endpoint |
Method |
Request Body |
Response Body |
Get a customer's payment options |
api/userPaymentTypes?customerId={customer id} |
GET |
|
UserPaymentType Array |
Add a payment option for customer |
api/userPaymentTypes |
POST |
UserPaymentType Object |
UserPaymentType Object |
Update customer payment option |
api/userPaymentTypes/{id} |
PUT |
UserPaymentType Object |
UserPaymentType Object |
Remove customer payment option |
api/userPaymentTypes/{id} |
DELETE |
|
|
Description |
Endpoint |
Method |
Request Body |
Response Body |
Get orders made by customer |
api/orders?customerId={customer Id} |
GET |
|
Order Array |
Get order by order ID |
api/orders/{id} |
GET |
|
Order Object |
Get customer's shopping cart |
api/orders?customerId={customerId}&cart=true |
GET |
|
Order Object w/ Product Array |
Add a product to shopping cart |
api/orders |
POST |
CustomerProduct Object |
Order Object |
Purchase order in cart** |
api/orders/{id} |
PUT |
Order Object** |
|
Remove product from cart |
api/orders/{orderId}/products{productId} |
DELETE |
|
|
* Order objects that have a payment method that isn't NULL are considered complete and processed. An order that does not have a payment type would be considered a user's shopping cart. A user can have only one shopping cart, and therefore will only have a maximum of one Order record in the database with a NULL payment type at a given time.
** To purchase an order, update the Order object's userPaymentId
property
Description |
Endpoint |
Method |
Request Body |
Response Body |
Get all product types |
api/productTypes |
GET |
|
ProductType Array |
Get product type by Id |
api/productTypes/{id} |
GET |
|
ProductType Object |
Get product type with products |
api/productTypes/{id}?include=products |
GET |
|
ProductType Array |
Add a product type |
api/productTypes |
POST |
ProductType Object |
ProductType Object |
Update a product type |
api/productTypes/{id} |
PUT |
ProductType Object |
ProductType Object |
Description |
Endpoint |
Method |
Request Body |
Response Body |
Get all employees |
api/employees |
GET |
|
Employee Array |
Get employee by Id |
api/employees/{id} |
GET |
|
Employee Object |
Search for employee by name |
api/employees?firstName=John&lastName=Smith |
GET |
|
Employee Array |
Add an employee |
api/employees |
POST |
Employee Object |
Employee Object |
Update an employee |
api/employees/{id} |
PUT |
Employee Object |
Employee Object |
Description |
Endpoint |
Method |
Request Body |
Response Body |
Get all departments |
api/departments |
GET |
|
Department Array |
Get department by Id |
api/departments/{id} |
GET |
|
Department Object |
Get department with employees |
api/departments/{id}?include=employees |
GET |
|
Department Array w/ Employees |
Add a department |
api/departments |
POST |
Department Object |
Department Object |
Update a department |
api/departments/{id} |
PUT |
Department Object |
Department Object |
Description |
Endpoint |
Method |
Request Body |
Response Body |
Get available computers |
api/computers?available=true |
GET |
|
Computer Array |
Get unavailable computers |
api/computers?available=false |
GET |
|
Computer Array |
Get computer by Id |
api/computers/{id} |
GET |
|
Computer Object |
Add computer |
api/computers |
POST |
Computer Object |
Computer Object |
Update computer record |
api/computers/{id} |
PUT |
Computer Object |
Computer Object |
Delete a computer record |
api/computers/{id} |
DELETE |
|
|
Description |
Endpoint |
Method |
Request Body |
Response Body |
Get upcoming training programs |
api/trainingPrograms |
GET |
|
TrainingProgram Array |
Get training program by Id |
api/trainingPrograms/{id} |
GET |
|
TrainingProgram Object w/ Employees |
Add training program |
api/trainingPrograms |
POST |
TrainingProgram Object |
Training Program Object |
Add employee to training program |
api/trainingPrograms/{id}/employees |
POST |
Employee Object |
TrainingProgram Object w/ Employees |
Update training program |
api/trainingPrograms/{id} |
PUT |
TrainingProgram Object |
TrainingProgram Object |
Remove training program |
api/trainingPrograms/{id} |
DELETE |
|
|
Remove employee from program |
api/trainingPrograms/{id}/employees/{employeeId} |
DELETE |
|
|
Description |
Endpoint |
Method |
Request Body |
Response Body |
Get revenue by product type |
api/revenueReport |
GET |
|
RevenueReport Array |
NOTE: All resource id's will be generated by the database. There is no need for your javascript code to ever create an id itself. The same goes for createdDate
and dateAdded
properties on Order and Product. These values will be set to the current timestamp by the server
{
"id": 1575559407787,
"active": true,
"createdDate": "2019-08-25T00:00:00.000Z",
"firstName": "Nathanael",
"lastName": "Laverenz",
"address": "401 Nunya Business Dr",
"city": "Herman",
"state": "New York",
"email": "[email protected]",
"phone": "6151237584"
}
{
"id": 1575559407733,
"active": true,
"createdDate": "2019-08-25T00:00:00.000Z",
"firstName": "Kimble",
"lastName": "Peskett",
"address": "508 Loop Cir",
"city": "Nashville",
"state": "Tennessee",
"email": "[email protected]",
"phone": "5671234567",
"products": [
{
"id": 15755594079866,
"productTypeId": 1575501970047,
"customerId": 1575559407733,
"price": 76.91,
"description": "morbi ut odio cras mi pede malesuada in imperdiet et commodo",
"title": "Passat",
"dateAdded": "2019-08-25T00:00:00.000Z"
},
{
"productTypeId": 1575559407749,
"customerId": 1575559407733,
"price": 79.92,
"description": "semper rutrum nulla nunc purus phasellus in felis donec semper sapien a libero",
"title": "Santa Fe",
"dateAdded": "2019-09-25T00:00:00.000Z",
"id": 1575669305071
}
]
}
{
"id": 15755594079867,
"productTypeId": 1575501970045,
"customerId": 1575559407755,
"price": 62.54,
"description": "pede ullamcorper augue a suscipit nulla elit ac nulla sed",
"title": "Murciélago LP640",
"dateAdded": "2018-12-25T00:00:00.000Z"
}
{
"id": 1575501974871,
"name": "Mastercard",
"active": true
}
{
"id": 1575501978463,
"customerId": 1575559407787,
"paymentTypeId": 1575501974871,
"acctNumber": "2234 56789 0123",
"active": true
}
{
"id": 1575559407665,
"customerId": 1575559407787,
"userPaymentId": null
}
{
"customerId": 1575559407787,
"productId": 1575501970208
}
{
"id": 1575501970045,
"name": "Accessories"
}
{
"id": 1575501974625,
"firstName": "Madi",
"lastName": "Peper",
"departmentId": 1575559403193,
"isSupervisor": true,
"computerId": 1575566566334,
"email": "[email protected]"
}
{
"id": 1575559403194,
"name": "Accounting",
"budget": 1230000
}
{
"id": 1575566566333,
"purchaseDate": "2016-01-01T23:28:56.782Z",
"decomissionDate": null,
"make": "Apple",
"model": "Macbook Pro"
}
{
"id": 1575559403194,
"name": "GIS Application",
"startDate": "2018-09-25T00:00:00.000Z",
"endDate": "2018-10-05T00:00:00.000Z",
"maxAttendees": 45
}
{
"productTypeId": 1575501970829,
"productType": "Filters",
"totalRevenue": 158.64
}