This wiki is provided as a writing sample.
Introduction
The Petstore Swagger API is a sample API which allows developers, technical writers, and other interested parties to explore the Swagger OpenAPI Specification (OAS).
This wiki will cover the following topics in regards to interacting with the Petstore API, based on Swagger (OpenAPI) version 2.0.
NOTE: The Petstore API is intended to be an interactive example of an implementation of OpenAPI v2.0. As such, it is not fully fleshed out in terms of business logic or functionality. Several suggestions may be offered in the User Manual about displaying results to the user, or implementing business logic that does not currently exist within the API.
Index
- Petstore Swagger v2.0 API Wiki
- Swagger - Check Order Status
- Swagger - Create a Pet
- Swagger - Get Store Inventory
- Swagger - Place an Order
- Swagger - Retrieve List of Pets by Status
- User Manual - Create a Pet
- User Manual - Create a Store
- User Manual - Place an Order
Resources
The following resources are documented in this wiki:
- Swagger - Create a Pet
- Swagger - Get Store Inventory
- Swagger - Place an Order
- Swagger - Check Order Status
- Swagger - Retrieve List of Pets by Status
The Petstore API offers the following resources:
Pet
The Pet resource allows manipulation of Pets in the store. This includes adding inventory, updating inventory, adding images, and searches by status or by ID.
Method | Endpoint | Description |
POST | /pet | Adds a new Pet to the store. |
POST | /pet/{petId} | Updates an existing Pet in the store with form data. |
POST | /pet/{petId}/uploadImage | Uploads an image for an existing Pet. |
PUT | /pet | Updates an existing Pet in the store. |
GET | /pet/findByStatus | Finds a list of Pets by Status. |
GET | /pet/{petId} | Finds a Pet by ID. |
DELETE | /pet/{petId} | Deletes a Pet from the store. |
Store
The Store resource allows for the manipulation of the store. The capabilities include retrieving an inventory, and creating, finding, and deleting a Purchase Order.
Method | Endpoint | Description |
POST | /store/order | Places a Purchase Order for a Pet. |
GET | /store/inventory | Retrieves the Pet Inventory from the store by status. |
GET | /store/order/{orderId} | Finds a Purchase Order by ID to check the status. |
DELETE | /store/order/{orderId} | Deletes an Purchase Order by ID. |
User
The User resource allows for the creation and manipulation of users. This includes creating a single or group of users, logging on or logging out of the system, and updating or deleting user profiles.
Method | Endpoint | Description |
POST | /user | Creates a single user. |
POST | /user/createWithArray | Creates a list of users from a provided array. |
POST | /user/createWithList | Creates a list of users from a provided array. |
GET | /user/login | Logs a user into the system. |
GET | /user/logout | Logs out the currently logged in user session. |
GET | /user/{username} | Gets user by username. |
PUT | /user/{username} | Updates a user by username. |
DELETE | /user/{username} | Deletes a user by username. |
User Manual
The following tutorials will guide a developer through some basic steps and workflows.
Workflows
References
- OpenAPI v2.0 (formerly known as Swagger RESTful API Documentation Specification) – https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md
- Petstore API – http://petstore.swagger.io/
- Petstore Sample JSON – http://petstore.swagger.io/v2/swagger.json