Spree Commerce Menus API

The Menus API from Spree Commerce — 2 operation(s) for menus.

OpenAPI Specification

spree-menus-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Admin Account / Address Menus API
  contact:
    name: Spree Commerce
    url: https://spreecommerce.org
    email: hello@spreecommerce.org
  description: "Spree Admin API v3 - Administrative API for managing products, orders, and store settings.\n\n## Authentication\n\nThe Admin API requires a secret API key passed in the `x-spree-api-key` header.\nSecret API keys can be generated in the Spree admin dashboard.\n\n## Response Format\n\nAll responses are JSON. List endpoints return paginated responses with `data` and `meta` keys.\nSingle resource endpoints return a flat JSON object.\n\n## Resource IDs\n\nEvery resource is identified by an opaque string ID (e.g. `prod_86Rf07xd4z`,\n`variant_k5nR8xLq`, `or_UkLWZg9DAJ`). Use these IDs everywhere — URL paths,\nrequest bodies, and Ransack filters all accept them directly.\n\n## Error Handling\n\nErrors return a consistent format:\n```json\n{\n  \"error\": {\n    \"code\": \"validation_error\",\n    \"message\": \"Validation failed\",\n    \"details\": { \"name\": [\"can't be blank\"] }\n  }\n}\n```\n"
  version: v3
servers:
- url: http://{defaultHost}
  variables:
    defaultHost:
      default: localhost:3000
tags:
- name: Menus
paths:
  /api/v2/platform/menus:
    get:
      summary: Return a list of Menus
      tags:
      - Menus
      security:
      - bearer_auth: []
      description: Returns a list of Menus
      operationId: menus-list
      parameters:
      - name: page
        in: query
        example: 1
        schema:
          type: integer
      - name: per_page
        in: query
        example: 50
        schema:
          type: integer
      - name: include
        in: query
        description: 'Select which associated resources you would like to fetch, see: <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
        example: menu_items
        schema:
          type: string
      - name: filter[name_eq]
        in: query
        description: ''
        example: Main Menu
        schema:
          type: string
      - name: filter[location_eq]
        in: query
        description: ''
        example: header
        schema:
          type: string
      responses:
        '200':
          description: Records returned
          content:
            application/vnd.api+json:
              examples:
                Example:
                  value:
                    data:
                    - id: '18'
                      type: menu
                      attributes:
                        name: Main Menu
                        location: header
                        locale: en
                        created_at: '2022-11-08T19:34:28.349Z'
                        updated_at: '2022-11-08T19:34:28.398Z'
                      relationships:
                        menu_items:
                          data:
                          - id: '89'
                            type: menu_item
                          - id: '90'
                            type: menu_item
                          - id: '87'
                            type: menu_item
                    - id: '19'
                      type: menu
                      attributes:
                        name: Footer Menu
                        location: footer
                        locale: en
                        created_at: '2022-11-08T19:34:28.357Z'
                        updated_at: '2022-11-08T19:34:28.448Z'
                      relationships:
                        menu_items:
                          data:
                          - id: '91'
                            type: menu_item
                          - id: '92'
                            type: menu_item
                          - id: '88'
                            type: menu_item
                    meta:
                      count: 2
                      total_count: 2
                      total_pages: 1
                    links:
                      self: http://www.example.com/api/v2/platform/menus?page=1&per_page=&include=&filter[name_eq]=&filter[location_eq]=
                      next: http://www.example.com/api/v2/platform/menus?filter%5Blocation_eq%5D=&filter%5Bname_eq%5D=&include=&page=1&per_page=
                      prev: http://www.example.com/api/v2/platform/menus?filter%5Blocation_eq%5D=&filter%5Bname_eq%5D=&include=&page=1&per_page=
                      last: http://www.example.com/api/v2/platform/menus?filter%5Blocation_eq%5D=&filter%5Bname_eq%5D=&include=&page=1&per_page=
                      first: http://www.example.com/api/v2/platform/menus?filter%5Blocation_eq%5D=&filter%5Bname_eq%5D=&include=&page=1&per_page=
              schema:
                $ref: '#/components/schemas/resources_list'
        '401':
          description: Authentication Failed
          content:
            application/vnd.api+json:
              examples:
                Example:
                  value:
                    error: The access token is invalid
              schema:
                $ref: '#/components/schemas/error'
    post:
      summary: Create a Menu
      tags:
      - Menus
      security:
      - bearer_auth: []
      description: Creates a Menu
      operationId: create-menu
      parameters:
      - name: include
        in: query
        description: 'Select which associated resources you would like to fetch, see: <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
        example: menu_items
        schema:
          type: string
      responses:
        '201':
          description: Record created
          content:
            application/vnd.api+json:
              examples:
                Example:
                  value:
                    data:
                      id: '22'
                      type: menu
                      attributes:
                        name: Main Menu
                        location: header
                        locale: en
                        created_at: '2022-11-08T19:34:29.089Z'
                        updated_at: '2022-11-08T19:34:29.097Z'
                      relationships:
                        menu_items:
                          data:
                          - id: '99'
                            type: menu_item
              schema:
                $ref: '#/components/schemas/resource'
        '422':
          description: Invalid request
          content:
            application/vnd.api+json:
              examples:
                Example:
                  value:
                    error: Name can't be blank, Locale can't be blank, and Location is not included in the list
                    errors:
                      name:
                      - can't be blank
                      locale:
                      - can't be blank
                      location:
                      - is not included in the list
              schema:
                $ref: '#/components/schemas/validation_errors'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/create_menu_params'
  /api/v2/platform/menus/{id}:
    get:
      summary: Return a Menu
      tags:
      - Menus
      security:
      - bearer_auth: []
      description: Returns a Menu
      operationId: show-menu
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: include
        in: query
        description: 'Select which associated resources you would like to fetch, see: <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
        example: menu_items
        schema:
          type: string
      responses:
        '200':
          description: Record found
          content:
            application/vnd.api+json:
              examples:
                Example:
                  value:
                    data:
                      id: '23'
                      type: menu
                      attributes:
                        name: Main Menu
                        location: header
                        locale: en
                        created_at: '2022-11-08T19:34:29.371Z'
                        updated_at: '2022-11-08T19:34:29.376Z'
                      relationships:
                        menu_items:
                          data:
                          - id: '100'
                            type: menu_item
              schema:
                $ref: '#/components/schemas/resource'
        '404':
          description: Record not found
          content:
            application/vnd.api+json:
              examples:
                Example:
                  value:
                    error: The resource you were looking for could not be found.
              schema:
                $ref: '#/components/schemas/error'
        '401':
          description: Authentication Failed
          content:
            application/vnd.api+json:
              examples:
                Example:
                  value:
                    error: The access token is invalid
              schema:
                $ref: '#/components/schemas/error'
    patch:
      summary: Update a Menu
      tags:
      - Menus
      security:
      - bearer_auth: []
      description: Updates a Menu
      operationId: update-menu
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: include
        in: query
        description: 'Select which associated resources you would like to fetch, see: <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
        example: menu_items
        schema:
          type: string
      responses:
        '200':
          description: Record updated
          content:
            application/vnd.api+json:
              examples:
                Example:
                  value:
                    data:
                      id: '25'
                      type: menu
                      attributes:
                        name: Main Menu
                        location: header
                        locale: en
                        created_at: '2022-11-08T19:34:29.913Z'
                        updated_at: '2022-11-08T19:34:29.919Z'
                      relationships:
                        menu_items:
                          data:
                          - id: '102'
                            type: menu_item
              schema:
                $ref: '#/components/schemas/resource'
        '422':
          description: Invalid request
          content:
            application/vnd.api+json:
              examples:
                Example:
                  value:
                    error: Name can't be blank, Locale can't be blank, and Location is not included in the list
                    errors:
                      name:
                      - can't be blank
                      locale:
                      - can't be blank
                      location:
                      - is not included in the list
              schema:
                $ref: '#/components/schemas/validation_errors'
        '404':
          description: Record not found
          content:
            application/vnd.api+json:
              examples:
                Example:
                  value:
                    error: The resource you were looking for could not be found.
              schema:
                $ref: '#/components/schemas/error'
        '401':
          description: Authentication Failed
          content:
            application/vnd.api+json:
              examples:
                Example:
                  value:
                    error: The access token is invalid
              schema:
                $ref: '#/components/schemas/error'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/update_menu_params'
    delete:
      summary: Delete a Menu
      tags:
      - Menus
      security:
      - bearer_auth: []
      description: Deletes a Menu
      operationId: delete-menu
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        '204':
          description: Record deleted
        '404':
          description: Record not found
          content:
            application/vnd.api+json:
              examples:
                Example:
                  value:
                    error: The resource you were looking for could not be found.
              schema:
                $ref: '#/components/schemas/error'
        '401':
          description: Authentication Failed
          content:
            application/vnd.api+json:
              examples:
                Example:
                  value:
                    error: The access token is invalid
              schema:
                $ref: '#/components/schemas/error'
components:
  schemas:
    resource_properties:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
        attributes:
          type: object
        relationships:
          type: object
      required:
      - id
      - type
      - attributes
      x-internal: false
    update_menu_params:
      type: object
      properties:
        menu:
          type: object
          properties:
            name:
              type: string
              example: Main Menu
              description: Update this Menu name.
            location:
              type: string
              enum:
              - header
              - footer
              description: Update the location this menu appears in the website.
            locale:
              type: string
              example: en-US
              description: Change the language of this menu.
      required:
      - menu
      x-internal: false
    resources_list:
      type: object
      properties:
        data:
          type: array
          items:
            allOf:
            - $ref: '#/components/schemas/resource_properties'
        meta:
          type: object
          properties:
            count:
              type: integer
            total_count:
              type: integer
            total_pages:
              type: integer
          required:
          - count
          - total_count
          - total_pages
        links:
          type: object
          properties:
            self:
              type: string
            next:
              type: string
            prev:
              type: string
            last:
              type: string
            first:
              type: string
          required:
          - self
          - next
          - prev
          - last
          - first
      required:
      - data
      - meta
      - links
      x-internal: false
    create_menu_params:
      type: object
      properties:
        menu:
          type: object
          required:
          - name
          - location
          - locale
          properties:
            name:
              type: string
              example: Main Menu
              description: Give this Menu a name.
            location:
              type: string
              enum:
              - header
              - footer
              description: Set the location this menu appears in the website.
            locale:
              type: string
              example: en-US
              description: Set the language of this menu.
      required:
      - menu
      x-internal: false
    error:
      type: object
      properties:
        error:
          type: string
      required:
      - error
      x-internal: false
    resource:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/resource_properties'
      required:
      - data
      x-internal: false
    validation_errors:
      type: object
      properties:
        error:
          type: string
        errors:
          type: object
      required:
      - error
      - errors
      x-internal: false
  securitySchemes:
    api_key:
      type: apiKey
      name: x-spree-api-key
      in: header
      description: Secret API key for admin access
    bearer_auth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT token for admin user authentication
x-tagGroups:
- name: Authentication
  tags:
  - Authentication
- name: Products & Catalog
  tags:
  - Products
  - Variants
  - Option Types
  - Custom Fields
  - Channels
- name: Pricing
  tags:
  - Pricing
  - Markets
- name: Orders & Fulfillment
  tags:
  - Orders
  - Payments
  - Fulfillments
  - Refunds
- name: Customers
  tags:
  - Customers
  - Customer Groups
- name: Promotions & Gift Cards
  tags:
  - Promotions
  - Gift Cards
- name: Data
  tags:
  - Exports
- name: Configuration
  tags:
  - Settings
  - Stock Locations
  - Payment Methods
  - Staff
  - API Keys
  - Allowed Origins
  - Webhooks