Find purchase order by ID
1 min
GET
//petstore.swagger.io/v2/store/order/{orderId}
Path Parameters
- orderIdinteger<int64>requiredDescription
Responses
200
- Order
- idIdDescription
- petIdIdDescription
- quantityinteger<int32>Default1
- shipDatestring<date-time>Description
- statusstring<placed | approved | delivered>Description
- completebooleanDescriptionDefaultfalse
400
404
curl
curl --request GET \
--url //petstore.swagger.io/v2/store/order/{orderId} \
--header 'accept: application/json'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("//petstore.swagger.io/v2/store/order/{orderId}", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("//petstore.swagger.io/v2/store/order/{orderId}")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
response = http.request(request)
puts response.read_body
python
import requests
import json
url = "//petstore.swagger.io/v2/store/order/{orderId}"
payload = {}
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
200
// successful operation
{
"id": 0,
"petId": 0,
"quantity": "",
"shipDate": "",
"status": "",
"complete": false
}400
// Invalid ID supplied
404
// Order not found
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions