Skip to content

Getting Started

This section explains the basic requirements and setup information required before working with the Petstore API.

Before sending API requests, make sure you have access to an API client and a basic understanding of REST API operations such as GET, POST, PUT, and DELETE methods.

Prerequisites

The following tools and knowledge are recommended before using the API:

  • Basic understanding of REST APIs
  • Familiarity with JSON request and response formats
  • API testing tool such as Postman or cURL
  • Internet connectivity to access the API endpoints

Base URL

All API requests should use the following base URL:

https://petstore.swagger.io/v2

Supported Request Format

The API accepts request payloads in JSON format.

Example:

Content-Type: application/json

Authentication Overview

Some API operations may require authentication or authorization before accessing protected resources.

Authentication details and authorization methods are covered in the Authentication section of this guide.

API Request Structure

API requests are typically made using standard HTTP methods.

Example structure:

<METHOD> <BASE_URL>/<RESOURCE>

Example:

GET https://petstore.swagger.io/v2/pet/1

Response Format

The API returns responses in JSON format. Each response may contain resource data, status information, or error details depending on the request result.

Example response:

{
  "id": 1,
  "name": "doggie",
  "status": "available"
}

First API Request

The following example retrieves pet information using the pet ID.

Request

curl -X GET "https://petstore.swagger.io/v2/pet/1" \
-H "accept: application/json"

Successful Response

{
  "id": 1,
  "category": {
    "id": 1,
    "name": "Dogs"
  },
  "name": "doggie",
  "photoUrls": [
    "string"
  ],
  "tags": [
    {
      "id": 1,
      "name": "friendly"
    }
  ],
  "status": "available"
}

HTTP Methods Used in the API

The following HTTP methods are used throughout the API documentation:

Method Description
GET Retrieves resource information
POST Creates new resources
PUT Updates existing resources
DELETE Removes resources

Next Steps

After completing the initial setup, continue with the Authentication section to understand how authorization and access control are handled for the available APIs.