Swagger Petstore v1.0.0
+Swagger Petstore v1.0.0
@@ -353,116 +330,111 @@Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
addPet
# You can also use wget
curl -X POST http://petstore.swagger.io/v2/pet \
- -H 'Content-Type: application/json' \
- -H 'Authorization: Bearer {access-token}'
+ -H 'Content-Type: application/json' \
+ -H 'Authorization: Bearer {access-token}'
-POST http://petstore.swagger.io/v2/pet HTTP/1.1
-Host: petstore.swagger.io
-Content-Type: application/json
+POST http://petstore.swagger.io/v2/pet HTTP/1.1
+Host: petstore.swagger.io
+Content-Type: application/json
-const inputBody = '{
- "id": 0,
- "category": {
- "id": 0,
- "name": "string"
+const inputBody = '{
+ "id": 0,
+ "category": {
+ "id": 0,
+ "name": "string"
},
- "name": "doggie",
- "photoUrls": [
- "string"
+ "name": "doggie",
+ "photoUrls": [
+ "string"
],
- "tags": [
+ "tags": [
{
- "id": 0,
- "name": "string"
+ "id": 0,
+ "name": "string"
}
],
- "status": "available"
-}';
+ "status": "available"
+}'
;
const headers = {
- 'Content-Type':'application/json',
- 'Authorization':'Bearer {access-token}'
+ 'Content-Type':'application/json',
+ 'Authorization':'Bearer {access-token}'
};
-fetch('http://petstore.swagger.io/v2/pet',
+fetch('http://petstore.swagger.io/v2/pet',
{
- method: 'POST',
+ method: 'POST',
body: inputBody,
headers: headers
})
-.then(function(res) {
- return res.json();
-}).then(function(body) {
- console.log(body);
+.then(function(res) {
+ return res.json();
+}).then(function(body) {
+ console.log(body);
});
-require 'rest-client'
-require 'json'
+require 'rest-client'
+require 'json'
headers = {
- 'Content-Type' => 'application/json',
- 'Authorization' => 'Bearer {access-token}'
+ 'Content-Type' => 'application/json',
+ 'Authorization' => 'Bearer {access-token}'
}
-result = RestClient.post 'http://petstore.swagger.io/v2/pet',
+result = RestClient.post 'http://petstore.swagger.io/v2/pet',
params: {
}, headers: headers
-p JSON.parse(result)
+p JSON.parse(result)
import requests
headers = {
- 'Content-Type': 'application/json',
- 'Authorization': 'Bearer {access-token}'
+ 'Content-Type': 'application/json',
+ 'Authorization': 'Bearer {access-token}'
}
-r = requests.post('http://petstore.swagger.io/v2/pet', headers = headers)
+r = requests.post('http://petstore.swagger.io/v2/pet', headers = headers)
-print(r.json())
+print(r.json())
-<?php
-
-require 'vendor/autoload.php';
-
-$headers = array(
- 'Content-Type' => 'application/json',
- 'Authorization' => 'Bearer {access-token}',
+ 'application/json',
+ 'Authorization' => 'Bearer {access-token}',
);
-$client = new \GuzzleHttp\Client();
+$client = new \GuzzleHttp\Client();
// Define array of request body.
-$request_body = array();
+$request_body = array();
try {
- $response = $client->request('POST','http://petstore.swagger.io/v2/pet', array(
- 'headers' => $headers,
- 'json' => $request_body,
+ $response = $client->request('POST','http://petstore.swagger.io/v2/pet', array(
+ 'headers' => $headers,
+ 'json' => $request_body,
)
);
- print_r($response->getBody()->getContents());
+ print_r($response->getBody()->getContents());
}
- catch (\GuzzleHttp\Exception\BadResponseException $e) {
+ catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
- print_r($e->getMessage());
+ print_r($e->getMessage());
}
// ...
-URL obj = new URL("http://petstore.swagger.io/v2/pet");
-HttpURLConnection con = (HttpURLConnection) obj.openConnection();
-con.setRequestMethod("POST");
-int responseCode = con.getResponseCode();
-BufferedReader in = new BufferedReader(
- new InputStreamReader(con.getInputStream()));
+URL obj = new URL("http://petstore.swagger.io/v2/pet");
+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) {
+StringBuffer response = new StringBuffer();
+while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
@@ -472,19 +444,19 @@ addPet
package main
import (
- "bytes"
- "net/http"
+ "bytes"
+ "net/http"
)
func main() {
- headers := map[string][]string{
- "Content-Type": []string{"application/json"},
- "Authorization": []string{"Bearer {access-token}"},
+ headers := map[string][]string{
+ "Content-Type": []string{"application/json"},
+ "Authorization": []string{"Bearer {access-token}"},
}
- data := bytes.NewBuffer([]byte{jsonReq})
- req, err := http.NewRequest("POST", "http://petstore.swagger.io/v2/pet", data)
+ data := bytes.NewBuffer([]byte{jsonReq})
+ req, err := http.NewRequest("POST", "http://petstore.swagger.io/v2/pet", data)
req.Header = headers
client := &http.Client{}
@@ -498,26 +470,26 @@ addPet
Body parameter
-{
- "id": 0,
- "category": {
- "id": 0,
- "name": "string"
- },
- "name": "doggie",
- "photoUrls": [
- "string"
- ],
- "tags": [
- {
- "id": 0,
- "name": "string"
- }
- ],
- "status": "available"
-}
-
-<?xml version="1.0" encoding="UTF-8" ?>
+{
+ "id": 0,
+ "category": {
+ "id": 0,
+ "name": "string"
+ },
+ "name": "doggie",
+ "photoUrls": [
+ "string"
+ ],
+ "tags": [
+ {
+ "id": 0,
+ "name": "string"
+ }
+ ],
+ "status": "available"
+}
+
+<?xml version="1.0" encoding="UTF-8" ?>
<Pet>
<id>0</id>
<category>
@@ -584,116 +556,111 @@ updatePet
# You can also use wget
curl -X PUT http://petstore.swagger.io/v2/pet \
- -H 'Content-Type: application/json' \
- -H 'Authorization: Bearer {access-token}'
+ -H 'Content-Type: application/json' \
+ -H 'Authorization: Bearer {access-token}'
-PUT http://petstore.swagger.io/v2/pet HTTP/1.1
-Host: petstore.swagger.io
-Content-Type: application/json
+PUT http://petstore.swagger.io/v2/pet HTTP/1.1
+Host: petstore.swagger.io
+Content-Type: application/json
-const inputBody = '{
- "id": 0,
- "category": {
- "id": 0,
- "name": "string"
+const inputBody = '{
+ "id": 0,
+ "category": {
+ "id": 0,
+ "name": "string"
},
- "name": "doggie",
- "photoUrls": [
- "string"
+ "name": "doggie",
+ "photoUrls": [
+ "string"
],
- "tags": [
+ "tags": [
{
- "id": 0,
- "name": "string"
+ "id": 0,
+ "name": "string"
}
],
- "status": "available"
-}';
+ "status": "available"
+}'
;
const headers = {
- 'Content-Type':'application/json',
- 'Authorization':'Bearer {access-token}'
+ 'Content-Type':'application/json',
+ 'Authorization':'Bearer {access-token}'
};
-fetch('http://petstore.swagger.io/v2/pet',
+fetch('http://petstore.swagger.io/v2/pet',
{
- method: 'PUT',
+ method: 'PUT',
body: inputBody,
headers: headers
})
-.then(function(res) {
- return res.json();
-}).then(function(body) {
- console.log(body);
+.then(function(res) {
+ return res.json();
+}).then(function(body) {
+ console.log(body);
});
-require 'rest-client'
-require 'json'
+require 'rest-client'
+require 'json'
headers = {
- 'Content-Type' => 'application/json',
- 'Authorization' => 'Bearer {access-token}'
+ 'Content-Type' => 'application/json',
+ 'Authorization' => 'Bearer {access-token}'
}
-result = RestClient.put 'http://petstore.swagger.io/v2/pet',
+result = RestClient.put 'http://petstore.swagger.io/v2/pet',
params: {
}, headers: headers
-p JSON.parse(result)
+p JSON.parse(result)
import requests
headers = {
- 'Content-Type': 'application/json',
- 'Authorization': 'Bearer {access-token}'
+ 'Content-Type': 'application/json',
+ 'Authorization': 'Bearer {access-token}'
}
-r = requests.put('http://petstore.swagger.io/v2/pet', headers = headers)
+r = requests.put('http://petstore.swagger.io/v2/pet', headers = headers)
-print(r.json())
+print(r.json())
-<?php
-
-require 'vendor/autoload.php';
-
-$headers = array(
- 'Content-Type' => 'application/json',
- 'Authorization' => 'Bearer {access-token}',
+ 'application/json',
+ 'Authorization' => 'Bearer {access-token}',
);
-$client = new \GuzzleHttp\Client();
+$client = new \GuzzleHttp\Client();
// Define array of request body.
-$request_body = array();
+$request_body = array();
try {
- $response = $client->request('PUT','http://petstore.swagger.io/v2/pet', array(
- 'headers' => $headers,
- 'json' => $request_body,
+ $response = $client->request('PUT','http://petstore.swagger.io/v2/pet', array(
+ 'headers' => $headers,
+ 'json' => $request_body,
)
);
- print_r($response->getBody()->getContents());
+ print_r($response->getBody()->getContents());
}
- catch (\GuzzleHttp\Exception\BadResponseException $e) {
+ catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
- print_r($e->getMessage());
+ print_r($e->getMessage());
}
// ...
-URL obj = new URL("http://petstore.swagger.io/v2/pet");
-HttpURLConnection con = (HttpURLConnection) obj.openConnection();
-con.setRequestMethod("PUT");
-int responseCode = con.getResponseCode();
-BufferedReader in = new BufferedReader(
- new InputStreamReader(con.getInputStream()));
+URL obj = new URL("http://petstore.swagger.io/v2/pet");
+HttpURLConnection con = (HttpURLConnection) obj.openConnection();
+con.setRequestMethod("PUT");
+int responseCode = con.getResponseCode();
+BufferedReader in = new BufferedReader(
+ new InputStreamReader(con.getInputStream()));
String inputLine;
-StringBuffer response = new StringBuffer();
-while ((inputLine = in.readLine()) != null) {
+StringBuffer response = new StringBuffer();
+while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
@@ -703,19 +670,19 @@ updatePet
package main
import (
- "bytes"
- "net/http"
+ "bytes"
+ "net/http"
)
func main() {
- headers := map[string][]string{
- "Content-Type": []string{"application/json"},
- "Authorization": []string{"Bearer {access-token}"},
+ headers := map[string][]string{
+ "Content-Type": []string{"application/json"},
+ "Authorization": []string{"Bearer {access-token}"},
}
- data := bytes.NewBuffer([]byte{jsonReq})
- req, err := http.NewRequest("PUT", "http://petstore.swagger.io/v2/pet", data)
+ data := bytes.NewBuffer([]byte{jsonReq})
+ req, err := http.NewRequest("PUT", "http://petstore.swagger.io/v2/pet", data)
req.Header = headers
client := &http.Client{}
@@ -729,26 +696,26 @@ updatePet
Body parameter
-{
- "id": 0,
- "category": {
- "id": 0,
- "name": "string"
- },
- "name": "doggie",
- "photoUrls": [
- "string"
- ],
- "tags": [
- {
- "id": 0,
- "name": "string"
- }
- ],
- "status": "available"
-}
-
-<?xml version="1.0" encoding="UTF-8" ?>
+{
+ "id": 0,
+ "category": {
+ "id": 0,
+ "name": "string"
+ },
+ "name": "doggie",
+ "photoUrls": [
+ "string"
+ ],
+ "tags": [
+ {
+ "id": 0,
+ "name": "string"
+ }
+ ],
+ "status": "available"
+}
+
+<?xml version="1.0" encoding="UTF-8" ?>
<Pet>
<id>0</id>
<category>
@@ -827,104 +794,99 @@ findPetsByStatus
# You can also use wget
curl -X GET http://petstore.swagger.io/v2/pet/findByStatus?status=available \
- -H 'Accept: application/xml' \
- -H 'Authorization: Bearer {access-token}'
+ -H 'Accept: application/xml' \
+ -H 'Authorization: Bearer {access-token}'
-GET http://petstore.swagger.io/v2/pet/findByStatus?status=available HTTP/1.1
-Host: petstore.swagger.io
-Accept: application/xml
+GET http://petstore.swagger.io/v2/pet/findByStatus?status=available HTTP/1.1
+Host: petstore.swagger.io
+Accept: application/xml
const headers = {
- 'Accept':'application/xml',
- 'Authorization':'Bearer {access-token}'
+ 'Accept':'application/xml',
+ 'Authorization':'Bearer {access-token}'
};
-fetch('http://petstore.swagger.io/v2/pet/findByStatus?status=available',
+fetch('http://petstore.swagger.io/v2/pet/findByStatus?status=available',
{
- method: 'GET',
+ method: 'GET',
headers: headers
})
-.then(function(res) {
- return res.json();
-}).then(function(body) {
- console.log(body);
+.then(function(res) {
+ return res.json();
+}).then(function(body) {
+ console.log(body);
});
-require 'rest-client'
-require 'json'
+require 'rest-client'
+require 'json'
headers = {
- 'Accept' => 'application/xml',
- 'Authorization' => 'Bearer {access-token}'
+ 'Accept' => 'application/xml',
+ 'Authorization' => 'Bearer {access-token}'
}
-result = RestClient.get 'http://petstore.swagger.io/v2/pet/findByStatus',
+result = RestClient.get 'http://petstore.swagger.io/v2/pet/findByStatus',
params: {
- 'status' => 'array[string]'
+ 'status' => 'array[string]'
}, headers: headers
-p JSON.parse(result)
+p JSON.parse(result)
import requests
headers = {
- 'Accept': 'application/xml',
- 'Authorization': 'Bearer {access-token}'
+ 'Accept': 'application/xml',
+ 'Authorization': 'Bearer {access-token}'
}
-r = requests.get('http://petstore.swagger.io/v2/pet/findByStatus', params={
- 'status': [
- "available"
+r = requests.get('http://petstore.swagger.io/v2/pet/findByStatus', params={
+ 'status': [
+ "available"
]
}, headers = headers)
-print(r.json())
+print(r.json())
-<?php
-
-require 'vendor/autoload.php';
-
-$headers = array(
- 'Accept' => 'application/xml',
- 'Authorization' => 'Bearer {access-token}',
+ 'application/xml',
+ 'Authorization' => 'Bearer {access-token}',
);
-$client = new \GuzzleHttp\Client();
+$client = new \GuzzleHttp\Client();
// Define array of request body.
-$request_body = array();
+$request_body = array();
try {
- $response = $client->request('GET','http://petstore.swagger.io/v2/pet/findByStatus', array(
- 'headers' => $headers,
- 'json' => $request_body,
+ $response = $client->request('GET','http://petstore.swagger.io/v2/pet/findByStatus', array(
+ 'headers' => $headers,
+ 'json' => $request_body,
)
);
- print_r($response->getBody()->getContents());
+ print_r($response->getBody()->getContents());
}
- catch (\GuzzleHttp\Exception\BadResponseException $e) {
+ catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
- print_r($e->getMessage());
+ print_r($e->getMessage());
}
// ...
-URL obj = new URL("http://petstore.swagger.io/v2/pet/findByStatus?status=available");
-HttpURLConnection con = (HttpURLConnection) obj.openConnection();
-con.setRequestMethod("GET");
-int responseCode = con.getResponseCode();
-BufferedReader in = new BufferedReader(
- new InputStreamReader(con.getInputStream()));
+URL obj = new URL("http://petstore.swagger.io/v2/pet/findByStatus?status=available");
+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) {
+StringBuffer response = new StringBuffer();
+while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
@@ -934,19 +896,19 @@ findPetsByStatus
package main
import (
- "bytes"
- "net/http"
+ "bytes"
+ "net/http"
)
func main() {
- headers := map[string][]string{
- "Accept": []string{"application/xml"},
- "Authorization": []string{"Bearer {access-token}"},
+ headers := map[string][]string{
+ "Accept": []string{"application/xml"},
+ "Authorization": []string{"Bearer {access-token}"},
}
- data := bytes.NewBuffer([]byte{jsonReq})
- req, err := http.NewRequest("GET", "http://petstore.swagger.io/v2/pet/findByStatus", data)
+ data := bytes.NewBuffer([]byte{jsonReq})
+ req, err := http.NewRequest("GET", "http://petstore.swagger.io/v2/pet/findByStatus", data)
req.Header = headers
client := &http.Client{}
@@ -1008,7 +970,7 @@ Enumerated Values
200 Response
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8" ?>
<id>0</id>
<category>
<id>0</id>
@@ -1022,26 +984,26 @@ Enumerated Values
</tags>
<status>available</status>
-[
- {
- "id": 0,
- "category": {
- "id": 0,
- "name": "string"
- },
- "name": "doggie",
- "photoUrls": [
- "string"
- ],
- "tags": [
- {
- "id": 0,
- "name": "string"
- }
- ],
- "status": "available"
- }
-]
+[
+ {
+ "id": 0,
+ "category": {
+ "id": 0,
+ "name": "string"
+ },
+ "name": "doggie",
+ "photoUrls": [
+ "string"
+ ],
+ "tags": [
+ {
+ "id": 0,
+ "name": "string"
+ }
+ ],
+ "status": "available"
+ }
+]
Responses
@@ -1194,104 +1156,99 @@ findPetsByTags
# You can also use wget
curl -X GET http://petstore.swagger.io/v2/pet/findByTags?tags=string \
- -H 'Accept: application/xml' \
- -H 'Authorization: Bearer {access-token}'
+ -H 'Accept: application/xml' \
+ -H 'Authorization: Bearer {access-token}'
-GET http://petstore.swagger.io/v2/pet/findByTags?tags=string HTTP/1.1
-Host: petstore.swagger.io
-Accept: application/xml
+GET http://petstore.swagger.io/v2/pet/findByTags?tags=string HTTP/1.1
+Host: petstore.swagger.io
+Accept: application/xml
const headers = {
- 'Accept':'application/xml',
- 'Authorization':'Bearer {access-token}'
+ 'Accept':'application/xml',
+ 'Authorization':'Bearer {access-token}'
};
-fetch('http://petstore.swagger.io/v2/pet/findByTags?tags=string',
+fetch('http://petstore.swagger.io/v2/pet/findByTags?tags=string',
{
- method: 'GET',
+ method: 'GET',
headers: headers
})
-.then(function(res) {
- return res.json();
-}).then(function(body) {
- console.log(body);
+.then(function(res) {
+ return res.json();
+}).then(function(body) {
+ console.log(body);
});
-require 'rest-client'
-require 'json'
+require 'rest-client'
+require 'json'
headers = {
- 'Accept' => 'application/xml',
- 'Authorization' => 'Bearer {access-token}'
+ 'Accept' => 'application/xml',
+ 'Authorization' => 'Bearer {access-token}'
}
-result = RestClient.get 'http://petstore.swagger.io/v2/pet/findByTags',
+result = RestClient.get 'http://petstore.swagger.io/v2/pet/findByTags',
params: {
- 'tags' => 'array[string]'
+ 'tags' => 'array[string]'
}, headers: headers
-p JSON.parse(result)
+p JSON.parse(result)
import requests
headers = {
- 'Accept': 'application/xml',
- 'Authorization': 'Bearer {access-token}'
+ 'Accept': 'application/xml',
+ 'Authorization': 'Bearer {access-token}'
}
-r = requests.get('http://petstore.swagger.io/v2/pet/findByTags', params={
- 'tags': [
- "string"
+r = requests.get('http://petstore.swagger.io/v2/pet/findByTags', params={
+ 'tags': [
+ "string"
]
}, headers = headers)
-print(r.json())
+print(r.json())
-<?php
-
-require 'vendor/autoload.php';
-
-$headers = array(
- 'Accept' => 'application/xml',
- 'Authorization' => 'Bearer {access-token}',
+ 'application/xml',
+ 'Authorization' => 'Bearer {access-token}',
);
-$client = new \GuzzleHttp\Client();
+$client = new \GuzzleHttp\Client();
// Define array of request body.
-$request_body = array();
+$request_body = array();
try {
- $response = $client->request('GET','http://petstore.swagger.io/v2/pet/findByTags', array(
- 'headers' => $headers,
- 'json' => $request_body,
+ $response = $client->request('GET','http://petstore.swagger.io/v2/pet/findByTags', array(
+ 'headers' => $headers,
+ 'json' => $request_body,
)
);
- print_r($response->getBody()->getContents());
+ print_r($response->getBody()->getContents());
}
- catch (\GuzzleHttp\Exception\BadResponseException $e) {
+ catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
- print_r($e->getMessage());
+ print_r($e->getMessage());
}
// ...
-URL obj = new URL("http://petstore.swagger.io/v2/pet/findByTags?tags=string");
-HttpURLConnection con = (HttpURLConnection) obj.openConnection();
-con.setRequestMethod("GET");
-int responseCode = con.getResponseCode();
-BufferedReader in = new BufferedReader(
- new InputStreamReader(con.getInputStream()));
+URL obj = new URL("http://petstore.swagger.io/v2/pet/findByTags?tags=string");
+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) {
+StringBuffer response = new StringBuffer();
+while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
@@ -1301,19 +1258,19 @@ findPetsByTags
package main
import (
- "bytes"
- "net/http"
+ "bytes"
+ "net/http"
)
func main() {
- headers := map[string][]string{
- "Accept": []string{"application/xml"},
- "Authorization": []string{"Bearer {access-token}"},
+ headers := map[string][]string{
+ "Accept": []string{"application/xml"},
+ "Authorization": []string{"Bearer {access-token}"},
}
- data := bytes.NewBuffer([]byte{jsonReq})
- req, err := http.NewRequest("GET", "http://petstore.swagger.io/v2/pet/findByTags", data)
+ data := bytes.NewBuffer([]byte{jsonReq})
+ req, err := http.NewRequest("GET", "http://petstore.swagger.io/v2/pet/findByTags", data)
req.Header = headers
client := &http.Client{}
@@ -1352,7 +1309,7 @@ Parameters
200 Response
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8" ?>
<id>0</id>
<category>
<id>0</id>
@@ -1366,26 +1323,26 @@ Parameters
</tags>
<status>available</status>
-[
- {
- "id": 0,
- "category": {
- "id": 0,
- "name": "string"
- },
- "name": "doggie",
- "photoUrls": [
- "string"
- ],
- "tags": [
- {
- "id": 0,
- "name": "string"
- }
- ],
- "status": "available"
- }
-]
+[
+ {
+ "id": 0,
+ "category": {
+ "id": 0,
+ "name": "string"
+ },
+ "name": "doggie",
+ "photoUrls": [
+ "string"
+ ],
+ "tags": [
+ {
+ "id": 0,
+ "name": "string"
+ }
+ ],
+ "status": "available"
+ }
+]
Responses
@@ -1538,99 +1495,94 @@ getPetById
# You can also use wget
curl -X GET http://petstore.swagger.io/v2/pet/{petId} \
- -H 'Accept: application/xml' \
- -H 'api_key: API_KEY'
+ -H 'Accept: application/xml' \
+ -H 'api_key: API_KEY'
-GET http://petstore.swagger.io/v2/pet/{petId} HTTP/1.1
-Host: petstore.swagger.io
-Accept: application/xml
+GET http://petstore.swagger.io/v2/pet/{petId} HTTP/1.1
+Host: petstore.swagger.io
+Accept: application/xml
const headers = {
- 'Accept':'application/xml',
- 'api_key':'API_KEY'
+ 'Accept':'application/xml',
+ 'api_key':'API_KEY'
};
-fetch('http://petstore.swagger.io/v2/pet/{petId}',
+fetch('http://petstore.swagger.io/v2/pet/{petId}',
{
- method: 'GET',
+ method: 'GET',
headers: headers
})
-.then(function(res) {
- return res.json();
-}).then(function(body) {
- console.log(body);
+.then(function(res) {
+ return res.json();
+}).then(function(body) {
+ console.log(body);
});
-require 'rest-client'
-require 'json'
+require 'rest-client'
+require 'json'
headers = {
- 'Accept' => 'application/xml',
- 'api_key' => 'API_KEY'
+ 'Accept' => 'application/xml',
+ 'api_key' => 'API_KEY'
}
-result = RestClient.get 'http://petstore.swagger.io/v2/pet/{petId}',
+result = RestClient.get 'http://petstore.swagger.io/v2/pet/{petId}',
params: {
}, headers: headers
-p JSON.parse(result)
+p JSON.parse(result)
import requests
headers = {
- 'Accept': 'application/xml',
- 'api_key': 'API_KEY'
+ 'Accept': 'application/xml',
+ 'api_key': 'API_KEY'
}
-r = requests.get('http://petstore.swagger.io/v2/pet/{petId}', headers = headers)
+r = requests.get('http://petstore.swagger.io/v2/pet/{petId}', headers = headers)
-print(r.json())
+print(r.json())
-<?php
-
-require 'vendor/autoload.php';
-
-$headers = array(
- 'Accept' => 'application/xml',
- 'api_key' => 'API_KEY',
+ 'application/xml',
+ 'api_key' => 'API_KEY',
);
-$client = new \GuzzleHttp\Client();
+$client = new \GuzzleHttp\Client();
// Define array of request body.
-$request_body = array();
+$request_body = array();
try {
- $response = $client->request('GET','http://petstore.swagger.io/v2/pet/{petId}', array(
- 'headers' => $headers,
- 'json' => $request_body,
+ $response = $client->request('GET','http://petstore.swagger.io/v2/pet/{petId}', array(
+ 'headers' => $headers,
+ 'json' => $request_body,
)
);
- print_r($response->getBody()->getContents());
+ print_r($response->getBody()->getContents());
}
- catch (\GuzzleHttp\Exception\BadResponseException $e) {
+ catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
- print_r($e->getMessage());
+ print_r($e->getMessage());
}
// ...
-URL obj = new URL("http://petstore.swagger.io/v2/pet/{petId}");
-HttpURLConnection con = (HttpURLConnection) obj.openConnection();
-con.setRequestMethod("GET");
-int responseCode = con.getResponseCode();
-BufferedReader in = new BufferedReader(
- new InputStreamReader(con.getInputStream()));
+URL obj = new URL("http://petstore.swagger.io/v2/pet/{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) {
+StringBuffer response = new StringBuffer();
+while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
@@ -1640,19 +1592,19 @@ getPetById
package main
import (
- "bytes"
- "net/http"
+ "bytes"
+ "net/http"
)
func main() {
- headers := map[string][]string{
- "Accept": []string{"application/xml"},
- "api_key": []string{"API_KEY"},
+ headers := map[string][]string{
+ "Accept": []string{"application/xml"},
+ "api_key": []string{"API_KEY"},
}
- data := bytes.NewBuffer([]byte{jsonReq})
- req, err := http.NewRequest("GET", "http://petstore.swagger.io/v2/pet/{petId}", data)
+ data := bytes.NewBuffer([]byte{jsonReq})
+ req, err := http.NewRequest("GET", "http://petstore.swagger.io/v2/pet/{petId}", data)
req.Header = headers
client := &http.Client{}
@@ -1691,7 +1643,7 @@ Parameters
200 Response
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8" ?>
<Pet>
<id>0</id>
<category>
@@ -1707,24 +1659,24 @@ Parameters
<status>available</status>
</Pet>
-{
- "id": 0,
- "category": {
- "id": 0,
- "name": "string"
- },
- "name": "doggie",
- "photoUrls": [
- "string"
- ],
- "tags": [
- {
- "id": 0,
- "name": "string"
- }
- ],
- "status": "available"
-}
+{
+ "id": 0,
+ "category": {
+ "id": 0,
+ "name": "string"
+ },
+ "name": "doggie",
+ "photoUrls": [
+ "string"
+ ],
+ "tags": [
+ {
+ "id": 0,
+ "name": "string"
+ }
+ ],
+ "status": "available"
+}
Responses
@@ -1768,102 +1720,97 @@ updatePetWithForm
# You can also use wget
curl -X POST http://petstore.swagger.io/v2/pet/{petId} \
- -H 'Content-Type: application/x-www-form-urlencoded' \
- -H 'Authorization: Bearer {access-token}'
+ -H 'Content-Type: application/x-www-form-urlencoded' \
+ -H 'Authorization: Bearer {access-token}'
-POST http://petstore.swagger.io/v2/pet/{petId} HTTP/1.1
-Host: petstore.swagger.io
-Content-Type: application/x-www-form-urlencoded
+POST http://petstore.swagger.io/v2/pet/{petId} HTTP/1.1
+Host: petstore.swagger.io
+Content-Type: application/x-www-form-urlencoded
-const inputBody = '{
- "name": "string",
- "status": "string"
-}';
+const inputBody = '{
+ "name": "string",
+ "status": "string"
+}';
const headers = {
- 'Content-Type':'application/x-www-form-urlencoded',
- 'Authorization':'Bearer {access-token}'
+ 'Content-Type':'application/x-www-form-urlencoded',
+ 'Authorization':'Bearer {access-token}'
};
-fetch('http://petstore.swagger.io/v2/pet/{petId}',
+fetch('http://petstore.swagger.io/v2/pet/{petId}',
{
- method: 'POST',
+ method: 'POST',
body: inputBody,
headers: headers
})
-.then(function(res) {
- return res.json();
-}).then(function(body) {
- console.log(body);
+.then(function(res) {
+ return res.json();
+}).then(function(body) {
+ console.log(body);
});
-require 'rest-client'
-require 'json'
+require 'rest-client'
+require 'json'
headers = {
- 'Content-Type' => 'application/x-www-form-urlencoded',
- 'Authorization' => 'Bearer {access-token}'
+ 'Content-Type' => 'application/x-www-form-urlencoded',
+ 'Authorization' => 'Bearer {access-token}'
}
-result = RestClient.post 'http://petstore.swagger.io/v2/pet/{petId}',
+result = RestClient.post 'http://petstore.swagger.io/v2/pet/{petId}',
params: {
}, headers: headers
-p JSON.parse(result)
+p JSON.parse(result)
import requests
headers = {
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'Authorization': 'Bearer {access-token}'
+ 'Content-Type': 'application/x-www-form-urlencoded',
+ 'Authorization': 'Bearer {access-token}'
}
-r = requests.post('http://petstore.swagger.io/v2/pet/{petId}', headers = headers)
+r = requests.post('http://petstore.swagger.io/v2/pet/{petId}', headers = headers)
-print(r.json())
+print(r.json())
-<?php
-
-require 'vendor/autoload.php';
-
-$headers = array(
- 'Content-Type' => 'application/x-www-form-urlencoded',
- 'Authorization' => 'Bearer {access-token}',
+ 'application/x-www-form-urlencoded',
+ 'Authorization' => 'Bearer {access-token}',
);
-$client = new \GuzzleHttp\Client();
+$client = new \GuzzleHttp\Client();
// Define array of request body.
-$request_body = array();
+$request_body = array();
try {
- $response = $client->request('POST','http://petstore.swagger.io/v2/pet/{petId}', array(
- 'headers' => $headers,
- 'json' => $request_body,
+ $response = $client->request('POST','http://petstore.swagger.io/v2/pet/{petId}', array(
+ 'headers' => $headers,
+ 'json' => $request_body,
)
);
- print_r($response->getBody()->getContents());
+ print_r($response->getBody()->getContents());
}
- catch (\GuzzleHttp\Exception\BadResponseException $e) {
+ catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
- print_r($e->getMessage());
+ print_r($e->getMessage());
}
// ...
-URL obj = new URL("http://petstore.swagger.io/v2/pet/{petId}");
-HttpURLConnection con = (HttpURLConnection) obj.openConnection();
-con.setRequestMethod("POST");
-int responseCode = con.getResponseCode();
-BufferedReader in = new BufferedReader(
- new InputStreamReader(con.getInputStream()));
+URL obj = new URL("http://petstore.swagger.io/v2/pet/{petId}");
+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) {
+StringBuffer response = new StringBuffer();
+while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
@@ -1873,19 +1820,19 @@ updatePetWithForm
package main
import (
- "bytes"
- "net/http"
+ "bytes"
+ "net/http"
)
func main() {
- headers := map[string][]string{
- "Content-Type": []string{"application/x-www-form-urlencoded"},
- "Authorization": []string{"Bearer {access-token}"},
+ headers := map[string][]string{
+ "Content-Type": []string{"application/x-www-form-urlencoded"},
+ "Authorization": []string{"Bearer {access-token}"},
}
- data := bytes.NewBuffer([]byte{jsonReq})
- req, err := http.NewRequest("POST", "http://petstore.swagger.io/v2/pet/{petId}", data)
+ data := bytes.NewBuffer([]byte{jsonReq})
+ req, err := http.NewRequest("POST", "http://petstore.swagger.io/v2/pet/{petId}", data)
req.Header = headers
client := &http.Client{}
@@ -1975,100 +1922,95 @@ deletePet
# You can also use wget
curl -X DELETE http://petstore.swagger.io/v2/pet/{petId} \
- -H 'api_key: string' \
- -H 'Authorization: Bearer {access-token}'
+ -H 'api_key: string' \
+ -H 'Authorization: Bearer {access-token}'
-DELETE http://petstore.swagger.io/v2/pet/{petId} HTTP/1.1
-Host: petstore.swagger.io
+DELETE http://petstore.swagger.io/v2/pet/{petId} HTTP/1.1
+Host: petstore.swagger.io
-api_key: string
+api_key: string
const headers = {
- 'api_key':'string',
- 'Authorization':'Bearer {access-token}'
+ 'api_key':'string',
+ 'Authorization':'Bearer {access-token}'
};
-fetch('http://petstore.swagger.io/v2/pet/{petId}',
+fetch('http://petstore.swagger.io/v2/pet/{petId}',
{
- method: 'DELETE',
+ method: 'DELETE',
headers: headers
})
-.then(function(res) {
- return res.json();
-}).then(function(body) {
- console.log(body);
+.then(function(res) {
+ return res.json();
+}).then(function(body) {
+ console.log(body);
});
-require 'rest-client'
-require 'json'
+require 'rest-client'
+require 'json'
headers = {
- 'api_key' => 'string',
- 'Authorization' => 'Bearer {access-token}'
+ 'api_key' => 'string',
+ 'Authorization' => 'Bearer {access-token}'
}
-result = RestClient.delete 'http://petstore.swagger.io/v2/pet/{petId}',
+result = RestClient.delete 'http://petstore.swagger.io/v2/pet/{petId}',
params: {
}, headers: headers
-p JSON.parse(result)
+p JSON.parse(result)
import requests
headers = {
- 'api_key': 'string',
- 'Authorization': 'Bearer {access-token}'
+ 'api_key': 'string',
+ 'Authorization': 'Bearer {access-token}'
}
-r = requests.delete('http://petstore.swagger.io/v2/pet/{petId}', headers = headers)
+r = requests.delete('http://petstore.swagger.io/v2/pet/{petId}', headers = headers)
-print(r.json())
+print(r.json())
-<?php
-
-require 'vendor/autoload.php';
-
-$headers = array(
- 'api_key' => 'string',
- 'Authorization' => 'Bearer {access-token}',
+ 'string',
+ 'Authorization' => 'Bearer {access-token}',
);
-$client = new \GuzzleHttp\Client();
+$client = new \GuzzleHttp\Client();
// Define array of request body.
-$request_body = array();
+$request_body = array();
try {
- $response = $client->request('DELETE','http://petstore.swagger.io/v2/pet/{petId}', array(
- 'headers' => $headers,
- 'json' => $request_body,
+ $response = $client->request('DELETE','http://petstore.swagger.io/v2/pet/{petId}', array(
+ 'headers' => $headers,
+ 'json' => $request_body,
)
);
- print_r($response->getBody()->getContents());
+ print_r($response->getBody()->getContents());
}
- catch (\GuzzleHttp\Exception\BadResponseException $e) {
+ catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
- print_r($e->getMessage());
+ print_r($e->getMessage());
}
// ...
-URL obj = new URL("http://petstore.swagger.io/v2/pet/{petId}");
-HttpURLConnection con = (HttpURLConnection) obj.openConnection();
-con.setRequestMethod("DELETE");
-int responseCode = con.getResponseCode();
-BufferedReader in = new BufferedReader(
- new InputStreamReader(con.getInputStream()));
+URL obj = new URL("http://petstore.swagger.io/v2/pet/{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) {
+StringBuffer response = new StringBuffer();
+while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
@@ -2078,19 +2020,19 @@ deletePet
package main
import (
- "bytes"
- "net/http"
+ "bytes"
+ "net/http"
)
func main() {
- headers := map[string][]string{
- "api_key": []string{"string"},
- "Authorization": []string{"Bearer {access-token}"},
+ headers := map[string][]string{
+ "api_key": []string{"string"},
+ "Authorization": []string{"Bearer {access-token}"},
}
- data := bytes.NewBuffer([]byte{jsonReq})
- req, err := http.NewRequest("DELETE", "http://petstore.swagger.io/v2/pet/{petId}", data)
+ data := bytes.NewBuffer([]byte{jsonReq})
+ req, err := http.NewRequest("DELETE", "http://petstore.swagger.io/v2/pet/{petId}", data)
req.Header = headers
client := &http.Client{}
@@ -2165,108 +2107,103 @@ uploadFile
# You can also use wget
curl -X POST http://petstore.swagger.io/v2/pet/{petId}/uploadImage \
- -H 'Content-Type: multipart/form-data' \
- -H 'Accept: application/json' \
- -H 'Authorization: Bearer {access-token}'
+ -H 'Content-Type: multipart/form-data' \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Bearer {access-token}'
-POST http://petstore.swagger.io/v2/pet/{petId}/uploadImage HTTP/1.1
-Host: petstore.swagger.io
-Content-Type: multipart/form-data
-Accept: application/json
+POST http://petstore.swagger.io/v2/pet/{petId}/uploadImage HTTP/1.1
+Host: petstore.swagger.io
+Content-Type: multipart/form-data
+Accept: application/json
-const inputBody = '{
- "additionalMetadata": "string",
- "file": "string"
-}';
+const inputBody = '{
+ "additionalMetadata": "string",
+ "file": "string"
+}';
const headers = {
- 'Content-Type':'multipart/form-data',
- 'Accept':'application/json',
- 'Authorization':'Bearer {access-token}'
+ 'Content-Type':'multipart/form-data',
+ 'Accept':'application/json',
+ 'Authorization':'Bearer {access-token}'
};
-fetch('http://petstore.swagger.io/v2/pet/{petId}/uploadImage',
+fetch('http://petstore.swagger.io/v2/pet/{petId}/uploadImage',
{
- method: 'POST',
+ method: 'POST',
body: inputBody,
headers: headers
})
-.then(function(res) {
- return res.json();
-}).then(function(body) {
- console.log(body);
+.then(function(res) {
+ return res.json();
+}).then(function(body) {
+ console.log(body);
});
-require 'rest-client'
-require 'json'
+require 'rest-client'
+require 'json'
headers = {
- 'Content-Type' => 'multipart/form-data',
- 'Accept' => 'application/json',
- 'Authorization' => 'Bearer {access-token}'
+ 'Content-Type' => 'multipart/form-data',
+ 'Accept' => 'application/json',
+ 'Authorization' => 'Bearer {access-token}'
}
-result = RestClient.post 'http://petstore.swagger.io/v2/pet/{petId}/uploadImage',
+result = RestClient.post 'http://petstore.swagger.io/v2/pet/{petId}/uploadImage',
params: {
}, headers: headers
-p JSON.parse(result)
+p JSON.parse(result)
import requests
headers = {
- 'Content-Type': 'multipart/form-data',
- 'Accept': 'application/json',
- 'Authorization': 'Bearer {access-token}'
+ 'Content-Type': 'multipart/form-data',
+ 'Accept': 'application/json',
+ 'Authorization': 'Bearer {access-token}'
}
-r = requests.post('http://petstore.swagger.io/v2/pet/{petId}/uploadImage', headers = headers)
+r = requests.post('http://petstore.swagger.io/v2/pet/{petId}/uploadImage', headers = headers)
-print(r.json())
+print(r.json())
-<?php
-
-require 'vendor/autoload.php';
-
-$headers = array(
- 'Content-Type' => 'multipart/form-data',
- 'Accept' => 'application/json',
- 'Authorization' => 'Bearer {access-token}',
+ 'multipart/form-data',
+ 'Accept' => 'application/json',
+ 'Authorization' => 'Bearer {access-token}',
);
-$client = new \GuzzleHttp\Client();
+$client = new \GuzzleHttp\Client();
// Define array of request body.
-$request_body = array();
+$request_body = array();
try {
- $response = $client->request('POST','http://petstore.swagger.io/v2/pet/{petId}/uploadImage', array(
- 'headers' => $headers,
- 'json' => $request_body,
+ $response = $client->request('POST','http://petstore.swagger.io/v2/pet/{petId}/uploadImage', array(
+ 'headers' => $headers,
+ 'json' => $request_body,
)
);
- print_r($response->getBody()->getContents());
+ print_r($response->getBody()->getContents());
}
- catch (\GuzzleHttp\Exception\BadResponseException $e) {
+ catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
- print_r($e->getMessage());
+ print_r($e->getMessage());
}
// ...
-URL obj = new URL("http://petstore.swagger.io/v2/pet/{petId}/uploadImage");
-HttpURLConnection con = (HttpURLConnection) obj.openConnection();
-con.setRequestMethod("POST");
-int responseCode = con.getResponseCode();
-BufferedReader in = new BufferedReader(
- new InputStreamReader(con.getInputStream()));
+URL obj = new URL("http://petstore.swagger.io/v2/pet/{petId}/uploadImage");
+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) {
+StringBuffer response = new StringBuffer();
+while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
@@ -2276,20 +2213,20 @@ uploadFile
package main
import (
- "bytes"
- "net/http"
+ "bytes"
+ "net/http"
)
func main() {
- headers := map[string][]string{
- "Content-Type": []string{"multipart/form-data"},
- "Accept": []string{"application/json"},
- "Authorization": []string{"Bearer {access-token}"},
+ headers := map[string][]string{
+ "Content-Type": []string{"multipart/form-data"},
+ "Accept": []string{"application/json"},
+ "Authorization": []string{"Bearer {access-token}"},
}
- data := bytes.NewBuffer([]byte{jsonReq})
- req, err := http.NewRequest("POST", "http://petstore.swagger.io/v2/pet/{petId}/uploadImage", data)
+ data := bytes.NewBuffer([]byte{jsonReq})
+ req, err := http.NewRequest("POST", "http://petstore.swagger.io/v2/pet/{petId}/uploadImage", data)
req.Header = headers
client := &http.Client{}
@@ -2355,11 +2292,11 @@ Parameters
200 Response
-{
- "code": 0,
- "type": "string",
- "message": "string"
-}
+{
+ "code": 0,
+ "type": "string",
+ "message": "string"
+}
Responses
@@ -2393,99 +2330,94 @@ getInventory
# You can also use wget
curl -X GET http://petstore.swagger.io/v2/store/inventory \
- -H 'Accept: application/json' \
- -H 'api_key: API_KEY'
+ -H 'Accept: application/json' \
+ -H 'api_key: API_KEY'
-GET http://petstore.swagger.io/v2/store/inventory HTTP/1.1
-Host: petstore.swagger.io
-Accept: application/json
+GET http://petstore.swagger.io/v2/store/inventory HTTP/1.1
+Host: petstore.swagger.io
+Accept: application/json
const headers = {
- 'Accept':'application/json',
- 'api_key':'API_KEY'
+ 'Accept':'application/json',
+ 'api_key':'API_KEY'
};
-fetch('http://petstore.swagger.io/v2/store/inventory',
+fetch('http://petstore.swagger.io/v2/store/inventory',
{
- method: 'GET',
+ method: 'GET',
headers: headers
})
-.then(function(res) {
- return res.json();
-}).then(function(body) {
- console.log(body);
+.then(function(res) {
+ return res.json();
+}).then(function(body) {
+ console.log(body);
});
-require 'rest-client'
-require 'json'
+require 'rest-client'
+require 'json'
headers = {
- 'Accept' => 'application/json',
- 'api_key' => 'API_KEY'
+ 'Accept' => 'application/json',
+ 'api_key' => 'API_KEY'
}
-result = RestClient.get 'http://petstore.swagger.io/v2/store/inventory',
+result = RestClient.get 'http://petstore.swagger.io/v2/store/inventory',
params: {
}, headers: headers
-p JSON.parse(result)
+p JSON.parse(result)
import requests
headers = {
- 'Accept': 'application/json',
- 'api_key': 'API_KEY'
+ 'Accept': 'application/json',
+ 'api_key': 'API_KEY'
}
-r = requests.get('http://petstore.swagger.io/v2/store/inventory', headers = headers)
+r = requests.get('http://petstore.swagger.io/v2/store/inventory', headers = headers)
-print(r.json())
+print(r.json())
-<?php
-
-require 'vendor/autoload.php';
-
-$headers = array(
- 'Accept' => 'application/json',
- 'api_key' => 'API_KEY',
+ 'application/json',
+ 'api_key' => 'API_KEY',
);
-$client = new \GuzzleHttp\Client();
+$client = new \GuzzleHttp\Client();
// Define array of request body.
-$request_body = array();
+$request_body = array();
try {
- $response = $client->request('GET','http://petstore.swagger.io/v2/store/inventory', array(
- 'headers' => $headers,
- 'json' => $request_body,
+ $response = $client->request('GET','http://petstore.swagger.io/v2/store/inventory', array(
+ 'headers' => $headers,
+ 'json' => $request_body,
)
);
- print_r($response->getBody()->getContents());
+ print_r($response->getBody()->getContents());
}
- catch (\GuzzleHttp\Exception\BadResponseException $e) {
+ catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
- print_r($e->getMessage());
+ print_r($e->getMessage());
}
// ...
-URL obj = new URL("http://petstore.swagger.io/v2/store/inventory");
-HttpURLConnection con = (HttpURLConnection) obj.openConnection();
-con.setRequestMethod("GET");
-int responseCode = con.getResponseCode();
-BufferedReader in = new BufferedReader(
- new InputStreamReader(con.getInputStream()));
+URL obj = new URL("http://petstore.swagger.io/v2/store/inventory");
+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) {
+StringBuffer response = new StringBuffer();
+while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
@@ -2495,19 +2427,19 @@ getInventory
package main
import (
- "bytes"
- "net/http"
+ "bytes"
+ "net/http"
)
func main() {
- headers := map[string][]string{
- "Accept": []string{"application/json"},
- "api_key": []string{"API_KEY"},
+ headers := map[string][]string{
+ "Accept": []string{"application/json"},
+ "api_key": []string{"API_KEY"},
}
- data := bytes.NewBuffer([]byte{jsonReq})
- req, err := http.NewRequest("GET", "http://petstore.swagger.io/v2/store/inventory", data)
+ data := bytes.NewBuffer([]byte{jsonReq})
+ req, err := http.NewRequest("GET", "http://petstore.swagger.io/v2/store/inventory", data)
req.Header = headers
client := &http.Client{}
@@ -2525,10 +2457,10 @@ getInventory
200 Response
-{
- "property1": 0,
- "property2": 0
-}
+{
+ "property1": 0,
+ "property2": 0
+}
Responses
@@ -2582,107 +2514,102 @@ placeOrder
# You can also use wget
curl -X POST http://petstore.swagger.io/v2/store/order \
- -H 'Content-Type: application/json' \
- -H 'Accept: application/xml'
+ -H 'Content-Type: application/json' \
+ -H 'Accept: application/xml'
-POST http://petstore.swagger.io/v2/store/order HTTP/1.1
-Host: petstore.swagger.io
-Content-Type: application/json
-Accept: application/xml
+POST http://petstore.swagger.io/v2/store/order HTTP/1.1
+Host: petstore.swagger.io
+Content-Type: application/json
+Accept: application/xml
-const inputBody = '{
- "id": 0,
- "petId": 0,
- "quantity": 0,
- "shipDate": "2020-03-30T14:38:05Z",
- "status": "placed",
- "complete": false
-}';
+const inputBody = '{
+ "id": 0,
+ "petId": 0,
+ "quantity": 0,
+ "shipDate": "2020-03-30T14:38:05Z",
+ "status": "placed",
+ "complete": false
+}';
const headers = {
- 'Content-Type':'application/json',
- 'Accept':'application/xml'
+ 'Content-Type':'application/json',
+ 'Accept':'application/xml'
};
-fetch('http://petstore.swagger.io/v2/store/order',
+fetch('http://petstore.swagger.io/v2/store/order',
{
- method: 'POST',
+ method: 'POST',
body: inputBody,
headers: headers
})
-.then(function(res) {
- return res.json();
-}).then(function(body) {
- console.log(body);
+.then(function(res) {
+ return res.json();
+}).then(function(body) {
+ console.log(body);
});
-require 'rest-client'
-require 'json'
+require 'rest-client'
+require 'json'
headers = {
- 'Content-Type' => 'application/json',
- 'Accept' => 'application/xml'
+ 'Content-Type' => 'application/json',
+ 'Accept' => 'application/xml'
}
-result = RestClient.post 'http://petstore.swagger.io/v2/store/order',
+result = RestClient.post 'http://petstore.swagger.io/v2/store/order',
params: {
}, headers: headers
-p JSON.parse(result)
+p JSON.parse(result)
import requests
headers = {
- 'Content-Type': 'application/json',
- 'Accept': 'application/xml'
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/xml'
}
-r = requests.post('http://petstore.swagger.io/v2/store/order', headers = headers)
+r = requests.post('http://petstore.swagger.io/v2/store/order', headers = headers)
-print(r.json())
+print(r.json())
-<?php
-
-require 'vendor/autoload.php';
-
-$headers = array(
- 'Content-Type' => 'application/json',
- 'Accept' => 'application/xml',
+ 'application/json',
+ 'Accept' => 'application/xml',
);
-$client = new \GuzzleHttp\Client();
+$client = new \GuzzleHttp\Client();
// Define array of request body.
-$request_body = array();
+$request_body = array();
try {
- $response = $client->request('POST','http://petstore.swagger.io/v2/store/order', array(
- 'headers' => $headers,
- 'json' => $request_body,
+ $response = $client->request('POST','http://petstore.swagger.io/v2/store/order', array(
+ 'headers' => $headers,
+ 'json' => $request_body,
)
);
- print_r($response->getBody()->getContents());
+ print_r($response->getBody()->getContents());
}
- catch (\GuzzleHttp\Exception\BadResponseException $e) {
+ catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
- print_r($e->getMessage());
+ print_r($e->getMessage());
}
// ...
-URL obj = new URL("http://petstore.swagger.io/v2/store/order");
-HttpURLConnection con = (HttpURLConnection) obj.openConnection();
-con.setRequestMethod("POST");
-int responseCode = con.getResponseCode();
-BufferedReader in = new BufferedReader(
- new InputStreamReader(con.getInputStream()));
+URL obj = new URL("http://petstore.swagger.io/v2/store/order");
+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) {
+StringBuffer response = new StringBuffer();
+while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
@@ -2692,19 +2619,19 @@ placeOrder
package main
import (
- "bytes"
- "net/http"
+ "bytes"
+ "net/http"
)
func main() {
- headers := map[string][]string{
- "Content-Type": []string{"application/json"},
- "Accept": []string{"application/xml"},
+ headers := map[string][]string{
+ "Content-Type": []string{"application/json"},
+ "Accept": []string{"application/xml"},
}
- data := bytes.NewBuffer([]byte{jsonReq})
- req, err := http.NewRequest("POST", "http://petstore.swagger.io/v2/store/order", data)
+ data := bytes.NewBuffer([]byte{jsonReq})
+ req, err := http.NewRequest("POST", "http://petstore.swagger.io/v2/store/order", data)
req.Header = headers
client := &http.Client{}
@@ -2718,14 +2645,14 @@ placeOrder
Body parameter
-{
- "id": 0,
- "petId": 0,
- "quantity": 0,
- "shipDate": "2020-03-30T14:38:05Z",
- "status": "placed",
- "complete": false
-}
+{
+ "id": 0,
+ "petId": 0,
+ "quantity": 0,
+ "shipDate": "2020-03-30T14:38:05Z",
+ "status": "placed",
+ "complete": false
+}
Parameters
@@ -2754,7 +2681,7 @@ Parameters
200 Response
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8" ?>
<Order>
<id>0</id>
<petId>0</petId>
@@ -2764,14 +2691,14 @@ Parameters
<complete>false</complete>
</Order>
-{
- "id": 0,
- "petId": 0,
- "quantity": 0,
- "shipDate": "2020-03-30T14:38:05Z",
- "status": "placed",
- "complete": false
-}
+{
+ "id": 0,
+ "petId": 0,
+ "quantity": 0,
+ "shipDate": "2020-03-30T14:38:05Z",
+ "status": "placed",
+ "complete": false
+}
Responses
@@ -2808,94 +2735,89 @@ getOrderById
# You can also use wget
curl -X GET http://petstore.swagger.io/v2/store/order/{orderId} \
- -H 'Accept: application/xml'
+ -H 'Accept: application/xml'
-GET http://petstore.swagger.io/v2/store/order/{orderId} HTTP/1.1
-Host: petstore.swagger.io
-Accept: application/xml
+GET http://petstore.swagger.io/v2/store/order/{orderId} HTTP/1.1
+Host: petstore.swagger.io
+Accept: application/xml
const headers = {
- 'Accept':'application/xml'
+ 'Accept':'application/xml'
};
-fetch('http://petstore.swagger.io/v2/store/order/{orderId}',
+fetch('http://petstore.swagger.io/v2/store/order/{orderId}',
{
- method: 'GET',
+ method: 'GET',
headers: headers
})
-.then(function(res) {
- return res.json();
-}).then(function(body) {
- console.log(body);
+.then(function(res) {
+ return res.json();
+}).then(function(body) {
+ console.log(body);
});
-require 'rest-client'
-require 'json'
+require 'rest-client'
+require 'json'
headers = {
- 'Accept' => 'application/xml'
+ 'Accept' => 'application/xml'
}
-result = RestClient.get 'http://petstore.swagger.io/v2/store/order/{orderId}',
+result = RestClient.get 'http://petstore.swagger.io/v2/store/order/{orderId}',
params: {
}, headers: headers
-p JSON.parse(result)
+p JSON.parse(result)
import requests
headers = {
- 'Accept': 'application/xml'
+ 'Accept': 'application/xml'
}
-r = requests.get('http://petstore.swagger.io/v2/store/order/{orderId}', headers = headers)
+r = requests.get('http://petstore.swagger.io/v2/store/order/{orderId}', headers = headers)
-print(r.json())
+print(r.json())
-<?php
-
-require 'vendor/autoload.php';
-
-$headers = array(
- 'Accept' => 'application/xml',
+ 'application/xml',
);
-$client = new \GuzzleHttp\Client();
+$client = new \GuzzleHttp\Client();
// Define array of request body.
-$request_body = array();
+$request_body = array();
try {
- $response = $client->request('GET','http://petstore.swagger.io/v2/store/order/{orderId}', array(
- 'headers' => $headers,
- 'json' => $request_body,
+ $response = $client->request('GET','http://petstore.swagger.io/v2/store/order/{orderId}', array(
+ 'headers' => $headers,
+ 'json' => $request_body,
)
);
- print_r($response->getBody()->getContents());
+ print_r($response->getBody()->getContents());
}
- catch (\GuzzleHttp\Exception\BadResponseException $e) {
+ catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
- print_r($e->getMessage());
+ print_r($e->getMessage());
}
// ...
-URL obj = new URL("http://petstore.swagger.io/v2/store/order/{orderId}");
-HttpURLConnection con = (HttpURLConnection) obj.openConnection();
-con.setRequestMethod("GET");
-int responseCode = con.getResponseCode();
-BufferedReader in = new BufferedReader(
- new InputStreamReader(con.getInputStream()));
+URL obj = new URL("http://petstore.swagger.io/v2/store/order/{orderId}");
+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) {
+StringBuffer response = new StringBuffer();
+while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
@@ -2905,18 +2827,18 @@ getOrderById
package main
import (
- "bytes"
- "net/http"
+ "bytes"
+ "net/http"
)
func main() {
- headers := map[string][]string{
- "Accept": []string{"application/xml"},
+ headers := map[string][]string{
+ "Accept": []string{"application/xml"},
}
- data := bytes.NewBuffer([]byte{jsonReq})
- req, err := http.NewRequest("GET", "http://petstore.swagger.io/v2/store/order/{orderId}", data)
+ data := bytes.NewBuffer([]byte{jsonReq})
+ req, err := http.NewRequest("GET", "http://petstore.swagger.io/v2/store/order/{orderId}", data)
req.Header = headers
client := &http.Client{}
@@ -2955,7 +2877,7 @@ Parameters
200 Response
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8" ?>
<Order>
<id>0</id>
<petId>0</petId>
@@ -2965,14 +2887,14 @@ Parameters
<complete>false</complete>
</Order>
-{
- "id": 0,
- "petId": 0,
- "quantity": 0,
- "shipDate": "2020-03-30T14:38:05Z",
- "status": "placed",
- "complete": false
-}
+{
+ "id": 0,
+ "petId": 0,
+ "quantity": 0,
+ "shipDate": "2020-03-30T14:38:05Z",
+ "status": "placed",
+ "complete": false
+}
Responses
@@ -3017,74 +2939,64 @@ deleteOrder
curl -X DELETE http://petstore.swagger.io/v2/store/order/{orderId}
-DELETE http://petstore.swagger.io/v2/store/order/{orderId} HTTP/1.1
-Host: petstore.swagger.io
+DELETE http://petstore.swagger.io/v2/store/order/{orderId} HTTP/1.1
+Host: petstore.swagger.io
-fetch('http://petstore.swagger.io/v2/store/order/{orderId}',
+fetch('http://petstore.swagger.io/v2/store/order/{orderId}',
{
- method: 'DELETE'
+ method: 'DELETE'
})
-.then(function(res) {
- return res.json();
-}).then(function(body) {
- console.log(body);
+.then(function(res) {
+ return res.json();
+}).then(function(body) {
+ console.log(body);
});
-require 'rest-client'
-require 'json'
+require 'rest-client'
+require 'json'
-result = RestClient.delete 'http://petstore.swagger.io/v2/store/order/{orderId}',
+result = RestClient.delete 'http://petstore.swagger.io/v2/store/order/{orderId}',
params: {
}
-p JSON.parse(result)
+p JSON.parse(result)
import requests
-r = requests.delete('http://petstore.swagger.io/v2/store/order/{orderId}')
+r = requests.delete('http://petstore.swagger.io/v2/store/order/{orderId}')
-print(r.json())
+print(r.json())
-<?php
-
-require 'vendor/autoload.php';
-
-$client = new \GuzzleHttp\Client();
-
-// Define array of request body.
-$request_body = array();
-
-try {
- $response = $client->request('DELETE','http://petstore.swagger.io/v2/store/order/{orderId}', array(
- 'headers' => $headers,
- 'json' => $request_body,
+request('DELETE','http://petstore.swagger.io/v2/store/order/{orderId}', array(
+ 'headers' => $headers,
+ 'json' => $request_body,
)
);
- print_r($response->getBody()->getContents());
+ print_r($response->getBody()->getContents());
}
- catch (\GuzzleHttp\Exception\BadResponseException $e) {
+ catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
- print_r($e->getMessage());
+ print_r($e->getMessage());
}
// ...
-URL obj = new URL("http://petstore.swagger.io/v2/store/order/{orderId}");
-HttpURLConnection con = (HttpURLConnection) obj.openConnection();
-con.setRequestMethod("DELETE");
-int responseCode = con.getResponseCode();
-BufferedReader in = new BufferedReader(
- new InputStreamReader(con.getInputStream()));
+URL obj = new URL("http://petstore.swagger.io/v2/store/order/{orderId}");
+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) {
+StringBuffer response = new StringBuffer();
+while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
@@ -3094,14 +3006,14 @@ deleteOrder
package main
import (
- "bytes"
- "net/http"
+ "bytes"
+ "net/http"
)
func main() {
- data := bytes.NewBuffer([]byte{jsonReq})
- req, err := http.NewRequest("DELETE", "http://petstore.swagger.io/v2/store/order/{orderId}", data)
+ data := bytes.NewBuffer([]byte{jsonReq})
+ req, err := http.NewRequest("DELETE", "http://petstore.swagger.io/v2/store/order/{orderId}", data)
req.Header = headers
client := &http.Client{}
@@ -3172,103 +3084,98 @@ createUser
# You can also use wget
curl -X POST http://petstore.swagger.io/v2/user \
- -H 'Content-Type: application/json'
+ -H 'Content-Type: application/json'
-POST http://petstore.swagger.io/v2/user HTTP/1.1
-Host: petstore.swagger.io
-Content-Type: application/json
+POST http://petstore.swagger.io/v2/user HTTP/1.1
+Host: petstore.swagger.io
+Content-Type: application/json
-const inputBody = '{
- "id": 0,
- "username": "string",
- "firstName": "string",
- "lastName": "string",
- "email": "string",
- "password": "string",
- "phone": "string",
- "userStatus": 0
-}';
+const inputBody = '{
+ "id": 0,
+ "username": "string",
+ "firstName": "string",
+ "lastName": "string",
+ "email": "string",
+ "password": "string",
+ "phone": "string",
+ "userStatus": 0
+}';
const headers = {
- 'Content-Type':'application/json'
+ 'Content-Type':'application/json'
};
-fetch('http://petstore.swagger.io/v2/user',
+fetch('http://petstore.swagger.io/v2/user',
{
- method: 'POST',
+ method: 'POST',
body: inputBody,
headers: headers
})
-.then(function(res) {
- return res.json();
-}).then(function(body) {
- console.log(body);
+.then(function(res) {
+ return res.json();
+}).then(function(body) {
+ console.log(body);
});
-require 'rest-client'
-require 'json'
+require 'rest-client'
+require 'json'
headers = {
- 'Content-Type' => 'application/json'
+ 'Content-Type' => 'application/json'
}
-result = RestClient.post 'http://petstore.swagger.io/v2/user',
+result = RestClient.post 'http://petstore.swagger.io/v2/user',
params: {
}, headers: headers
-p JSON.parse(result)
+p JSON.parse(result)
import requests
headers = {
- 'Content-Type': 'application/json'
+ 'Content-Type': 'application/json'
}
-r = requests.post('http://petstore.swagger.io/v2/user', headers = headers)
+r = requests.post('http://petstore.swagger.io/v2/user', headers = headers)
-print(r.json())
+print(r.json())
-<?php
-
-require 'vendor/autoload.php';
-
-$headers = array(
- 'Content-Type' => 'application/json',
+ 'application/json',
);
-$client = new \GuzzleHttp\Client();
+$client = new \GuzzleHttp\Client();
// Define array of request body.
-$request_body = array();
+$request_body = array();
try {
- $response = $client->request('POST','http://petstore.swagger.io/v2/user', array(
- 'headers' => $headers,
- 'json' => $request_body,
+ $response = $client->request('POST','http://petstore.swagger.io/v2/user', array(
+ 'headers' => $headers,
+ 'json' => $request_body,
)
);
- print_r($response->getBody()->getContents());
+ print_r($response->getBody()->getContents());
}
- catch (\GuzzleHttp\Exception\BadResponseException $e) {
+ catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
- print_r($e->getMessage());
+ print_r($e->getMessage());
}
// ...
-URL obj = new URL("http://petstore.swagger.io/v2/user");
-HttpURLConnection con = (HttpURLConnection) obj.openConnection();
-con.setRequestMethod("POST");
-int responseCode = con.getResponseCode();
-BufferedReader in = new BufferedReader(
- new InputStreamReader(con.getInputStream()));
+URL obj = new URL("http://petstore.swagger.io/v2/user");
+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) {
+StringBuffer response = new StringBuffer();
+while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
@@ -3278,18 +3185,18 @@ createUser
package main
import (
- "bytes"
- "net/http"
+ "bytes"
+ "net/http"
)
func main() {
- headers := map[string][]string{
- "Content-Type": []string{"application/json"},
+ headers := map[string][]string{
+ "Content-Type": []string{"application/json"},
}
- data := bytes.NewBuffer([]byte{jsonReq})
- req, err := http.NewRequest("POST", "http://petstore.swagger.io/v2/user", data)
+ data := bytes.NewBuffer([]byte{jsonReq})
+ req, err := http.NewRequest("POST", "http://petstore.swagger.io/v2/user", data)
req.Header = headers
client := &http.Client{}
@@ -3304,16 +3211,16 @@ createUser
Body parameter
-{
- "id": 0,
- "username": "string",
- "firstName": "string",
- "lastName": "string",
- "email": "string",
- "password": "string",
- "phone": "string",
- "userStatus": 0
-}
+{
+ "id": 0,
+ "username": "string",
+ "firstName": "string",
+ "lastName": "string",
+ "email": "string",
+ "password": "string",
+ "phone": "string",
+ "userStatus": 0
+}
Parameters
@@ -3365,105 +3272,100 @@ createUsersWithArrayInput
# You can also use wget
curl -X POST http://petstore.swagger.io/v2/user/createWithArray \
- -H 'Content-Type: application/json'
+ -H 'Content-Type: application/json'
-POST http://petstore.swagger.io/v2/user/createWithArray HTTP/1.1
-Host: petstore.swagger.io
-Content-Type: application/json
+POST http://petstore.swagger.io/v2/user/createWithArray HTTP/1.1
+Host: petstore.swagger.io
+Content-Type: application/json
-const inputBody = '[
+const inputBody = '[
{
- "id": 0,
- "username": "string",
- "firstName": "string",
- "lastName": "string",
- "email": "string",
- "password": "string",
- "phone": "string",
- "userStatus": 0
+ "id": 0,
+ "username": "string",
+ "firstName": "string",
+ "lastName": "string",
+ "email": "string",
+ "password": "string",
+ "phone": "string",
+ "userStatus": 0
}
-]';
+]'
;
const headers = {
- 'Content-Type':'application/json'
+ 'Content-Type':'application/json'
};
-fetch('http://petstore.swagger.io/v2/user/createWithArray',
+fetch('http://petstore.swagger.io/v2/user/createWithArray',
{
- method: 'POST',
+ method: 'POST',
body: inputBody,
headers: headers
})
-.then(function(res) {
- return res.json();
-}).then(function(body) {
- console.log(body);
+.then(function(res) {
+ return res.json();
+}).then(function(body) {
+ console.log(body);
});
-require 'rest-client'
-require 'json'
+require 'rest-client'
+require 'json'
headers = {
- 'Content-Type' => 'application/json'
+ 'Content-Type' => 'application/json'
}
-result = RestClient.post 'http://petstore.swagger.io/v2/user/createWithArray',
+result = RestClient.post 'http://petstore.swagger.io/v2/user/createWithArray',
params: {
}, headers: headers
-p JSON.parse(result)
+p JSON.parse(result)
import requests
headers = {
- 'Content-Type': 'application/json'
+ 'Content-Type': 'application/json'
}
-r = requests.post('http://petstore.swagger.io/v2/user/createWithArray', headers = headers)
+r = requests.post('http://petstore.swagger.io/v2/user/createWithArray', headers = headers)
-print(r.json())
+print(r.json())
-<?php
-
-require 'vendor/autoload.php';
-
-$headers = array(
- 'Content-Type' => 'application/json',
+ 'application/json',
);
-$client = new \GuzzleHttp\Client();
+$client = new \GuzzleHttp\Client();
// Define array of request body.
-$request_body = array();
+$request_body = array();
try {
- $response = $client->request('POST','http://petstore.swagger.io/v2/user/createWithArray', array(
- 'headers' => $headers,
- 'json' => $request_body,
+ $response = $client->request('POST','http://petstore.swagger.io/v2/user/createWithArray', array(
+ 'headers' => $headers,
+ 'json' => $request_body,
)
);
- print_r($response->getBody()->getContents());
+ print_r($response->getBody()->getContents());
}
- catch (\GuzzleHttp\Exception\BadResponseException $e) {
+ catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
- print_r($e->getMessage());
+ print_r($e->getMessage());
}
// ...
-URL obj = new URL("http://petstore.swagger.io/v2/user/createWithArray");
-HttpURLConnection con = (HttpURLConnection) obj.openConnection();
-con.setRequestMethod("POST");
-int responseCode = con.getResponseCode();
-BufferedReader in = new BufferedReader(
- new InputStreamReader(con.getInputStream()));
+URL obj = new URL("http://petstore.swagger.io/v2/user/createWithArray");
+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) {
+StringBuffer response = new StringBuffer();
+while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
@@ -3473,18 +3375,18 @@ createUsersWithArrayInput
package main
import (
- "bytes"
- "net/http"
+ "bytes"
+ "net/http"
)
func main() {
- headers := map[string][]string{
- "Content-Type": []string{"application/json"},
+ headers := map[string][]string{
+ "Content-Type": []string{"application/json"},
}
- data := bytes.NewBuffer([]byte{jsonReq})
- req, err := http.NewRequest("POST", "http://petstore.swagger.io/v2/user/createWithArray", data)
+ data := bytes.NewBuffer([]byte{jsonReq})
+ req, err := http.NewRequest("POST", "http://petstore.swagger.io/v2/user/createWithArray", data)
req.Header = headers
client := &http.Client{}
@@ -3498,18 +3400,18 @@ createUsersWithArrayInput
Body parameter
-[
- {
- "id": 0,
- "username": "string",
- "firstName": "string",
- "lastName": "string",
- "email": "string",
- "password": "string",
- "phone": "string",
- "userStatus": 0
- }
-]
+[
+ {
+ "id": 0,
+ "username": "string",
+ "firstName": "string",
+ "lastName": "string",
+ "email": "string",
+ "password": "string",
+ "phone": "string",
+ "userStatus": 0
+ }
+]
Parameters
@@ -3561,105 +3463,100 @@ createUsersWithListInput
# You can also use wget
curl -X POST http://petstore.swagger.io/v2/user/createWithList \
- -H 'Content-Type: application/json'
+ -H 'Content-Type: application/json'
-POST http://petstore.swagger.io/v2/user/createWithList HTTP/1.1
-Host: petstore.swagger.io
-Content-Type: application/json
+POST http://petstore.swagger.io/v2/user/createWithList HTTP/1.1
+Host: petstore.swagger.io
+Content-Type: application/json
-const inputBody = '[
+const inputBody = '[
{
- "id": 0,
- "username": "string",
- "firstName": "string",
- "lastName": "string",
- "email": "string",
- "password": "string",
- "phone": "string",
- "userStatus": 0
+ "id": 0,
+ "username": "string",
+ "firstName": "string",
+ "lastName": "string",
+ "email": "string",
+ "password": "string",
+ "phone": "string",
+ "userStatus": 0
}
-]';
+]'
;
const headers = {
- 'Content-Type':'application/json'
+ 'Content-Type':'application/json'
};
-fetch('http://petstore.swagger.io/v2/user/createWithList',
+fetch('http://petstore.swagger.io/v2/user/createWithList',
{
- method: 'POST',
+ method: 'POST',
body: inputBody,
headers: headers
})
-.then(function(res) {
- return res.json();
-}).then(function(body) {
- console.log(body);
+.then(function(res) {
+ return res.json();
+}).then(function(body) {
+ console.log(body);
});
-require 'rest-client'
-require 'json'
+require 'rest-client'
+require 'json'
headers = {
- 'Content-Type' => 'application/json'
+ 'Content-Type' => 'application/json'
}
-result = RestClient.post 'http://petstore.swagger.io/v2/user/createWithList',
+result = RestClient.post 'http://petstore.swagger.io/v2/user/createWithList',
params: {
}, headers: headers
-p JSON.parse(result)
+p JSON.parse(result)
import requests
headers = {
- 'Content-Type': 'application/json'
+ 'Content-Type': 'application/json'
}
-r = requests.post('http://petstore.swagger.io/v2/user/createWithList', headers = headers)
+r = requests.post('http://petstore.swagger.io/v2/user/createWithList', headers = headers)
-print(r.json())
+print(r.json())
-<?php
-
-require 'vendor/autoload.php';
-
-$headers = array(
- 'Content-Type' => 'application/json',
+ 'application/json',
);
-$client = new \GuzzleHttp\Client();
+$client = new \GuzzleHttp\Client();
// Define array of request body.
-$request_body = array();
+$request_body = array();
try {
- $response = $client->request('POST','http://petstore.swagger.io/v2/user/createWithList', array(
- 'headers' => $headers,
- 'json' => $request_body,
+ $response = $client->request('POST','http://petstore.swagger.io/v2/user/createWithList', array(
+ 'headers' => $headers,
+ 'json' => $request_body,
)
);
- print_r($response->getBody()->getContents());
+ print_r($response->getBody()->getContents());
}
- catch (\GuzzleHttp\Exception\BadResponseException $e) {
+ catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
- print_r($e->getMessage());
+ print_r($e->getMessage());
}
// ...
-URL obj = new URL("http://petstore.swagger.io/v2/user/createWithList");
-HttpURLConnection con = (HttpURLConnection) obj.openConnection();
-con.setRequestMethod("POST");
-int responseCode = con.getResponseCode();
-BufferedReader in = new BufferedReader(
- new InputStreamReader(con.getInputStream()));
+URL obj = new URL("http://petstore.swagger.io/v2/user/createWithList");
+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) {
+StringBuffer response = new StringBuffer();
+while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
@@ -3669,18 +3566,18 @@ createUsersWithListInput
package main
import (
- "bytes"
- "net/http"
+ "bytes"
+ "net/http"
)
func main() {
- headers := map[string][]string{
- "Content-Type": []string{"application/json"},
+ headers := map[string][]string{
+ "Content-Type": []string{"application/json"},
}
- data := bytes.NewBuffer([]byte{jsonReq})
- req, err := http.NewRequest("POST", "http://petstore.swagger.io/v2/user/createWithList", data)
+ data := bytes.NewBuffer([]byte{jsonReq})
+ req, err := http.NewRequest("POST", "http://petstore.swagger.io/v2/user/createWithList", data)
req.Header = headers
client := &http.Client{}
@@ -3694,18 +3591,18 @@ createUsersWithListInput
Body parameter
-[
- {
- "id": 0,
- "username": "string",
- "firstName": "string",
- "lastName": "string",
- "email": "string",
- "password": "string",
- "phone": "string",
- "userStatus": 0
- }
-]
+[
+ {
+ "id": 0,
+ "username": "string",
+ "firstName": "string",
+ "lastName": "string",
+ "email": "string",
+ "password": "string",
+ "phone": "string",
+ "userStatus": 0
+ }
+]
Parameters
@@ -3757,98 +3654,93 @@ loginUser
# You can also use wget
curl -X GET http://petstore.swagger.io/v2/user/login?username=string&password=pa%24%24word \
- -H 'Accept: application/xml'
+ -H 'Accept: application/xml'
-GET http://petstore.swagger.io/v2/user/login?username=string&password=pa%24%24word HTTP/1.1
-Host: petstore.swagger.io
-Accept: application/xml
+GET http://petstore.swagger.io/v2/user/login?username=string&password=pa%24%24word HTTP/1.1
+Host: petstore.swagger.io
+Accept: application/xml
const headers = {
- 'Accept':'application/xml'
+ 'Accept':'application/xml'
};
-fetch('http://petstore.swagger.io/v2/user/login?username=string&password=pa%24%24word',
+fetch('http://petstore.swagger.io/v2/user/login?username=string&password=pa%24%24word',
{
- method: 'GET',
+ method: 'GET',
headers: headers
})
-.then(function(res) {
- return res.json();
-}).then(function(body) {
- console.log(body);
+.then(function(res) {
+ return res.json();
+}).then(function(body) {
+ console.log(body);
});
-require 'rest-client'
-require 'json'
+require 'rest-client'
+require 'json'
headers = {
- 'Accept' => 'application/xml'
+ 'Accept' => 'application/xml'
}
-result = RestClient.get 'http://petstore.swagger.io/v2/user/login',
+result = RestClient.get 'http://petstore.swagger.io/v2/user/login',
params: {
- 'username' => 'string',
-'password' => 'string(password)'
+ 'username' => 'string',
+'password' => 'string(password)'
}, headers: headers
-p JSON.parse(result)
+p JSON.parse(result)
import requests
headers = {
- 'Accept': 'application/xml'
+ 'Accept': 'application/xml'
}
-r = requests.get('http://petstore.swagger.io/v2/user/login', params={
- 'username': 'string', 'password': 'pa$$word'
+r = requests.get('http://petstore.swagger.io/v2/user/login', params={
+ 'username': 'string', 'password': 'pa$$word'
}, headers = headers)
-print(r.json())
+print(r.json())
-<?php
-
-require 'vendor/autoload.php';
-
-$headers = array(
- 'Accept' => 'application/xml',
+ 'application/xml',
);
-$client = new \GuzzleHttp\Client();
+$client = new \GuzzleHttp\Client();
// Define array of request body.
-$request_body = array();
+$request_body = array();
try {
- $response = $client->request('GET','http://petstore.swagger.io/v2/user/login', array(
- 'headers' => $headers,
- 'json' => $request_body,
+ $response = $client->request('GET','http://petstore.swagger.io/v2/user/login', array(
+ 'headers' => $headers,
+ 'json' => $request_body,
)
);
- print_r($response->getBody()->getContents());
+ print_r($response->getBody()->getContents());
}
- catch (\GuzzleHttp\Exception\BadResponseException $e) {
+ catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
- print_r($e->getMessage());
+ print_r($e->getMessage());
}
// ...
-URL obj = new URL("http://petstore.swagger.io/v2/user/login?username=string&password=pa%24%24word");
-HttpURLConnection con = (HttpURLConnection) obj.openConnection();
-con.setRequestMethod("GET");
-int responseCode = con.getResponseCode();
-BufferedReader in = new BufferedReader(
- new InputStreamReader(con.getInputStream()));
+URL obj = new URL("http://petstore.swagger.io/v2/user/login?username=string&password=pa%24%24word");
+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) {
+StringBuffer response = new StringBuffer();
+while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
@@ -3858,18 +3750,18 @@ loginUser
package main
import (
- "bytes"
- "net/http"
+ "bytes"
+ "net/http"
)
func main() {
- headers := map[string][]string{
- "Accept": []string{"application/xml"},
+ headers := map[string][]string{
+ "Accept": []string{"application/xml"},
}
- data := bytes.NewBuffer([]byte{jsonReq})
- req, err := http.NewRequest("GET", "http://petstore.swagger.io/v2/user/login", data)
+ data := bytes.NewBuffer([]byte{jsonReq})
+ req, err := http.NewRequest("GET", "http://petstore.swagger.io/v2/user/login", data)
req.Header = headers
client := &http.Client{}
@@ -3914,7 +3806,7 @@ Parameters
200 Response
-