User Manual – Create a Pet

Create a Pet and Verify its Creation

As a store owner, a user will want the ability to manage inventory by entering new pets into the system. The Petstore API allows this functionality through the same website that customers utilize. Authorizations are handled based on choices the development team has made.

NOTE: Only basic user functionality is built into the Petstore API. More secure implementations are highly recommended, especially for store management activities such as discussed on this page.

Create a New Pet Record

To create a new pet record, use the POST /pet Resource. This resource provides several fields, but only the name and photoUrls fields are required to set up a new pet.

The POST /pet resource returns a record in XML format with an id field. This field is necessary for managing the pet record in the future.

A new pet record can be updated at a later time by using either the PUT /pet or the POST /pet/{petId} resources.

Verify Pet Creation

There are several different resources which could be used to confirm the creation of a new pet record.

The GET /pet/findByStatus resource can be used to request all available or pending records, for example. Depending on business logic implemented for example, initial POST /pet API calls may be assigned status=”pending” until approved by a manager.

NOTE: This is not the default business logic.

Another possibility is to use the GET /pet/{petId} resource, which uses a path parameter to access the Pet record. The path parameter is the petId, which is assigned during the POST /pet API call above.

 


Return to the User Manual