User Manual – Place an Order

Place an Order for a Pet and Check the Status

The Petstore API allows for order management through the /store endpoints.

Several steps will be involved. A user will want to view the inventory of available pets, place an order for a specific pet, and check on the status of his or her order.

View Inventory of Available Pets

In order to view the inventory of available pets, use the GET /pet/findByStatus Resource. The query used should be seeking the available status, for example,

curl -X GET "http://petstore.swagger.io/v2/pet/findByStatus?status=available" -H "accept: application/xml"

This could be the default query of a View Pets button on the main web page, for example.

When the XML response is returned, it can be filtered by other criteria, for example, by Category, Tag(s), or by Available Photos.

The filtered response should then be displayed to the user.

Place an Order for a Pet

To place an order for a particular pet, the display of pets should be accompanied by an Order button. This Order button should use the POST /store/order Resource. Depending on the Category assigned to the pet, a quantity field may be appropriate. For example, some fish or insects may be sold in quantity.

The POST /store/order request should include the associated PetID, along with the quantity value (sourced from either the user selected field, or defaulted to 1, as appropriate).

The response to the POST /store/order call will include an OrderID, which should be associated with the user’s account.

NOTE: The current implementation of the Petstore API does not automatically associate OrderIDs with UserIDs. This can be performed on the backend, or the development team can expand the API.

Once a user places an order, and if the OrderID is associated with a username, the order status can be checked.

Check the Order Status

To check the order status, for example, to confirm the order was successfully placed, the OrderID must be known. If this has been previously associated to the user account, this can be a simple matter of displaying all orders associated with the user and allowing the user to select one.

To check the order status, the GET /store/order/{orderId} Resource should be used. This resource takes a path parameter (orderId).

The response to the GET /store/order/{orderId} call includes a status and a shipDate field, both of which may be of interest to the user.

 


Return to the User Manual