Skip to content

Instantly share code, notes, and snippets.

@nivv
Created January 8, 2016 16:22
Show Gist options
  • Save nivv/a8ed27bbee320062e1cc to your computer and use it in GitHub Desktop.
Save nivv/a8ed27bbee320062e1cc to your computer and use it in GitHub Desktop.
petstore

FORMAT: 1A HOST: http://petstore.swagger.io/v2

Swagger Petstore

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.

Authentication

This API uses OAuth v2 Bearer Token for its authentication.

Group pet

Pet [/pet]

updatePet [PUT]

  • Request (application/json)

    • Attributes (Pet)
  • Response 400

Invalid ID supplied

  • Response 404

Pet not found

  • Response 405

Validation exception

addPet [POST]

  • Request (application/json)

    • Attributes (Pet)
  • Response 405

Invalid input

Pet FindByStatus [/pet/findByStatus{?status}]

findPetsByStatus [GET]

Multiple status values can be provided with comma seperated strings

  • Parameters

    • status (enum[string], required)

      Status values that need to be considered for filter

      • Members
        • available
        • pending
        • sold
  • Response 200 (application/json)

successful operation

+ Attributes (array[Pet])
  • Response 400

Invalid status value

Pet FindByTags [/pet/findByTags{?tags}]

findPetsByTags [GET]

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

  • Parameters

    • tags (string, required)

      Tags to filter by

  • Response 200 (application/json)

successful operation

+ Attributes (array[Pet])
  • Response 400

Invalid tag value

Pet By PetId [/pet/{petId}]

  • Parameters
    • petId (number, required)

      ID of pet to return

getPetById [GET]

Returns a single pet

  • Response 200 (application/json)

successful operation

+ Attributes (Pet)
  • Response 400

Invalid ID supplied

  • Response 404

Pet not found

updatePetWithForm [POST]

  • Parameters

    • name (string, optional)

      Updated name of the pet

    • status (string, optional)

      Updated status of the pet

  • Response 405

Invalid input

deletePet [DELETE]

  • Parameters

    • api_key (string, optional)
  • Response 400

Invalid pet value

Pet UploadImage By PetId [/pet/{petId}/uploadImage]

  • Parameters
    • petId (number, required)

      ID of pet to update

uploadFile [POST]

  • Parameters

    • additionalMetadata (string, optional)

      Additional data to pass to server

    • file (file, optional)

      file to upload

  • Response 200 (application/json)

successful operation

+ Attributes (ApiResponse)

Group store

Store Inventory [/store/inventory]

getInventory [GET]

Returns a map of status codes to quantities

  • Response 200

successful operation

+ Attributes (object)

Store Order [/store/order]

placeOrder [POST]

  • Request (application/json)

    • Attributes (Order)
  • Response 200 (application/json)

successful operation

+ Attributes (Order)
  • Response 400

Invalid Order

Store Order By OrderId [/store/order/{orderId}]

  • Parameters
    • orderId (number, required)

      ID of pet that needs to be fetched

getOrderById [GET]

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

  • Response 200 (application/json)

successful operation

+ Attributes (Order)
  • Response 400

Invalid ID supplied

  • Response 404

Order not found

deleteOrder [DELETE]

For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors

  • Response 400

Invalid ID supplied

  • Response 404

Order not found

Group user

User [/user]

createUser [POST]

This can only be done by the logged in user.

  • Request (application/json)

    • Attributes (User)
  • Response 500

successful operation

User CreateWithArray [/user/createWithArray]

createUsersWithArrayInput [POST]

  • Request (application/json)

    • Attributes (User)
  • Response 500

successful operation

User CreateWithList [/user/createWithList]

createUsersWithListInput [POST]

  • Request (application/json)

    • Attributes (User)
  • Response 500

successful operation

User Login [/user/login{?username,password}]

loginUser [GET]

  • Parameters

    • username (string, required)

      The user name for login

    • password (string, required)

      The password for login in clear text

  • Response 200

successful operation

+ Attributes (string)
  • Response 400

Invalid username/password supplied

User Logout [/user/logout]

logoutUser [GET]

  • Response 500

successful operation

User By Username [/user/{username}]

  • Parameters
    • username (string, required)

      The name that needs to be fetched. Use user1 for testing.

getUserByName [GET]

  • Response 200 (application/json)

successful operation

+ Attributes (User)
  • Response 400

Invalid username supplied

  • Response 404

User not found

updateUser [PUT]

This can only be done by the logged in user.

  • Request (application/json)

    • Attributes (User)
  • Response 400

Invalid user supplied

  • Response 404

User not found

deleteUser [DELETE]

This can only be done by the logged in user.

  • Response 400

Invalid username supplied

  • Response 404

User not found

Data Structures

Order (object)

Properties

  • id (number, optional)
  • petId (number, optional)
  • quantity (number, optional)
  • shipDate (string, optional)
  • status (enum, optional) - Order Status
    • approved
    • delivered
    • placed
  • complete (boolean, optional)

User (object)

Properties

  • id (number, optional)
  • username (string, optional)
  • firstName (string, optional)
  • lastName (string, optional)
  • email (string, optional)
  • password (string, optional)
  • phone (string, optional)
  • userStatus (number, optional) - User Status

Category (object)

Properties

  • id (number, optional)
  • name (string, optional)

Tag (object)

Properties

  • id (number, optional)
  • name (string, optional)

Pet (object)

Properties

  • id (number, optional)
  • category (Category, optional)
  • name (string, required)
  • photoUrls (array[string], required)
  • tags (array[Tag], optional)
  • status (enum, optional) - pet status in the store
    • available
    • pending
    • sold

ApiResponse (object)

Properties

  • code (number, optional)
  • type (string, optional)
  • message (string, optional)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment