{
  "openapi": "3.1.0",
  "info": {
    "title": "Male VeGadish public catalogue API",
    "version": "1.0.0",
    "summary": "Read-only access to the Breslov book catalogue of malevegadish.com.",
    "description": "The public, unauthenticated part of the WooCommerce Store API as exposed by malevegadish.com. It covers product search, single products and product categories, and is intended for agents answering questions about which Breslov titles, editions and formats are available and at what price in ILS.\n\nThere is no authentication and no API key. Nothing here creates or changes data: cart and checkout are deliberately left out of this document because an order on this shop is completed by a person in the browser.\n\nPlease stay under roughly one request per second.",
    "contact": {
      "name": "Male VeGadish",
      "url": "https://malevegadish.com/contact-us/"
    }
  },
  "servers": [
    { "url": "https://malevegadish.com", "description": "Production" }
  ],
  "externalDocs": {
    "description": "Developer notes for this shop",
    "url": "https://malevegadish.com/developers/"
  },
  "security": [],
  "paths": {
    "/wp-json/wc/store/v1/products": {
      "get": {
        "operationId": "searchProducts",
        "summary": "Search or list books",
        "description": "Returns a page of products. Use search for a title in Hebrew or English, category to restrict to a category id, and per_page/page to walk the catalogue.",
        "parameters": [
          { "name": "search", "in": "query", "description": "Free-text search over product name and description.", "required": false, "schema": { "type": "string" }, "example": "ליקוטי מוהרן" },
          { "name": "category", "in": "query", "description": "Restrict to a product category id (see /products/categories).", "required": false, "schema": { "type": "integer" } },
          { "name": "per_page", "in": "query", "description": "Results per page, 1-100.", "required": false, "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 10 } },
          { "name": "page", "in": "query", "description": "1-based page number.", "required": false, "schema": { "type": "integer", "minimum": 1, "default": 1 } },
          { "name": "orderby", "in": "query", "required": false, "schema": { "type": "string", "enum": ["date", "price", "popularity", "rating", "title", "relevance"] } },
          { "name": "order", "in": "query", "required": false, "schema": { "type": "string", "enum": ["asc", "desc"] } }
        ],
        "responses": {
          "200": {
            "description": "A page of products.",
            "headers": {
              "X-WP-Total": { "description": "Total number of matching products.", "schema": { "type": "integer" } },
              "X-WP-TotalPages": { "description": "Total number of pages.", "schema": { "type": "integer" } }
            },
            "content": {
              "application/json": {
                "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Product" } }
              }
            }
          },
          "400": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/wp-json/wc/store/v1/products/{id}": {
      "get": {
        "operationId": "getProduct",
        "summary": "Get one book by id",
        "parameters": [
          { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } }
        ],
        "responses": {
          "200": {
            "description": "The product.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Product" } } }
          },
          "404": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/wp-json/wc/store/v1/products/categories": {
      "get": {
        "operationId": "listCategories",
        "summary": "List product categories",
        "description": "Categories describe format and edition as much as subject: pocket, medium and large formats, the Kitvei HaNachal edition, first-print editions, sets and pamphlets.",
        "parameters": [
          { "name": "per_page", "in": "query", "required": false, "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 10 } },
          { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "minimum": 1, "default": 1 } }
        ],
        "responses": {
          "200": {
            "description": "Categories.",
            "content": {
              "application/json": {
                "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Category" } }
              }
            }
          }
        }
      }
    },
    "/wp-json/wc/store/v1/products/categories/{id}": {
      "get": {
        "operationId": "getCategory",
        "summary": "Get one category by id",
        "parameters": [
          { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } }
        ],
        "responses": {
          "200": {
            "description": "The category.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Category" } } }
          },
          "404": { "$ref": "#/components/responses/Error" }
        }
      }
    }
  },
  "components": {
    "responses": {
      "Error": {
        "description": "A WordPress REST error. The HTTP status is repeated in data.status.",
        "content": {
          "application/json": {
            "schema": { "$ref": "#/components/schemas/Error" },
            "example": {
              "code": "woocommerce_rest_product_invalid_id",
              "message": "ה-ID של המוצר לא תקין.",
              "data": { "status": 404 }
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": ["code", "message", "data"],
        "properties": {
          "code": { "type": "string", "description": "Machine-readable error code." },
          "message": { "type": "string", "description": "Human-readable message, in Hebrew." },
          "data": {
            "type": "object",
            "properties": { "status": { "type": "integer", "description": "HTTP status code." } }
          }
        }
      },
      "Prices": {
        "type": "object",
        "description": "Amounts are integer strings in the smallest unit; divide by 10^currency_minor_unit.",
        "properties": {
          "price": { "type": "string" },
          "regular_price": { "type": "string" },
          "sale_price": { "type": "string" },
          "currency_code": { "type": "string", "example": "ILS" },
          "currency_symbol": { "type": "string", "example": "₪" },
          "currency_minor_unit": { "type": "integer", "example": 2 }
        }
      },
      "Image": {
        "type": "object",
        "properties": {
          "id": { "type": "integer" },
          "src": { "type": "string", "format": "uri" },
          "thumbnail": { "type": "string", "format": "uri" },
          "alt": { "type": "string" }
        }
      },
      "Category": {
        "type": "object",
        "properties": {
          "id": { "type": "integer" },
          "name": { "type": "string" },
          "slug": { "type": "string" },
          "description": { "type": "string" },
          "permalink": { "type": "string", "format": "uri" },
          "count": { "type": "integer", "description": "Number of products in this category." }
        }
      },
      "Product": {
        "type": "object",
        "properties": {
          "id": { "type": "integer" },
          "name": { "type": "string", "description": "Title, normally in Hebrew." },
          "slug": { "type": "string" },
          "permalink": { "type": "string", "format": "uri", "description": "Human page for this book." },
          "sku": { "type": "string" },
          "type": { "type": "string", "enum": ["simple", "variable", "grouped", "external"] },
          "description": { "type": "string", "description": "HTML." },
          "short_description": { "type": "string", "description": "HTML." },
          "prices": { "$ref": "#/components/schemas/Prices" },
          "price_html": { "type": "string" },
          "on_sale": { "type": "boolean" },
          "is_in_stock": { "type": "boolean" },
          "is_purchasable": { "type": "boolean" },
          "low_stock_remaining": { "type": ["integer", "null"] },
          "stock_availability": {
            "type": "object",
            "properties": { "text": { "type": "string" }, "class": { "type": "string" } }
          },
          "average_rating": { "type": "string" },
          "review_count": { "type": "integer" },
          "images": { "type": "array", "items": { "$ref": "#/components/schemas/Image" } },
          "categories": { "type": "array", "items": { "$ref": "#/components/schemas/Category" } },
          "attributes": {
            "type": "array",
            "description": "Format, edition and size live here.",
            "items": {
              "type": "object",
              "properties": {
                "id": { "type": "integer" },
                "name": { "type": "string" },
                "taxonomy": { "type": ["string", "null"] },
                "terms": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": { "type": "integer" },
                      "name": { "type": "string" },
                      "slug": { "type": "string" }
                    }
                  }
                }
              }
            }
          },
          "variations": {
            "type": "array",
            "description": "Present on variable products.",
            "items": { "type": "object", "properties": { "id": { "type": "integer" } } }
          }
        }
      }
    }
  }
}
