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](https://i0.wp.com/erichealdwebb.net/wp-content/uploads/2018/02/PurchasePet001.png?resize=317%2C235&ssl=1)
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.
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](https://i0.wp.com/erichealdwebb.net/wp-content/uploads/2018/02/PurchasePet002.png?resize=316%2C144&ssl=1)
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](https://i0.wp.com/erichealdwebb.net/wp-content/uploads/2018/02/PurchasePet003.png?resize=414%2C160&ssl=1)
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.
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. |
You must be logged in to post a comment.