NAV
Shell HTTP JavaScript Node.JS Python Ruby Java

Swagger Petstore v1.0.0

This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key special-key to test the authorization filters.

Base URL = http://petstore.swagger.io/v2

Terms of service Email: Support License: Apache 2.0

Authentication

Scope Scope Description
write:pets modify pets in your account
read:pets read your pets

pet

Everything about your Pets

Find out more

addPet

Code samples

# You can also use wget
curl -X post http://petstore.swagger.io/v2/pet
POST http://petstore.swagger.io/v2/pet HTTP/1.1
Host: petstore.swagger.io
Content-Type: application/json
Accept: application/xml
<script>
  $.ajax({
    url: 'http://petstore.swagger.io/v2/pet',
    method: 'post',
    success: function(data) {
      console.log(JSON.stringify(data));
    }
  })
</script>
const request = require('node-fetch');
fetch('http://petstore.swagger.io/v2/pet', { method: 'POST'})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

result = RestClient.post 'http://petstore.swagger.io/v2/pet', params:
  {
    # TODO
  }

p JSON.parse(result)
import requests

r = requests.post('http://petstore.swagger.io/v2/pet', params={
  # TODO
})

print r.json()
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) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /pet

Add a new pet to the store

Parameters

Parameter In Type Required Description
body body Pet true Pet object that needs to be added to the store

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" ?>
<Pet>
  <id>0</id>
  <category>
    <id>0</id>
    <name>string</name>
  </category>
  <name>doggie</name>
  <photoUrls>string</photoUrls>
  <tags>
    <id>0</id>
    <name>string</name>
  </tags>
  <status>available</status>
</Pet>

Responses

Status Meaning Description
405 Method Not Allowed Invalid input

updatePet

Code samples

# You can also use wget
curl -X put http://petstore.swagger.io/v2/pet
PUT http://petstore.swagger.io/v2/pet HTTP/1.1
Host: petstore.swagger.io
Content-Type: application/json
Accept: application/xml
<script>
  $.ajax({
    url: 'http://petstore.swagger.io/v2/pet',
    method: 'put',
    success: function(data) {
      console.log(JSON.stringify(data));
    }
  })
</script>
const request = require('node-fetch');
fetch('http://petstore.swagger.io/v2/pet', { method: 'PUT'})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

result = RestClient.put 'http://petstore.swagger.io/v2/pet', params:
  {
    # TODO
  }

p JSON.parse(result)
import requests

r = requests.put('http://petstore.swagger.io/v2/pet', params={
  # TODO
})

print r.json()
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) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

PUT /pet

Update an existing pet

Parameters

Parameter In Type Required Description
body body Pet true Pet object that needs to be added to the store

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" ?>
<Pet>
  <id>0</id>
  <category>
    <id>0</id>
    <name>string</name>
  </category>
  <name>doggie</name>
  <photoUrls>string</photoUrls>
  <tags>
    <id>0</id>
    <name>string</name>
  </tags>
  <status>available</status>
</Pet>

Responses

Status Meaning Description
400 Bad Request Invalid ID supplied
404 Not Found Pet not found
405 Method Not Allowed Validation exception

findPetsByStatus

Code samples

# You can also use wget
curl -X get http://petstore.swagger.io/v2/pet/findByStatus
GET http://petstore.swagger.io/v2/pet/findByStatus HTTP/1.1
Host: petstore.swagger.io
Content-Type: application/xml
Accept: application/xml
<script>
  $.ajax({
    url: 'http://petstore.swagger.io/v2/pet/findByStatus',
    method: 'get',
    success: function(data) {
      console.log(JSON.stringify(data));
    }
  })
</script>
const request = require('node-fetch');
fetch('http://petstore.swagger.io/v2/pet/findByStatus', { method: 'GET'})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

result = RestClient.get 'http://petstore.swagger.io/v2/pet/findByStatus', params:
  {
    # TODO
  }

p JSON.parse(result)
import requests

r = requests.get('http://petstore.swagger.io/v2/pet/findByStatus', params={
  # TODO
})

print r.json()
URL obj = new URL("http://petstore.swagger.io/v2/pet/findByStatus");
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());

GET /pet/findByStatus

Finds Pets by status

Multiple status values can be provided with comma separated strings

Parameters

Parameter In Type Required Description
status query array[string] true Status values that need to be considered for filter

Responses

Status Meaning Description
200 OK successful operation
400 Bad Request Invalid status value

Example responses

[
  {
    "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</id>
<category>
  <id>0</id>
  <name>string</name>
</category>
<name>doggie</name>
<photoUrls>string</photoUrls>
<tags>
  <id>0</id>
  <name>string</name>
</tags>
<status>available</status>

findPetsByTags

Code samples

# You can also use wget
curl -X get http://petstore.swagger.io/v2/pet/findByTags
GET http://petstore.swagger.io/v2/pet/findByTags HTTP/1.1
Host: petstore.swagger.io
Content-Type: application/xml
Accept: application/xml
<script>
  $.ajax({
    url: 'http://petstore.swagger.io/v2/pet/findByTags',
    method: 'get',
    success: function(data) {
      console.log(JSON.stringify(data));
    }
  })
</script>
const request = require('node-fetch');
fetch('http://petstore.swagger.io/v2/pet/findByTags', { method: 'GET'})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

result = RestClient.get 'http://petstore.swagger.io/v2/pet/findByTags', params:
  {
    # TODO
  }

p JSON.parse(result)
import requests

r = requests.get('http://petstore.swagger.io/v2/pet/findByTags', params={
  # TODO
})

print r.json()
URL obj = new URL("http://petstore.swagger.io/v2/pet/findByTags");
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());

GET /pet/findByTags

Finds Pets by tags

Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.

Parameters

Parameter In Type Required Description
tags query array[string] true Tags to filter by

Responses

Status Meaning Description
200 OK successful operation
400 Bad Request Invalid tag value

Example responses

[
  {
    "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</id>
<category>
  <id>0</id>
  <name>string</name>
</category>
<name>doggie</name>
<photoUrls>string</photoUrls>
<tags>
  <id>0</id>
  <name>string</name>
</tags>
<status>available</status>

getPetById

Code samples

# You can also use wget
curl -X get http://petstore.swagger.io/v2/pet/{petId}
GET http://petstore.swagger.io/v2/pet/{petId} HTTP/1.1
Host: petstore.swagger.io
Content-Type: application/xml
Accept: application/xml
<script>
  $.ajax({
    url: 'http://petstore.swagger.io/v2/pet/{petId}',
    method: 'get',
    success: function(data) {
      console.log(JSON.stringify(data));
    }
  })
</script>
const request = require('node-fetch');
fetch('http://petstore.swagger.io/v2/pet/{petId}', { method: 'GET'})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

result = RestClient.get 'http://petstore.swagger.io/v2/pet/{petId}', params:
  {
    # TODO
  }

p JSON.parse(result)
import requests

r = requests.get('http://petstore.swagger.io/v2/pet/{petId}', params={
  # TODO
})

print r.json()
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) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /pet/{petId}

Find pet by ID

Returns a single pet

Parameters

Parameter In Type Required Description
petId path integer true ID of pet to return

Responses

Status Meaning Description
200 OK successful operation
400 Bad Request Invalid ID supplied
404 Not Found Pet not found

Example responses

{
  "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>
    <id>0</id>
    <name>string</name>
  </category>
  <name>doggie</name>
  <photoUrls>string</photoUrls>
  <tags>
    <id>0</id>
    <name>string</name>
  </tags>
  <status>available</status>
</Pet>

updatePetWithForm

Code samples

# You can also use wget
curl -X post http://petstore.swagger.io/v2/pet/{petId}
POST http://petstore.swagger.io/v2/pet/{petId} HTTP/1.1
Host: petstore.swagger.io
Content-Type: application/x-www-form-urlencoded
Accept: application/xml
<script>
  $.ajax({
    url: 'http://petstore.swagger.io/v2/pet/{petId}',
    method: 'post',
    success: function(data) {
      console.log(JSON.stringify(data));
    }
  })
</script>
const request = require('node-fetch');
fetch('http://petstore.swagger.io/v2/pet/{petId}', { method: 'POST'})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

result = RestClient.post 'http://petstore.swagger.io/v2/pet/{petId}', params:
  {
    # TODO
  }

p JSON.parse(result)
import requests

r = requests.post('http://petstore.swagger.io/v2/pet/{petId}', params={
  # TODO
})

print r.json()
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) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /pet/{petId}

Updates a pet in the store with form data

Parameters

Parameter In Type Required Description
petId path integer true ID of pet that needs to be updated
name formData string false Updated name of the pet
status formData string false Updated status of the pet

Responses

Status Meaning Description
405 Method Not Allowed Invalid input

deletePet

Code samples

# You can also use wget
curl -X delete http://petstore.swagger.io/v2/pet/{petId}
DELETE http://petstore.swagger.io/v2/pet/{petId} HTTP/1.1
Host: petstore.swagger.io
Content-Type: application/xml
Accept: application/xml
<script>
  $.ajax({
    url: 'http://petstore.swagger.io/v2/pet/{petId}',
    method: 'delete',
    success: function(data) {
      console.log(JSON.stringify(data));
    }
  })
</script>
const request = require('node-fetch');
fetch('http://petstore.swagger.io/v2/pet/{petId}', { method: 'DELETE'})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

result = RestClient.delete 'http://petstore.swagger.io/v2/pet/{petId}', params:
  {
    # TODO
  }

p JSON.parse(result)
import requests

r = requests.delete('http://petstore.swagger.io/v2/pet/{petId}', params={
  # TODO
})

print r.json()
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) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

DELETE /pet/{petId}

Deletes a pet

Parameters

Parameter In Type Required Description
api_key header string false No description
petId path integer true Pet id to delete

Responses

Status Meaning Description
400 Bad Request Invalid ID supplied
404 Not Found Pet not found

uploadFile

Code samples

# You can also use wget
curl -X post http://petstore.swagger.io/v2/pet/{petId}/uploadImage
POST http://petstore.swagger.io/v2/pet/{petId}/uploadImage HTTP/1.1
Host: petstore.swagger.io
Content-Type: multipart/form-data
Accept: application/json
<script>
  $.ajax({
    url: 'http://petstore.swagger.io/v2/pet/{petId}/uploadImage',
    method: 'post',
    success: function(data) {
      console.log(JSON.stringify(data));
    }
  })
</script>
const request = require('node-fetch');
fetch('http://petstore.swagger.io/v2/pet/{petId}/uploadImage', { method: 'POST'})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

result = RestClient.post 'http://petstore.swagger.io/v2/pet/{petId}/uploadImage', params:
  {
    # TODO
  }

p JSON.parse(result)
import requests

r = requests.post('http://petstore.swagger.io/v2/pet/{petId}/uploadImage', params={
  # TODO
})

print r.json()
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) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /pet/{petId}/uploadImage

uploads an image

Parameters

Parameter In Type Required Description
petId path integer true ID of pet to update
additionalMetadata formData string false Additional data to pass to server
file formData file false file to upload

Responses

Status Meaning Description
200 OK successful operation

Example responses

{
  "code": 0,
  "type": "string",
  "message": "string"
}

store

Access to Petstore orders

getInventory

Code samples

# You can also use wget
curl -X get http://petstore.swagger.io/v2/store/inventory
GET http://petstore.swagger.io/v2/store/inventory HTTP/1.1
Host: petstore.swagger.io
Content-Type: application/json
Accept: application/json
<script>
  $.ajax({
    url: 'http://petstore.swagger.io/v2/store/inventory',
    method: 'get',
    success: function(data) {
      console.log(JSON.stringify(data));
    }
  })
</script>
const request = require('node-fetch');
fetch('http://petstore.swagger.io/v2/store/inventory', { method: 'GET'})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

result = RestClient.get 'http://petstore.swagger.io/v2/store/inventory', params:
  {
    # TODO
  }

p JSON.parse(result)
import requests

r = requests.get('http://petstore.swagger.io/v2/store/inventory', params={
  # TODO
})

print r.json()
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) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /store/inventory

Returns pet inventories by status

Returns a map of status codes to quantities

Responses

Status Meaning Description
200 OK successful operation

Example responses

{
  "property1": 0,
  "property2": 0
}

placeOrder

Code samples

# You can also use wget
curl -X post http://petstore.swagger.io/v2/store/order
POST http://petstore.swagger.io/v2/store/order HTTP/1.1
Host: petstore.swagger.io
Content-Type: application/xml
Accept: application/xml
<script>
  $.ajax({
    url: 'http://petstore.swagger.io/v2/store/order',
    method: 'post',
    success: function(data) {
      console.log(JSON.stringify(data));
    }
  })
</script>
const request = require('node-fetch');
fetch('http://petstore.swagger.io/v2/store/order', { method: 'POST'})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

result = RestClient.post 'http://petstore.swagger.io/v2/store/order', params:
  {
    # TODO
  }

p JSON.parse(result)
import requests

r = requests.post('http://petstore.swagger.io/v2/store/order', params={
  # TODO
})

print r.json()
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) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /store/order

Place an order for a pet

Parameters

Parameter In Type Required Description
body body Order true order placed for purchasing the pet

Body parameter

{
  "id": 0,
  "petId": 0,
  "quantity": 0,
  "shipDate": "2016-12-29T09:23:22Z",
  "status": "placed",
  "complete": false
}
<?xml version="1.0" encoding="UTF-8" ?>
<Order>
  <id>0</id>
  <petId>0</petId>
  <quantity>0</quantity>
  <shipDate>2016-12-29T09:23:22Z</shipDate>
  <status>placed</status>
  <complete>false</complete>
</Order>

Responses

Status Meaning Description
200 OK successful operation
400 Bad Request Invalid Order

Example responses

{
  "id": 0,
  "petId": 0,
  "quantity": 0,
  "shipDate": "2016-12-29T09:23:22Z",
  "status": "placed",
  "complete": false
}
<?xml version="1.0" encoding="UTF-8" ?>
<Order>
  <id>0</id>
  <petId>0</petId>
  <quantity>0</quantity>
  <shipDate>2016-12-29T09:23:22Z</shipDate>
  <status>placed</status>
  <complete>false</complete>
</Order>

getOrderById

Code samples

# You can also use wget
curl -X get http://petstore.swagger.io/v2/store/order/{orderId}
GET http://petstore.swagger.io/v2/store/order/{orderId} HTTP/1.1
Host: petstore.swagger.io
Content-Type: application/xml
Accept: application/xml
<script>
  $.ajax({
    url: 'http://petstore.swagger.io/v2/store/order/{orderId}',
    method: 'get',
    success: function(data) {
      console.log(JSON.stringify(data));
    }
  })
</script>
const request = require('node-fetch');
fetch('http://petstore.swagger.io/v2/store/order/{orderId}', { method: 'GET'})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

result = RestClient.get 'http://petstore.swagger.io/v2/store/order/{orderId}', params:
  {
    # TODO
  }

p JSON.parse(result)
import requests

r = requests.get('http://petstore.swagger.io/v2/store/order/{orderId}', params={
  # TODO
})

print r.json()
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) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /store/order/{orderId}

Find purchase order by ID

For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions

Parameters

Parameter In Type Required Description
orderId path integer true ID of pet that needs to be fetched

Responses

Status Meaning Description
200 OK successful operation
400 Bad Request Invalid ID supplied
404 Not Found Order not found

Example responses

{
  "id": 0,
  "petId": 0,
  "quantity": 0,
  "shipDate": "2016-12-29T09:23:22Z",
  "status": "placed",
  "complete": false
}
<?xml version="1.0" encoding="UTF-8" ?>
<Order>
  <id>0</id>
  <petId>0</petId>
  <quantity>0</quantity>
  <shipDate>2016-12-29T09:23:22Z</shipDate>
  <status>placed</status>
  <complete>false</complete>
</Order>

deleteOrder

Code samples

# You can also use wget
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
Content-Type: application/xml
Accept: application/xml
<script>
  $.ajax({
    url: 'http://petstore.swagger.io/v2/store/order/{orderId}',
    method: 'delete',
    success: function(data) {
      console.log(JSON.stringify(data));
    }
  })
</script>
const request = require('node-fetch');
fetch('http://petstore.swagger.io/v2/store/order/{orderId}', { method: 'DELETE'})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

result = RestClient.delete 'http://petstore.swagger.io/v2/store/order/{orderId}', params:
  {
    # TODO
  }

p JSON.parse(result)
import requests

r = requests.delete('http://petstore.swagger.io/v2/store/order/{orderId}', params={
  # TODO
})

print r.json()
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) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

DELETE /store/order/{orderId}

Delete purchase order by ID

For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors

Parameters

Parameter In Type Required Description
orderId path integer true ID of the order that needs to be deleted

Responses

Status Meaning Description
400 Bad Request Invalid ID supplied
404 Not Found Order not found

user

Operations about user

Find out more about our store

createUser

Code samples

# You can also use wget
curl -X post http://petstore.swagger.io/v2/user
POST http://petstore.swagger.io/v2/user HTTP/1.1
Host: petstore.swagger.io
Content-Type: application/xml
Accept: application/xml
<script>
  $.ajax({
    url: 'http://petstore.swagger.io/v2/user',
    method: 'post',
    success: function(data) {
      console.log(JSON.stringify(data));
    }
  })
</script>
const request = require('node-fetch');
fetch('http://petstore.swagger.io/v2/user', { method: 'POST'})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

result = RestClient.post 'http://petstore.swagger.io/v2/user', params:
  {
    # TODO
  }

p JSON.parse(result)
import requests

r = requests.post('http://petstore.swagger.io/v2/user', params={
  # TODO
})

print r.json()
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) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /user

Create user

This can only be done by the logged in user.

Parameters

Parameter In Type Required Description
body body User true Created user object

Body parameter

{
  "id": 0,
  "username": "string",
  "firstName": "string",
  "lastName": "string",
  "email": "string",
  "password": "string",
  "phone": "string",
  "userStatus": 0
}
<?xml version="1.0" encoding="UTF-8" ?>
<User>
  <id>0</id>
  <username>string</username>
  <firstName>string</firstName>
  <lastName>string</lastName>
  <email>string</email>
  <password>string</password>
  <phone>string</phone>
  <userStatus>0</userStatus>
</User>

Responses

Status Meaning Description
default Default successful operation

createUsersWithArrayInput

Code samples

# You can also use wget
curl -X post http://petstore.swagger.io/v2/user/createWithArray
POST http://petstore.swagger.io/v2/user/createWithArray HTTP/1.1
Host: petstore.swagger.io
Content-Type: application/xml
Accept: application/xml
<script>
  $.ajax({
    url: 'http://petstore.swagger.io/v2/user/createWithArray',
    method: 'post',
    success: function(data) {
      console.log(JSON.stringify(data));
    }
  })
</script>
const request = require('node-fetch');
fetch('http://petstore.swagger.io/v2/user/createWithArray', { method: 'POST'})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

result = RestClient.post 'http://petstore.swagger.io/v2/user/createWithArray', params:
  {
    # TODO
  }

p JSON.parse(result)
import requests

r = requests.post('http://petstore.swagger.io/v2/user/createWithArray', params={
  # TODO
})

print r.json()
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) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /user/createWithArray

Creates list of users with given input array

Parameters

Parameter In Type Required Description
body body array[User] true List of user object

Body parameter

[
  {
    "id": 0,
    "username": "string",
    "firstName": "string",
    "lastName": "string",
    "email": "string",
    "password": "string",
    "phone": "string",
    "userStatus": 0
  }
]
<?xml version="1.0" encoding="UTF-8" ?>
<id>0</id>
<username>string</username>
<firstName>string</firstName>
<lastName>string</lastName>
<email>string</email>
<password>string</password>
<phone>string</phone>
<userStatus>0</userStatus>

Responses

Status Meaning Description
default Default successful operation

createUsersWithListInput

Code samples

# You can also use wget
curl -X post http://petstore.swagger.io/v2/user/createWithList
POST http://petstore.swagger.io/v2/user/createWithList HTTP/1.1
Host: petstore.swagger.io
Content-Type: application/xml
Accept: application/xml
<script>
  $.ajax({
    url: 'http://petstore.swagger.io/v2/user/createWithList',
    method: 'post',
    success: function(data) {
      console.log(JSON.stringify(data));
    }
  })
</script>
const request = require('node-fetch');
fetch('http://petstore.swagger.io/v2/user/createWithList', { method: 'POST'})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

result = RestClient.post 'http://petstore.swagger.io/v2/user/createWithList', params:
  {
    # TODO
  }

p JSON.parse(result)
import requests

r = requests.post('http://petstore.swagger.io/v2/user/createWithList', params={
  # TODO
})

print r.json()
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) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /user/createWithList

Creates list of users with given input array

Parameters

Parameter In Type Required Description
body body array[User] true List of user object

Body parameter

[
  {
    "id": 0,
    "username": "string",
    "firstName": "string",
    "lastName": "string",
    "email": "string",
    "password": "string",
    "phone": "string",
    "userStatus": 0
  }
]
<?xml version="1.0" encoding="UTF-8" ?>
<id>0</id>
<username>string</username>
<firstName>string</firstName>
<lastName>string</lastName>
<email>string</email>
<password>string</password>
<phone>string</phone>
<userStatus>0</userStatus>

Responses

Status Meaning Description
default Default successful operation

loginUser

Code samples

# You can also use wget
curl -X get http://petstore.swagger.io/v2/user/login
GET http://petstore.swagger.io/v2/user/login HTTP/1.1
Host: petstore.swagger.io
Content-Type: application/xml
Accept: application/xml
<script>
  $.ajax({
    url: 'http://petstore.swagger.io/v2/user/login',
    method: 'get',
    success: function(data) {
      console.log(JSON.stringify(data));
    }
  })
</script>
const request = require('node-fetch');
fetch('http://petstore.swagger.io/v2/user/login', { method: 'GET'})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

result = RestClient.get 'http://petstore.swagger.io/v2/user/login', params:
  {
    # TODO
  }

p JSON.parse(result)
import requests

r = requests.get('http://petstore.swagger.io/v2/user/login', params={
  # TODO
})

print r.json()
URL obj = new URL("http://petstore.swagger.io/v2/user/login");
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());

GET /user/login

Logs user into the system

Parameters

Parameter In Type Required Description
username query string true The user name for login
password query string true The password for login in clear text

Responses

Status Meaning Description
200 OK successful operation
400 Bad Request Invalid username/password supplied

Response Headers

Status Header Type Format Description
200 X-Rate-Limit integer int32 calls per hour allowed by the user
200 X-Expires-After string date-time date in UTC when token expires

Example responses

"string"

logoutUser

Code samples

# You can also use wget
curl -X get http://petstore.swagger.io/v2/user/logout
GET http://petstore.swagger.io/v2/user/logout HTTP/1.1
Host: petstore.swagger.io
Content-Type: application/xml
Accept: application/xml
<script>
  $.ajax({
    url: 'http://petstore.swagger.io/v2/user/logout',
    method: 'get',
    success: function(data) {
      console.log(JSON.stringify(data));
    }
  })
</script>
const request = require('node-fetch');
fetch('http://petstore.swagger.io/v2/user/logout', { method: 'GET'})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

result = RestClient.get 'http://petstore.swagger.io/v2/user/logout', params:
  {
    # TODO
  }

p JSON.parse(result)
import requests

r = requests.get('http://petstore.swagger.io/v2/user/logout', params={
  # TODO
})

print r.json()
URL obj = new URL("http://petstore.swagger.io/v2/user/logout");
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());

GET /user/logout

Logs out current logged in user session

Responses

Status Meaning Description
default Default successful operation

getUserByName

Code samples

# You can also use wget
curl -X get http://petstore.swagger.io/v2/user/{username}
GET http://petstore.swagger.io/v2/user/{username} HTTP/1.1
Host: petstore.swagger.io
Content-Type: application/xml
Accept: application/xml
<script>
  $.ajax({
    url: 'http://petstore.swagger.io/v2/user/{username}',
    method: 'get',
    success: function(data) {
      console.log(JSON.stringify(data));
    }
  })
</script>
const request = require('node-fetch');
fetch('http://petstore.swagger.io/v2/user/{username}', { method: 'GET'})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

