Swagger – Place an Order

Place an Order

This wiki page covers the API interaction for the Swagger Petstore API when placing a new order for a Pet.

Model

The following image displays the model for the POST /store/order used to create an order using the Petstore API.

Purchase a Pet Model

Purchase a Pet Model

Parameters

Header Parameters

There are no Header Parameters for the POST /store/order call to the Petstore API.

Path Parameters

There are no Path Parameters for the POST /store/order call to the Petstore API.

Query String Parameters

There are no Query String Parameters for the POST /store/order call to the Petstore API.

Request Body Parameters

The Request Body Parameters are shown in the model figure above. They are further explained in the following table. The request body is formatted as a JSON file, as shown in the figure that follows the table.

Request Body Parameters for POST /store/order
Parameter Required? Data Type Description
id Optional integer Numerical ID for the individual purchase order.
petId Optional integer Numerical ID for the individual pet.
quantity Optional integer Number of pets to purchase.
shipDate Optional string A date-time variable that displays the shipment date.
status Optional string A status string limited to placed, approved, or delivered.
complete Optional boolean A true/false value which conveys whether the order is completed.

 

Purchase a Pet Sample Request

Purchase a Pet Sample Request

 

Sample Request

A sample Curl request is shown below, with most of the Parameters included.

curl -X POST "http://petstore.swagger.io/v2/store/order" -H "accept: application/xml" -H "Content-Type: application/json" -d "{ \"id\": 0, \"petId\": 9205439794349958996, \"quantity\": 1, \"shipDate\": \"2018-02-25T17:04:30.534Z\", \"status\": \"placed\", \"complete\": false}"

This should be removed.

 

Sample Response and Schema

The following figure displays a sample response to the curl request shown in the previous section.

Curl Request Sample Response

Curl Request Sample Response

This response is broken down in the table that follows. It shows a successful purchase order creation with the PetId 9205439794349958996.

POST /store/order Response Schema
Response Item Data Type Description
complete boolean A true/false value which conveys whether the order is completed.
id integer Numerical ID for the individual purchase order.
petId integer Numerical ID for the individual pet.
quantity integer Number of pets to purchase.
shipDate string A date-time variable that displays the shipment date.
status string A status string limited to placed, approved, or delivered.

 

Other Topics