Swagger Petstore v1.0.0
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
This is a sample Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger.
Base URLs:
Terms of service Email: Support License: Apache 2.0
Authentication
-
oAuth2 authentication.
- Flow: implicit
- Authorization URL = http://petstore.swagger.io/oauth/dialog
Scope | Scope Description |
---|---|
write:pets | modify pets in your account |
read:pets | read your pets |
- API Key (api_key)
- Parameter Name: api_key, in: header.
pet
Everything about your Pets
Add a new pet to the store
Code samples
curl --request POST \
--url https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/pet \
--header 'authorization: Bearer {access-token}' \
--header 'content-type: application/json' \
--data '{"id":0,"category":{"id":0,"name":"string"},"name":"doggie","photoUrls":["string"],"tags":[{"id":0,"name":"string"}],"status":"available"}'
var data = JSON.stringify({
"id": 0,
"category": {
"id": 0,
"name": "string"
},
"name": "doggie",
"photoUrls": [
"string"
],
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "available"
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/pet");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Bearer {access-token}");
xhr.send(data);
POST /pet
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>
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | Pet | true | Pet object that needs to be added to the store |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
405 | Method Not Allowed | Invalid input | None |
Update an existing pet
Code samples
curl --request PUT \
--url https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/pet \
--header 'authorization: Bearer {access-token}' \
--header 'content-type: application/json' \
--data '{"id":0,"category":{"id":0,"name":"string"},"name":"doggie","photoUrls":["string"],"tags":[{"id":0,"name":"string"}],"status":"available"}'
var data = JSON.stringify({
"id": 0,
"category": {
"id": 0,
"name": "string"
},
"name": "doggie",
"photoUrls": [
"string"
],
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "available"
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("PUT", "https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/pet");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Bearer {access-token}");
xhr.send(data);
PUT /pet
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>
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | Pet | true | Pet object that needs to be added to the store |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
400 | Bad Request | Invalid ID supplied | None |
404 | Not Found | Pet not found | None |
405 | Method Not Allowed | Validation exception | None |
Finds Pets by status
Code samples
curl --request GET \
--url 'https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/pet/findByStatus?status=available' \
--header 'accept: application/json' \
--header 'authorization: Bearer {access-token}'
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/pet/findByStatus?status=available");
xhr.setRequestHeader("accept", "application/json");
xhr.setRequestHeader("authorization", "Bearer {access-token}");
xhr.send(data);
GET /pet/findByStatus
Multiple status values can be provided with comma separated strings
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
status | query | array[string] | true | Status values that need to be considered for filter |
Enumerated Values
Parameter | Value |
---|---|
status | available |
status | pending |
status | sold |
Example responses
200 Response
[
{
"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>
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Inline |
400 | Bad Request | Invalid status value | None |
Response Schema
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [Pet] | false | none | none |
» id | integer(int64) | false | none | none |
» category | Category | false | none | none |
»» id | integer(int64) | false | none | none |
»» name | string | false | none | none |
» name | string | true | none | none |
» photoUrls | [string] | true | none | none |
» tags | [Tag] | false | none | none |
»» id | integer(int64) | false | none | none |
»» name | string | false | none | none |
» status | string | false | none | pet status in the store |
Enumerated Values
Property | Value |
---|---|
status | available |
status | pending |
status | sold |
Finds Pets by tags
Code samples
curl --request GET \
--url 'https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/pet/findByTags?tags=string' \
--header 'accept: application/json' \
--header 'authorization: Bearer {access-token}'
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/pet/findByTags?tags=string");
xhr.setRequestHeader("accept", "application/json");
xhr.setRequestHeader("authorization", "Bearer {access-token}");
xhr.send(data);
GET /pet/findByTags
Muliple tags can be provided with comma separated strings. Use\ \ tag1, tag2, tag3 for testing.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
tags | query | array[string] | true | Tags to filter by |
Example responses
200 Response
[
{
"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>
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Inline |
400 | Bad Request | Invalid tag value | None |
Response Schema
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [Pet] | false | none | none |
» id | integer(int64) | false | none | none |
» category | Category | false | none | none |
»» id | integer(int64) | false | none | none |
»» name | string | false | none | none |
» name | string | true | none | none |
» photoUrls | [string] | true | none | none |
» tags | [Tag] | false | none | none |
»» id | integer(int64) | false | none | none |
»» name | string | false | none | none |
» status | string | false | none | pet status in the store |
Enumerated Values
Property | Value |
---|---|
status | available |
status | pending |
status | sold |
Find pet by ID
Code samples
curl --request GET \
--url https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/pet/0 \
--header 'accept: application/json' \
--header 'api_key: API_KEY'
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/pet/0");
xhr.setRequestHeader("accept", "application/json");
xhr.setRequestHeader("api_key", "API_KEY");
xhr.send(data);
GET /pet/{petId}
Returns a single pet
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
petId | path | integer(int64) | true | ID of pet to return |
Example responses
200 Response
{
"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 | Schema |
---|---|---|---|
200 | OK | successful operation | Pet |
400 | Bad Request | Invalid ID supplied | None |
404 | Not Found | Pet not found | None |
Updates a pet in the store with form data
Code samples
curl --request POST \
--url https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/pet/0 \
--header 'authorization: Bearer {access-token}' \
--header 'content-type: application/x-www-form-urlencoded'
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/pet/0");
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");
xhr.setRequestHeader("authorization", "Bearer {access-token}");
xhr.send(data);
POST /pet/{petId}
Body parameter
name: string
status: string
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
petId | path | integer(int64) | true | ID of pet that needs to be updated |
body | body | object | false | none |
» name | body | string | false | Updated name of the pet |
» status | body | string | false | Updated status of the pet |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
405 | Method Not Allowed | Invalid input | None |
Deletes a pet
Code samples
curl --request DELETE \
--url https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/pet/0 \
--header 'api_key: string' \
--header 'authorization: Bearer {access-token}'
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("DELETE", "https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/pet/0");
xhr.setRequestHeader("api_key", "string");
xhr.setRequestHeader("authorization", "Bearer {access-token}");
xhr.send(data);
DELETE /pet/{petId}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
api_key | header | string | false | none |
petId | path | integer(int64) | true | Pet id to delete |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
400 | Bad Request | Invalid ID supplied | None |
404 | Not Found | Pet not found | None |
uploads an image
Code samples
curl --request POST \
--url https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/pet/0/uploadImage \
--header 'accept: application/json' \
--header 'authorization: Bearer {access-token}' \
--header 'content-type: application/octet-stream' \
--data '"string"'
var data = "\"string\"";
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/pet/0/uploadImage");
xhr.setRequestHeader("content-type", "application/octet-stream");
xhr.setRequestHeader("accept", "application/json");
xhr.setRequestHeader("authorization", "Bearer {access-token}");
xhr.send(data);
POST /pet/{petId}/uploadImage
Body parameter
string
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
petId | path | integer(int64) | true | ID of pet to update |
body | body | string(binary) | false | none |
Example responses
200 Response
{
"code": 0,
"type": "string",
"message": "string"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | ApiResponse |
store
Access to Petstore orders
Returns pet inventories by status
Code samples
curl --request GET \
--url https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/store/inventory \
--header 'accept: application/json' \
--header 'api_key: API_KEY'
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/store/inventory");
xhr.setRequestHeader("accept", "application/json");
xhr.setRequestHeader("api_key", "API_KEY");
xhr.send(data);
GET /store/inventory
Returns a map of status codes to quantities
Example responses
200 Response
{
"property1": 0,
"property2": 0
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Inline |
Response Schema
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
» additionalProperties | integer(int32) | false | none | none |
Place an order for a pet
Code samples
curl --request POST \
--url https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/store/order \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{"id":0,"petId":0,"quantity":0,"shipDate":"2020-02-14T09:37:06Z","status":"placed","complete":false}'
var data = JSON.stringify({
"id": 0,
"petId": 0,
"quantity": 0,
"shipDate": "2020-02-14T09:37:06Z",
"status": "placed",
"complete": false
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/store/order");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("accept", "application/json");
xhr.send(data);
POST /store/order
Body parameter
{
"id": 0,
"petId": 0,
"quantity": 0,
"shipDate": "2020-02-14T09:37:06Z",
"status": "placed",
"complete": false
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | Order | true | order placed for purchasing the pet |
Example responses
200 Response
{
"id": 0,
"petId": 0,
"quantity": 0,
"shipDate": "2020-02-14T09:37:06Z",
"status": "placed",
"complete": false
}
<?xml version="1.0" encoding="UTF-8" ?>
<Order>
<id>0</id>
<petId>0</petId>
<quantity>0</quantity>
<shipDate>2020-02-14T09:37:06Z</shipDate>
<status>placed</status>
<complete>false</complete>
</Order>
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Order |
400 | Bad Request | Invalid Order | None |
Find purchase order by ID
Code samples
curl --request GET \
--url https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/store/order/1 \
--header 'accept: application/json'
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/store/order/1");
xhr.setRequestHeader("accept", "application/json");
xhr.send(data);
GET /store/order/{orderId}
For valid response try integer IDs with value >= 1 and <= 10.\ \ Other values will generated exceptions
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
orderId | path | integer(int64) | true | ID of pet that needs to be fetched |
Example responses
200 Response
{
"id": 0,
"petId": 0,
"quantity": 0,
"shipDate": "2020-02-14T09:37:06Z",
"status": "placed",
"complete": false
}
<?xml version="1.0" encoding="UTF-8" ?>
<Order>
<id>0</id>
<petId>0</petId>
<quantity>0</quantity>
<shipDate>2020-02-14T09:37:06Z</shipDate>
<status>placed</status>
<complete>false</complete>
</Order>
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Order |
400 | Bad Request | Invalid ID supplied | None |
404 | Not Found | Order not found | None |
Delete purchase order by ID
Code samples
curl --request DELETE \
--url https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/store/order/1
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("DELETE", "https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/store/order/1");
xhr.send(data);
DELETE /store/order/{orderId}
For valid response try integer IDs with positive integer value.\ \ Negative or non-integer values will generate API errors
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
orderId | path | integer(int64) | true | ID of the order that needs to be deleted |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
400 | Bad Request | Invalid ID supplied | None |
404 | Not Found | Order not found | None |
user
Operations about user
Create user
Code samples
curl --request POST \
--url https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/user \
--header 'content-type: application/json' \
--data '{"id":0,"username":"string","firstName":"string","lastName":"string","email":"string","password":"string","phone":"string","userStatus":0}'
var data = JSON.stringify({
"id": 0,
"username": "string",
"firstName": "string",
"lastName": "string",
"email": "string",
"password": "string",
"phone": "string",
"userStatus": 0
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/user");
xhr.setRequestHeader("content-type", "application/json");
xhr.send(data);
POST /user
This can only be done by the logged in user.
Body parameter
{
"id": 0,
"username": "string",
"firstName": "string",
"lastName": "string",
"email": "string",
"password": "string",
"phone": "string",
"userStatus": 0
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | User | true | Created user object |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
default | Default | successful operation | None |
Creates list of users with given input array
Code samples
curl --request POST \
--url https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/user/createWithList \
--header 'content-type: application/json' \
--data '[{"id":0,"username":"string","firstName":"string","lastName":"string","email":"string","password":"string","phone":"string","userStatus":0}]'
var data = JSON.stringify([
{
"id": 0,
"username": "string",
"firstName": "string",
"lastName": "string",
"email": "string",
"password": "string",
"phone": "string",
"userStatus": 0
}
]);
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/user/createWithList");
xhr.setRequestHeader("content-type", "application/json");
xhr.send(data);
POST /user/createWithList
Body parameter
[
{
"id": 0,
"username": "string",
"firstName": "string",
"lastName": "string",
"email": "string",
"password": "string",
"phone": "string",
"userStatus": 0
}
]
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | UserArray | true | List of user object |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
default | Default | successful operation | None |
Logs user into the system
Code samples
curl --request GET \
--url 'https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/user/login?password=string&username=string' \
--header 'accept: application/json'
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/user/login?password=string&username=string");
xhr.setRequestHeader("accept", "application/json");
xhr.send(data);
GET /user/login
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
username | query | string | true | The user name for login |
password | query | string | true | The password for login in clear text |
Example responses
200 Response
"string"
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | string |
400 | Bad Request | Invalid username/password supplied | None |
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 |
Logs out current logged in user session
Code samples
curl --request GET \
--url https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/user/logout
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/user/logout");
xhr.send(data);
GET /user/logout
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
default | Default | successful operation | None |
Get user by user name
Code samples
curl --request GET \
--url https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/user/string \
--header 'accept: application/json'
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/user/string");
xhr.setRequestHeader("accept", "application/json");
xhr.send(data);
GET /user/{username}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
username | path | string | true | The name that needs to be fetched. Use user1 for testing. |
Example responses
200 Response
{
"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 | Schema |
---|---|---|---|
200 | OK | successful operation | User |
400 | Bad Request | Invalid username supplied | None |
404 | Not Found | User not found | None |
Updated user
Code samples
curl --request PUT \
--url https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/user/string \
--header 'content-type: application/json' \
--data '{"id":0,"username":"string","firstName":"string","lastName":"string","email":"string","password":"string","phone":"string","userStatus":0}'
var data = JSON.stringify({
"id": 0,
"username": "string",
"firstName": "string",
"lastName": "string",
"email": "string",
"password": "string",
"phone": "string",
"userStatus": 0
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("PUT", "https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/user/string");
xhr.setRequestHeader("content-type", "application/json");
xhr.send(data);
PUT /user/{username}
This can only be done by the logged in user.
Body parameter
{
"id": 0,
"username": "string",
"firstName": "string",
"lastName": "string",
"email": "string",
"password": "string",
"phone": "string",
"userStatus": 0
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
username | path | string | true | name that need to be updated |
body | body | User | true | Updated user object |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
400 | Bad Request | Invalid user supplied | None |
404 | Not Found | User not found | None |
Delete user
Code samples
curl --request DELETE \
--url https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/user/string
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("DELETE", "https://virtserver.swaggerhub.com/cosminonea/PetStore/1.0.0/user/string");
xhr.send(data);
DELETE /user/{username}
This can only be done by the logged in user.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
username | path | string | true | The name that needs to be deleted |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
400 | Bad Request | Invalid username supplied | None |
404 | Not Found | User not found | None |
Schemas
Order
{
"id": 0,
"petId": 0,
"quantity": 0,
"shipDate": "2020-02-14T09:37:06Z",
"status": "placed",
"complete": false
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | integer(int64) | false | none | none |
petId | integer(int64) | false | none | none |
quantity | integer(int32) | false | none | none |
shipDate | string(date-time) | false | none | none |
status | string | false | none | Order Status |
complete | boolean | false | none | none |
Enumerated Values
Property | Value |
---|---|
status | placed |
status | approved |
status | delivered |
Category
{
"id": 0,
"name": "string"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | integer(int64) | false | none | none |
name | string | false | none | none |
User
{
"id": 0,
"username": "string",
"firstName": "string",
"lastName": "string",
"email": "string",
"password": "string",
"phone": "string",
"userStatus": 0
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | integer(int64) | false | none | none |
username | string | false | none | none |
firstName | string | false | none | none |
lastName | string | false | none | none |
string | false | none | none | |
password | string | false | none | none |
phone | string | false | none | none |
userStatus | integer(int32) | false | none | User Status |
Tag
{
"id": 0,
"name": "string"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | integer(int64) | false | none | none |
name | string | false | none | none |
Pet
{
"id": 0,
"category": {
"id": 0,
"name": "string"
},
"name": "doggie",
"photoUrls": [
"string"
],
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "available"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | integer(int64) | false | none | none |
category | Category | false | none | none |
name | string | true | none | none |
photoUrls | [string] | true | none | none |
tags | [Tag] | false | none | none |
status | string | false | none | pet status in the store |
Enumerated Values
Property | Value |
---|---|
status | available |
status | pending |
status | sold |
ApiResponse
{
"code": 0,
"type": "string",
"message": "string"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
code | integer(int32) | false | none | none |
type | string | false | none | none |
message | string | false | none | none |