Cheese Store API Reference
Welcome to the sample Cheese Store API reference. This is a live example of how you can use Spectacle in conjunction with an OpenAPI Specification v2 (fka Swagger specification) to generate beautiful static documentation for your own APIs.
The Cheese Store API is organized around the
REST mothodology, and it uses resource-oriented URLs, and common HTTP response codes to indicate API errors. All requests are authenticated using an api-key
which can be obtained from your developer dashboard. And now, more cheese...
Hard cheese gouda say cheese. Ricotta cauliflower cheese cheesecake bocconcini edam bocconcini fromage feta. Who moved my cheese bocconcini cheese and wine cottage cheese cheese on toast who moved my cheese caerphilly stinking bishop. Bocconcini cheesy feet the big cheese macaroni cheese cheesy feet mascarpone.
API Endpoint
https://cheesy.sourcey.com/v1
Terms of Service: http://cheesy.sourcey.com/terms
Contact: cheesy@sourcey.com
Schemes: http, https
Version: 1.0.0
Authentication
cheesy_auth
api_key
Cheese
Cheese methods provide access to information and operations relating to the cheese available in the store.
Add a new cheese to the store
Cheese object to be added to the store
Request Example
{
"id": 1,
"category": {
"id": 1,
"name": "Italian Cheese"
},
"name": "Gorgonzola",
"photoUrls": [
"https://wannabechef.com/gorgonzola.jpg"
],
"tags": [
{
"id": 1,
"name": "Manchego"
}
],
"status": "available"
}
Successful operation
Invalid input
Response Example (200 OK)
{
"id": 1,
"category": {
"id": 1,
"name": "Italian Cheese"
},
"name": "Gorgonzola",
"photoUrls": [
"https://wannabechef.com/gorgonzola.jpg"
],
"tags": [
{
"id": 1,
"name": "Manchego"
}
],
"status": "available"
}
Response Example (422 Unprocessable Entity)
{
"code": 422,
"type": "Validation error",
"message": "Your cheese is not mouldy enough"
}
cheesy_auth | write:cheeses , read:cheeses |
Update an existing cheese
Cheese object that needs to be updated
Request Example
{
"id": 1,
"category": {
"id": 1,
"name": "Italian Cheese"
},
"name": "Gorgonzola",
"photoUrls": [
"https://wannabechef.com/gorgonzola.jpg"
],
"tags": [
{
"id": 1,
"name": "Manchego"
}
],
"status": "available"
}
Cheese not found
Validation exception
Response Example (404 Not Found)
{
"code": 404,
"type": "Not found",
"message": "Your cheese has already been eaten"
}
Response Example (422 Unprocessable Entity)
{
"code": 422,
"type": "Validation error",
"message": "Your cheese is not mouldy enough"
}
cheesy_auth | write:cheeses , read:cheeses |
Finds cheeses by tags
Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
Tags to filter by
tags=aaa&tags=bbb
)Successful operation
Invalid tag value
Response Example (200 OK)
[
{
"id": 1,
"category": {
"id": 1,
"name": "Italian Cheese"
},
"name": "Gorgonzola",
"photoUrls": [
"https://wannabechef.com/gorgonzola.jpg"
],
"tags": [
{
"id": 1,
"name": "Manchego"
}
],
"status": "available"
}
]
Response Example (404 Not Found)
{
"code": 404,
"type": "Not found",
"message": "Your cheese has already been eaten"
}
cheesy_auth | write:cheeses , read:cheeses |
Find cheese by ID
Return a specific cheese by it's ID.
ID of cheese to return
Successful operation
Cheese not found
Response Example (200 OK)
{
"id": 1,
"category": {
"id": 1,
"name": "Italian Cheese"
},
"name": "Gorgonzola",
"photoUrls": [
"https://wannabechef.com/gorgonzola.jpg"
],
"tags": [
{
"id": 1,
"name": "Manchego"
}
],
"status": "available"
}
Response Example (404 Not Found)
{
"code": 404,
"type": "Not found",
"message": "Your cheese has already been eaten"
}
Update a cheese
Updates a cheese in the Store with form data.
ID of the cheese to be updated
Updated name of the cheese
Updated status of the cheese
Cannot update cheese
Response Example (422 Unprocessable Entity)
{
"code": 422,
"type": "Validation error",
"message": "Your cheese is not mouldy enough"
}
cheesy_auth | write:cheeses , read:cheeses |
Deletes a cheese
(no description)
Cheese ID to delete
Cheese not found
Response Example (404 Not Found)
{
"code": 404,
"type": "Not found",
"message": "Your cheese has already been eaten"
}
cheesy_auth | write:cheeses , read:cheeses |
Finds cheeses by status
Multiple status values can be provided with comma separated strings.
Status values that need to be considered for filter
status=aaa&status=bbb
)Successful operation
Invalid status value
Response Example (200 OK)
[
{
"id": 1,
"category": {
"id": 1,
"name": "Italian Cheese"
},
"name": "Gorgonzola",
"photoUrls": [
"https://wannabechef.com/gorgonzola.jpg"
],
"tags": [
{
"id": 1,
"name": "Manchego"
}
],
"status": "available"
}
]
Response Example (404 Not Found)
{
"code": 404,
"type": "Not found",
"message": "Your cheese has already been eaten"
}
cheesy_auth | write:cheeses , read:cheeses |
Upload a cheese image
ID of cheese to update
Additional data to pass to server
Image file to upload
Successful operation
Response Example (200 OK)
{
"id": 1,
"category": {
"id": 1,
"name": "Italian Cheese"
},
"name": "Gorgonzola",
"photoUrls": [
"https://wannabechef.com/gorgonzola.jpg"
],
"tags": [
{
"id": 1,
"name": "Manchego"
}
],
"status": "available"
}
cheesy_auth | write:cheeses , read:cheeses |
Store
Store methods provide access to cheese store orders.
Return cheese inventories by available status
Returns a list of available cheeses.
Successful operation
Response Example (200 OK)
[
{
"id": 1,
"category": {
"id": 1,
"name": "Italian Cheese"
},
"name": "Gorgonzola",
"photoUrls": [
"https://wannabechef.com/gorgonzola.jpg"
],
"tags": [
{
"id": 1,
"name": "Manchego"
}
],
"status": "available"
}
]
Place a cheese order
Place an order to purchase cheese from the store.
Order to place for purchasing the cheese.
Request Example
{
"cheeseId": "1",
"complete": "true",
"id": "1",
"quantity": "66",
"shipDate": "04-10-2017 00:09:21 UTC",
"status": "available"
}
Successful operation
Invalid order
Response Example (200 OK)
{
"cheeseId": "1",
"complete": "true",
"id": "1",
"quantity": "66",
"shipDate": "04-10-2017 00:09:21 UTC",
"status": "available"
}
Response Example (422 Unprocessable Entity)
{
"code": 422,
"type": "Validation error",
"message": "Your cheese is not mouldy enough"
}
Find purchase order by ID
For valid response try integer IDs with value >= 1 and <= 10. Other values will generate exceptions.
ID of cheese that needs to be fetched
Successful operation
Order not found
Response Example (200 OK)
{
"cheeseId": "1",
"complete": "true",
"id": "1",
"quantity": "66",
"shipDate": "04-10-2017 00:09:21 UTC",
"status": "available"
}
Response Example (404 Not Found)
{
"code": 404,
"type": "Not found",
"message": "Your cheese has already been eaten"
}
Delete purchase order by ID
For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors.
ID of the order that needs to be deleted
Order not found
Response Example (404 Not Found)
{
"code": 404,
"type": "Not found",
"message": "Your cheese has already been eaten"
}
Customer
Customer methods contain operations relating to customer accounts.
Create customer account
This can only be done by the logged in customer.
Created customer object
Request Example
{
"id": 1,
"username": "gordo",
"firstName": "Alotta",
"lastName": "Cheese",
"email": "love@cheese.com",
"password": "secret",
"phone": "+3344556677",
"customerStatus": "obese"
}
Successful operation
Create multiple customers
Create a list of customers from the given input array.
List of created customer objects
Request Example
[
{
"id": 1,
"username": "gordo",
"firstName": "Alotta",
"lastName": "Cheese",
"email": "love@cheese.com",
"password": "secret",
"phone": "+3344556677",
"customerStatus": "obese"
}
]
Successful operation
Customer login
Log a customer into the system and create a new user session.
The username for login
The password for login in clear text
Successful operation
Invalid username/password supplied
Response Example (200 OK)
"string"
Response Example (422 Unprocessable Entity)
{
"code": 422,
"type": "Validation error",
"message": "Your cheese is not mouldy enough"
}
Customer logout
Log the currently the authenticated customer out of the system and end the user session.
Successful operation
Get customer by username
Get customer by their customer username.
The username of the customer to be fetched.
Successful operation
Customer not found
Response Example (200 OK)
{
"id": 1,
"username": "gordo",
"firstName": "Alotta",
"lastName": "Cheese",
"email": "love@cheese.com",
"password": "secret",
"phone": "+3344556677",
"customerStatus": "obese"
}
Response Example (404 Not Found)
{
"code": 404,
"type": "Not found",
"message": "Your cheese has already been eaten"
}
Update customer
This can only be done by the logged in customer.
Customer object to be updated.
Username of the customer to update.
Request Example
{
"id": 1,
"username": "gordo",
"firstName": "Alotta",
"lastName": "Cheese",
"email": "love@cheese.com",
"password": "secret",
"phone": "+3344556677",
"customerStatus": "obese"
}
Invalid customer supplied
Customer not found
Response Example (404 Not Found)
{
"code": 404,
"type": "Not found",
"message": "Your cheese has already been eaten"
}
Delete customer
Datate a customer by their username.
Username of the customer to delete.
Invalid username supplied
Customer not found
Response Example (404 Not Found)
{
"code": 404,
"type": "Not found",
"message": "Your cheese has already been eaten"
}
Schema Definitions
Order: object
- id: integer (int64)
- cheeseId: integer (int64)
- quantity: integer (int32)
- shipDate: string (date-time)
- status: string , x ∈ { placed , approved , delivered }
-
Order Status
- complete: boolean
Example
{
"cheeseId": "1",
"complete": "true",
"id": "1",
"quantity": "66",
"shipDate": "04-10-2017 00:09:21 UTC",
"status": "available"
}
Customer: object
- id: integer (int64)
- username: string
- firstName: string
-
Customer first name
- lastName: string
-
Customer last name
- email: string
- password: string
- phone: string
- customerStatus: string , x ∈ { skinny , average , fat , obese }
-
Customer status (the heavier the better)
Example
{
"id": 1,
"username": "gordo",
"firstName": "Alotta",
"lastName": "Cheese",
"email": "love@cheese.com",
"password": "secret",
"phone": "+3344556677",
"customerStatus": "obese"
}
Error: object
- code: integer (int32)
- type: string
- message: string
Example
{
"code": "integer (int32)",
"type": "No cheese found",
"message": "No cheese for you!"
}
ValidationError: object
- code: integer (int32)
- type: string
- message: string
Example
{
"code": 422,
"type": "Validation error",
"message": "Your cheese is not mouldy enough"
}
NotFoundError: object
- code: integer (int32)
- type: string
- message: string
Example
{
"code": 404,
"type": "Not found",
"message": "Your cheese has already been eaten"
}
Cheese: object
- id: integer (int64)
- category: Category
- name: string
- photoUrls: string[]
- tags: object[]
- status: string , x ∈ { available , pending , sold }
-
Cheese status in the store
Example
{
"id": 1,
"category": {
"id": 1,
"name": "Italian Cheese"
},
"name": "Gorgonzola",
"photoUrls": [
"https://wannabechef.com/gorgonzola.jpg"
],
"tags": [
{
"id": 1,
"name": "Manchego"
}
],
"status": "available"
}