title | language_tabs | toc_footers | includes | search | highlight_theme | headingLevel | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Swagger Petstore |
|
true |
darkula |
2 |
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
Base URLs:
License: MIT
Code samples
# You can also use wget
curl -X GET https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets \
-H 'Accept: application/json'
GET https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets HTTP/1.1
Host: g6pny6dke9.execute-api.us-west-2.amazonaws.com
Accept: application/json
var headers = {
'Accept':'application/json'
};
$.ajax({
url: 'https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets',
method: 'get',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json'
};
fetch('https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets', params={
}, headers = headers)
print r.json()
URL obj = new URL("https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /pets
List all pets
Name | In | Type | Required | Description |
---|---|---|---|---|
limit | query | integer(int32) | false | How many items to return at one time (default 100) |
Example responses
200 Response
{
"items": [
{
"id": "string",
"name": "string",
"species": "string",
"age": 0
}
]
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | An array of pets | PetList |
Code samples
# You can also use wget
curl -X POST https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
POST https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets HTTP/1.1
Host: g6pny6dke9.execute-api.us-west-2.amazonaws.com
Content-Type: application/json
Accept: application/json
var headers = {
'Content-Type':'application/json',
'Accept':'application/json'
};
$.ajax({
url: 'https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets',
method: 'post',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const inputBody = '{
"name": "string",
"species": "string",
"age": 0
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json'
};
fetch('https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}
result = RestClient.post 'https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
r = requests.post('https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets', params={
}, headers = headers)
print r.json()
URL obj = new URL("https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /pets
Create a Pet
Body parameter
{
"name": "string",
"species": "string",
"age": 0
}
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | CreatePetRequest | true | none |
Example responses
200 Response
{
"id": "string",
"name": "string",
"species": "string",
"age": 0
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Expected response to a valid request | Pet |
400 | Bad Request | Bad Request | None |
500 | Internal Server Error | Internal Server Error | None |
Code samples
# You can also use wget
curl -X GET https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets/{petId} \
-H 'Accept: application/json'
GET https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets/{petId} HTTP/1.1
Host: g6pny6dke9.execute-api.us-west-2.amazonaws.com
Accept: application/json
var headers = {
'Accept':'application/json'
};
$.ajax({
url: 'https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets/{petId}',
method: 'get',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json'
};
fetch('https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets/{petId}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets/{petId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets/{petId}', params={
}, headers = headers)
print r.json()
URL obj = new URL("https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets/{petId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets/{petId}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /pets/{petId}
Info for a specific pet
Name | In | Type | Required | Description |
---|---|---|---|---|
petId | path | string | true | The id of the pet to retrieve |
Example responses
200 Response
{
"id": "string",
"name": "string",
"species": "string",
"age": 0
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Expected response to a valid request | Pet |
404 | Not Found | Not found | None |
Code samples
# You can also use wget
curl -X DELETE https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets/{petId}
DELETE https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets/{petId} HTTP/1.1
Host: g6pny6dke9.execute-api.us-west-2.amazonaws.com
$.ajax({
url: 'https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets/{petId}',
method: 'delete',
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
fetch('https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets/{petId}',
{
method: 'DELETE'
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
result = RestClient.delete 'https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets/{petId}',
params: {
}
p JSON.parse(result)
import requests
r = requests.delete('https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets/{petId}', params={
)
print r.json()
URL obj = new URL("https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets/{petId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("DELETE", "https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets/{petId}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
DELETE /pets/{petId}
Delete a Pet
Name | In | Type | Required | Description |
---|---|---|---|---|
petId | path | string | true | The id of the pet to delete |
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | ok | None |
404 | Not Found | Not found | None |
Code samples
# You can also use wget
curl -X PATCH https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets/{petId} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
PATCH https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets/{petId} HTTP/1.1
Host: g6pny6dke9.execute-api.us-west-2.amazonaws.com
Content-Type: application/json
Accept: application/json
var headers = {
'Content-Type':'application/json',
'Accept':'application/json'
};
$.ajax({
url: 'https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets/{petId}',
method: 'patch',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const inputBody = '{
"name": "string",
"species": "string",
"age": 0
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json'
};
fetch('https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets/{petId}',
{
method: 'PATCH',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}
result = RestClient.patch 'https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets/{petId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
r = requests.patch('https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets/{petId}', params={
}, headers = headers)
print r.json()
URL obj = new URL("https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets/{petId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PATCH");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PATCH", "https://g6pny6dke9.execute-api.us-west-2.amazonaws.com/v1/api/pets/{petId}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
PATCH /pets/{petId}
Update a pet
Body parameter
{
"name": "string",
"species": "string",
"age": 0
}
Name | In | Type | Required | Description |
---|---|---|---|---|
petId | path | string | true | The id of the pet to update |
body | body | UpdatePetRequest | true | none |
Example responses
200 Response
{
"id": "string",
"name": "string",
"species": "string",
"age": 0
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Ok | Pet |
400 | Bad Request | Bad Request | None |
404 | Not Found | Not found | None |
500 | Internal Server Error | Internal Server Error | None |
{
"id": "string",
"name": "string",
"species": "string",
"age": 0
}
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | string | true | none | none |
name | string | true | none | none |
species | string | true | none | none |
age | integer | true | none | none |
{
"items": [
{
"id": "string",
"name": "string",
"species": "string",
"age": 0
}
]
}
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
items | [Pet] | true | none | none |
{
"name": "string",
"species": "string",
"age": 0
}
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
name | string | true | none | none |
species | string | true | none | none |
age | integer | true | none | none |
{
"name": "string",
"species": "string",
"age": 0
}
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
name | string | true | none | none |
species | string | true | none | none |
age | integer | true | none | none |