The pb33f demo giftshop API

Play around with our demo API

The Giftshop API

In order to try out wiretap, we’ve created a small demo API that you can use to play around with. The API is a simple giftshop API that has a few sample endpoints.

The API cannot be damaged in any way, so feel free to try out any of the features of wiretap on it. No mutations will be persisted, nothing will be deleted, and no data will be lost.

The OpenAPI Specification

The OpenAPI specification for the API is available at https://api.pb33f.io/wiretap/giftshop-openapi.yaml

Check the Giftshop OpenAPI specification quality using vacuum by clicking here

Available endpoints

Endpoint Method Description
Get all products, can be filtered with category query param.
Create a new product.
Get a specific product by productId.
Update an existing product.
Delete an existing product
Search products for a keyword

Product schema

properties: 
  id:
    type: [string]
    format: uuid
    description: "The unique identifier for the product"
    example: "d1404c5c-69bd-4cd2-a4cf-b47c79a30112"
  shortCode:
    type: [ string ]
    description: "a short code for the product, easily human readable"
    example: "pb0001"
  name:
    type: [string]
    description: "The name of the product"
    example: "pb33f t-shirt"
  description:
    type: [string]
    description: "A description of the product"
    maxLength: 500
    example: "A t-shirt with the pb33f logo on the front"
  price:
    type: [number]
    format: float
    description: "The price of the product, as a floating point number"
    example: 19.99
  category:
    type: [string]
    description: "The category of the product"
    example: "shirts"
  image:
    type: [string]
    description: "The URL of the product image"
    example: "https://pb33f.io/images/t-shirt.png"

Example product JSON

{
    "id": "d91a1cc2-ec4e-468a-97dc-7a0325017f1b",
    "shortCode": "pb0001",
    "name": "pb33f t-shirt",
    "description": "A t-shirt with the pb33f logo on the front",
    "price": 19.99,
    "category": "clothes",
    "image": "https://pb33f.io/images/t-shirt.png"
}

API Base URL

The Giftshop API is available at https://api.pb33f.io/wiretap/giftshop

Get all products

Retrieve all products from the Giftshop API.

Parameters

Name In Description
category query Filter products by category, for example ‘clothes’.

Response

Returns an array of Product objects.

cURL example

curl https://api.pb33f.io/wiretap/giftshop/products?category=cups curl https://api.pb33f.io/wiretap/giftshop/products


Get product by ID

Retrieve a Product from the Giftshop API by productId. This is the shortCode of the product.

Parameters

Name In Description
productId path The shortCode of the product to view.

Response

Returns a Product object.

cURL Example

curl https://api.pb33f.io/wiretap/giftshop/products/pb0001

Create a product

Create a new Product in the Giftshop.

Parameters

Name In Description
X-API-Key header Example API Key to use (required).

Request Body

Content Type: application/json

Schema: Product object

Response

Returns a Product object, echoing the newly created product.

cURL example

curl -X POST https://api.pb33f.io/wiretap/giftshop/products \ -H "Content-Type: application/json" \ -H "X-API-Key: aabbcc12345" \ -d "{ \"id\": \"7c2b7db3-7c34-48ca-9e63-41d3d90bc7f2\", \"shortCode\": \"pb0009\", \"name\": \"pb33f socks\", \"description\": \"A pair of fantastic socks\", \"price\": 11.99, \"category\": \"clothes\", \"image\": \"https://pb33f.io/images/socks.png\" }"

Update a product

Update an existing Product in the Giftshop.

Parameters

Name In Description
X-API-Key header Example API Key to use (required).

Request Body

Content Type: application/json

Schema: Product object

Response

Returns the updated Product object,

cURL example

curl -X POST https://api.pb33f.io/wiretap/giftshop/products/pb0001 \ -H "Content-Type: application/json" \ -H "X-API-Key: aabbcc12345" \ -d "{ \"shortCode\": \"pb0001\", \"name\": \"pb33f socks\", \"description\": \"A pair of fantastic socks\", \"price\": 11.99, \"category\": \"clothes\", \"image\": \"https://pb33f.io/images/socks.png\" }"

Delete a product

Delete a Product from the Giftshop.

Parameters

Name In Description
X-API-Key header Example API Key to use (required).

Response

Returns an empty object.

cURL example

curl -X DELETE https://api.pb33f.io/wiretap/giftshop/products/pb0001 \ -H "X-API-Key: aabbcc12345"

Search products

Retrieve all products from the Giftshop API.

Parameters

Name In Description
category query Keyword to search products for.

Response

Returns an array of Product objects.

cURL Example

curl https://api.pb33f.io/wiretap/giftshop/search?query=hat