Web Services - tboonma/pet-care-management GitHub Wiki
Pat Care Management API
Welcome to the Pet Care Management Web API! Our API is based on JSON-based API.
Common Components
Response status codes
| Status code | Description |
|---|---|
| 200 OK | The request succeeded. |
| 201 Created | The request succeeded, and a new resource was created as a result. |
| 202 Accepted | The request has been received but not yet acted upon. |
| 400 Bad Request | the server could not understand the request because of invalid syntax |
| 401 Unauthorized | the request has not been applied because the server requires user authentication. |
| 403 Forbidden | the client request has been rejected because the client does not have rights to access the content. |
| 404 Not Found | The server can not find the requested resource. |
| 500 Internal Server Error | The server has encountered a situation it does not know how to handle. |
Required Request headers
Authentication: bearer access token
Content-type: application/json
Request Examples
Get all pets in service
Request: GET /api/all-in-service
Header: basic header described above
Response status code: 200
Response Body:
[
{
"id": 1,
"name": "FooFoo",
"type": "Dog",
"gender": "Male",
"birthyear": 2017
},
{
"id": 2,
"name": "FeeFee",
"type": "Persian Cat",
"gender": "Male",
"birthyear": 2019
},
...
]
Get pet information by ID
Request: GET /api/get-pet-by-id
Header: basic header described above
Require owner permission or officer permission
Parameters:
petId (string): Pet identification number
Response status code: 200
Response Body:
{
"id": 2,
"name": "FeeFee",
"type": "Persian Cat",
"gender": "Male",
"birthyear": 2019
}
Search pet
Request: GET /api/search-pet
Header: basic header described above
Parameters:
pet_name (string): Pet name (optional)
owner_id (string): Owner identification string (optional)
pet_type (string): Pet category name (optional)
Response status code: 200
Response Body:
[
{
"id": 1,
"name": "FooFoo"
},
{
"id": 2,
"name": "FeeFee"
},
...
]
Make a Pet Care Service
Request: PUT /api/leave-pet
Header: basic header described above
Require owner permission or officer permission
Parameters:
petId (string): Pet identification number
Response status code: 200
Response Body:
{
"status": "complete",
"id": 3,
"name": "BuBu",
"type": "Persian Cat",
"gender": "Male",
"birthyear": 2020
}
Get list of all customers
Request: GET /api/all-customers
Header: basic header described above
Require officer permission
Response status code: 200
Response Body:
[
{
"id": 1,
"firstName": "Wachi",
"lastName": "Mahee",
"gender": "Male",
"address": "15 Siam, Bangkok, 16969",
"email": "[email protected]",
"phoneNumber": "0869696969"
},
{
"id": 1,
"firstName": "Koi",
"lastName": "Mahee",
"gender": "Female",
"address": "15 Siam, Bangkok, 16969",
"email": "[email protected]",
"phoneNumber": "0869696969"
},
...
]
Get pet information by ID
Request: GET /api/get-customer-by-id
Header: basic header described above
Require officer permission
Parameters:
customerId (string): Customer identification number
Response status code: 200
Response Body:
{
"id": 1,
"firstName": "Wachi",
"lastName": "Mahee",
"gender": "Male",
"address": "15 Siam, Bangkok, 16969",
"email": "[email protected]",
"phoneNumber": "0869696969"
}
Search for customer
Request: GET /api/search-customer
Header: basic header described above
Require officer permission
Parameters:
firstName (string): customer's first name (optional)
lastName (string): customer's last name (optional)
phone (string): customer's phone number (optional)
Response status code: 200
Response Body:
[
{
"id": 1,
"firstName": "Wachi",
"lastName": "Mahee",
},
{
"id": 2,
"firstName": "Koi",
"lastName": "Mahee",
},
...
]
Add new customer
Request: PUT /api/add-customer
Header: basic header described above
Require officer permission
Parameters:
firstName (string): Customer's first name
lastName (string): Customer's last name
gender (string): Customer's gender
address (string): Customer's full residential address
email (string): Customer's email
phoneNumber (string): Customer's phone number
Response status code: 200
Response Body:
[
"status": "complete",
"id": 1,
"firstName": "Wachi",
"lastName": "Mahee",
"gender": "Male",
"address": "15 Siam, Bangkok, 16969",
"email": "[email protected]",
"phoneNumber": "0869696969"
]