result = RestClient.get 'http://petstore.swagger.io/v2/user/{username}', params:
  {
    # TODO
  }

p JSON.parse(result)
import requests

r = requests.get('http://petstore.swagger.io/v2/user/{username}', params={
  # TODO
})

print r.json()
URL obj = new URL("http://petstore.swagger.io/v2/user/{username}");
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());

GET /user/{username}

Get user by user name

Parameters

Parameter In Type Required Description
username path string true The name that needs to be fetched. Use user1 for testing.

Responses

Status Meaning Description
200 OK successful operation
400 Bad Request Invalid username supplied
404 Not Found User not found

Example responses

{
  "id": 0,
  "username": "string",
  "firstName": "string",
  "lastName": "string",
  "email": "string",
  "password": "string",
  "phone": "string",
  "userStatus": 0
}
<?xml version="1.0" encoding="UTF-8" ?>
<User>
  <id>0</id>
  <username>string</username>
  <firstName>string</firstName>
  <lastName>string</lastName>
  <email>string</email>
  <password>string</password>
  <phone>string</phone>
  <userStatus>0</userStatus>
</User>

updateUser

Code samples

# You can also use wget
curl -X put http://petstore.swagger.io/v2/user/{username}
PUT http://petstore.swagger.io/v2/user/{username} HTTP/1.1
Host: petstore.swagger.io
Content-Type: application/xml
Accept: application/xml
<script>
  $.ajax({
    url: 'http://petstore.swagger.io/v2/user/{username}',
    method: 'put',
    success: function(data) {
      console.log(JSON.stringify(data));
    }
  })
</script>
const request = require('node-fetch');
fetch('http://petstore.swagger.io/v2/user/{username}', { method: 'PUT'})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

result = RestClient.put 'http://petstore.swagger.io/v2/user/{username}', params:
  {
    # TODO
  }

p JSON.parse(result)
import requests

r = requests.put('http://petstore.swagger.io/v2/user/{username}', params={
  # TODO
})

print r.json()
URL obj = new URL("http://petstore.swagger.io/v2/user/{username}");
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) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

PUT /user/{username}

Updated user

This can only be done by the logged in user.

Parameters

Parameter In Type Required Description
username path string true name that need to be updated
body body User true Updated user object

Body parameter

{
  "id": 0,
  "username": "string",
  "firstName": "string",
  "lastName": "string",
  "email": "string",
  "password": "string",
  "phone": "string",
  "userStatus": 0
}
<?xml version="1.0" encoding="UTF-8" ?>
<User>
  <id>0</id>
  <username>string</username>
  <firstName>string</firstName>
  <lastName>string</lastName>
  <email>string</email>
  <password>string</password>
  <phone>string</phone>
  <userStatus>0</userStatus>
</User>

Responses

Status Meaning Description
400 Bad Request Invalid user supplied
404 Not Found User not found

deleteUser

Code samples

# You can also use wget
curl -X delete http://petstore.swagger.io/v2/user/{username}
DELETE http://petstore.swagger.io/v2/user/{username} HTTP/1.1
Host: petstore.swagger.io
Content-Type: application/xml
Accept: application/xml
<script>
  $.ajax({
    url: 'http://petstore.swagger.io/v2/user/{username}',
    method: 'delete',
    success: function(data) {
      console.log(JSON.stringify(data));
    }
  })
</script>
const request = require('node-fetch');
fetch('http://petstore.swagger.io/v2/user/{username}', { method: 'DELETE'})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

result = RestClient.delete 'http://petstore.swagger.io/v2/user/{username}', params:
  {
    # TODO
  }

p JSON.parse(result)
import requests

r = requests.delete('http://petstore.swagger.io/v2/user/{username}', params={
  # TODO
})

print r.json()
URL obj = new URL("http://petstore.swagger.io/v2/user/{username}");
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());

DELETE /user/{username}

Delete user

This can only be done by the logged in user.

Parameters

Parameter In Type Required Description
username path string true The name that needs to be deleted

Responses

Status Meaning Description
400 Bad Request Invalid username supplied
404 Not Found User not found