Spree Commerce Menu Items API
The Menu Items API from Spree Commerce — 3 operation(s) for menu items.
The Menu Items API from Spree Commerce — 3 operation(s) for menu items.
openapi: 3.0.3
info:
title: Admin Account / Address Menu Items 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: Menu Items
paths:
/api/v2/platform/menu_items:
get:
summary: Return a list of Menu Items
tags:
- Menu Items
security:
- bearer_auth: []
description: Returns a list of Menu Items
operationId: menu-items-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,icon,parent,children,linked_resource
schema:
type: string
- name: filter[name_eq]
in: query
description: ''
example: T-Shirts
schema:
type: string
responses:
'200':
description: Records returned
content:
application/vnd.api+json:
examples:
Example:
value:
data:
- id: '2'
type: menu_item
attributes:
name: Link no. 1 To Somewhere
subtitle: null
destination: null
new_window: false
item_type: Link
linked_resource_type: Spree::Linkable::Uri
code: null
lft: 2
rgt: 3
depth: 1
created_at: '2022-11-08T19:34:23.401Z'
updated_at: '2022-11-08T19:34:23.404Z'
link: null
is_container: false
is_root: false
is_child: true
is_leaf: true
relationships:
icon:
data:
id: '13'
type: icon
menu:
data:
id: '1'
type: menu
parent:
data:
id: '1'
type: menu_item
linked_resource:
data: null
children:
data: []
- id: '3'
type: menu_item
attributes:
name: Link no. 2 To Somewhere
subtitle: null
destination: null
new_window: false
item_type: Link
linked_resource_type: Spree::Linkable::Uri
code: null
lft: 4
rgt: 5
depth: 1
created_at: '2022-11-08T19:34:23.425Z'
updated_at: '2022-11-08T19:34:23.428Z'
link: null
is_container: false
is_root: false
is_child: true
is_leaf: true
relationships:
icon:
data:
id: '14'
type: icon
menu:
data:
id: '1'
type: menu
parent:
data:
id: '1'
type: menu_item
linked_resource:
data: null
children:
data: []
- id: '4'
type: menu_item
attributes:
name: Link no. 3 To Somewhere
subtitle: null
destination: null
new_window: false
item_type: Link
linked_resource_type: Spree::Linkable::Uri
code: null
lft: 6
rgt: 7
depth: 1
created_at: '2022-11-08T19:34:23.446Z'
updated_at: '2022-11-08T19:34:23.449Z'
link: null
is_container: false
is_root: false
is_child: true
is_leaf: true
relationships:
icon:
data:
id: '15'
type: icon
menu:
data:
id: '1'
type: menu
parent:
data:
id: '1'
type: menu_item
linked_resource:
data: null
children:
data: []
- id: '5'
type: menu_item
attributes:
name: Link no. 4 To Somewhere
subtitle: null
destination: null
new_window: false
item_type: Link
linked_resource_type: Spree::Linkable::Uri
code: null
lft: 8
rgt: 9
depth: 1
created_at: '2022-11-08T19:34:23.468Z'
updated_at: '2022-11-08T19:34:23.471Z'
link: null
is_container: false
is_root: false
is_child: true
is_leaf: true
relationships:
icon:
data:
id: '16'
type: icon
menu:
data:
id: '1'
type: menu
parent:
data:
id: '1'
type: menu_item
linked_resource:
data: null
children:
data: []
- id: '6'
type: menu_item
attributes:
name: Link no. 5 To Somewhere
subtitle: null
destination: null
new_window: false
item_type: Link
linked_resource_type: Spree::Linkable::Uri
code: null
lft: 10
rgt: 11
depth: 1
created_at: '2022-11-08T19:34:23.491Z'
updated_at: '2022-11-08T19:34:23.494Z'
link: null
is_container: false
is_root: false
is_child: true
is_leaf: true
relationships:
icon:
data:
id: '17'
type: icon
menu:
data:
id: '1'
type: menu
parent:
data:
id: '1'
type: menu_item
linked_resource:
data: null
children:
data: []
- id: '7'
type: menu_item
attributes:
name: Link no. 6 To Somewhere
subtitle: null
destination: null
new_window: false
item_type: Link
linked_resource_type: Spree::Linkable::Uri
code: null
lft: 12
rgt: 13
depth: 1
created_at: '2022-11-08T19:34:23.515Z'
updated_at: '2022-11-08T19:34:23.518Z'
link: null
is_container: false
is_root: false
is_child: true
is_leaf: true
relationships:
icon:
data:
id: '18'
type: icon
menu:
data:
id: '1'
type: menu
parent:
data:
id: '1'
type: menu_item
linked_resource:
data: null
children:
data: []
- id: '8'
type: menu_item
attributes:
name: Link no. 7 To Somewhere
subtitle: null
destination: null
new_window: false
item_type: Link
linked_resource_type: Spree::Linkable::Uri
code: null
lft: 14
rgt: 15
depth: 1
created_at: '2022-11-08T19:34:23.535Z'
updated_at: '2022-11-08T19:34:23.537Z'
link: null
is_container: false
is_root: false
is_child: true
is_leaf: true
relationships:
icon:
data:
id: '19'
type: icon
menu:
data:
id: '1'
type: menu
parent:
data:
id: '1'
type: menu_item
linked_resource:
data: null
children:
data: []
- id: '1'
type: menu_item
attributes:
name: Neque a rem deserunt beatae.
subtitle: null
destination: null
new_window: false
item_type: Container
linked_resource_type: Spree::Linkable::Uri
code: null
lft: 1
rgt: 16
depth: 0
created_at: '2022-11-08T19:34:23.379Z'
updated_at: '2022-11-08T19:34:23.545Z'
link: null
is_container: true
is_root: true
is_child: false
is_leaf: false
relationships:
icon:
data: null
menu:
data:
id: '1'
type: menu
parent:
data: null
linked_resource:
data: null
children:
data:
- id: '2'
type: menu_item
- id: '3'
type: menu_item
- id: '4'
type: menu_item
- id: '5'
type: menu_item
- id: '6'
type: menu_item
- id: '7'
type: menu_item
- id: '8'
type: menu_item
meta:
count: 8
total_count: 8
total_pages: 1
links:
self: http://www.example.com/api/v2/platform/menu_items?page=1&per_page=&include=&filter[name_eq]=
next: http://www.example.com/api/v2/platform/menu_items?filter%5Bname_eq%5D=&include=&page=1&per_page=
prev: http://www.example.com/api/v2/platform/menu_items?filter%5Bname_eq%5D=&include=&page=1&per_page=
last: http://www.example.com/api/v2/platform/menu_items?filter%5Bname_eq%5D=&include=&page=1&per_page=
first: http://www.example.com/api/v2/platform/menu_items?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 Item
tags:
- Menu Items
security:
- bearer_auth: []
description: Creates a Menu Item
operationId: create-menu-item
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,icon,parent,children,linked_resource
schema:
type: string
responses:
'201':
description: Record created
content:
application/vnd.api+json:
examples:
Example:
value:
data:
id: '21'
type: menu_item
attributes:
name: Link no. 18 To Somewhere
subtitle: null
destination: null
new_window: false
item_type: Link
linked_resource_type: Spree::Linkable::Uri
code: null
lft: 8
rgt: 9
depth: 1
created_at: '2022-11-08T19:34:24.333Z'
updated_at: '2022-11-08T19:34:24.336Z'
link: null
is_container: false
is_root: false
is_child: true
is_leaf: true
relationships:
icon:
data: null
menu:
data:
id: '3'
type: menu
parent:
data:
id: '17'
type: menu_item
linked_resource:
data: null
children:
data: []
schema:
$ref: '#/components/schemas/resource'
'422':
description: Invalid request
content:
application/vnd.api+json:
examples:
Example:
value:
error: Name can't be blank, Menu can't be blank, and Item type is not included in the list
errors:
name:
- can't be blank
menu:
- can't be blank
item_type:
- is not included in the list
schema:
$ref: '#/components/schemas/validation_errors'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/create_menu_item_params'
/api/v2/platform/menu_items/{id}:
get:
summary: Return a Menu Item
tags:
- Menu Items
security:
- bearer_auth: []
description: Returns a Menu Item
operationId: show-menu-item
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,icon,parent,children,linked_resource
schema:
type: string
responses:
'200':
description: Record found
content:
application/vnd.api+json:
examples:
Example:
value:
data:
id: '30'
type: menu_item
attributes:
name: Link no. 25 To Somewhere
subtitle: null
destination: null
new_window: false
item_type: Link
linked_resource_type: Spree::Linkable::Uri
code: null
lft: 8
rgt: 9
depth: 1
created_at: '2022-11-08T19:34:24.785Z'
updated_at: '2022-11-08T19:34:24.788Z'
link: null
is_container: false
is_root: false
is_child: true
is_leaf: true
relationships:
icon:
data:
id: '36'
type: icon
menu:
data:
id: '5'
type: menu
parent:
data:
id: '26'
type: menu_item
linked_resource:
data: null
children:
data: []
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 Item
tags:
- Menu Items
security:
- bearer_auth: []
description: Updates a Menu Item
operationId: update-menu-item
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,icon,parent,children,linked_resource
schema:
type: string
responses:
'200':
description: Record updated
content:
application/vnd.api+json:
examples:
Example:
value:
data:
id: '44'
type: menu_item
attributes:
name: Menu Item One
subtitle: null
destination: null
new_window: false
item_type: Link
linked_resource_type: Spree::Linkable::Uri
code: null
lft: 8
rgt: 9
depth: 1
created_at: '2022-11-08T19:34:25.609Z'
updated_at: '2022-11-08T19:34:25.857Z'
link: null
is_container: false
is_root: false
is_child: true
is_leaf: true
relationships:
icon:
data:
id: '47'
type: icon
menu:
data:
id: '8'
type: menu
parent:
data:
id: '40'
type: menu_item
linked_resource:
data: null
children:
data: []
schema:
$ref: '#/components/schemas/resource'
'422':
description: Invalid request
content:
application/vnd.api+json:
examples:
Example:
value:
error: Name can't be blank
errors:
name:
- can't be blank
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_item_params'
delete:
summary: Delete a Menu Item
tags:
- Menu Items
security:
- bearer_auth: []
description: Deletes a Menu Item
operationId: delete-menu-item
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'
/api/v2/platform/menu_items/{id}/reposition:
patch:
summary: Reposition a Menu Item
tags:
- Menu Items
security:
- bearer_auth: []
operationId: reposition-menu-item
description: Reposition a Menu Item
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
'200':
description: Record updated
content:
application/vnd.api+json:
examples:
Example:
value:
data:
id: '77'
type: menu_item
attributes:
name: Link no. 62 To Somewhere
subtitle: null
destination: null
new_window: false
item_type: Link
linked_resource_type: Spree::Linkable::Uri
code: null
lft: 5
rgt: 6
depth: 2
created_at: '2022-11-08T19:34:27.610Z'
updated_at: '2022-11-08T19:34:27.858Z'
link: null
is_container: false
is_root: false
is_child: true
is_leaf: true
relationships:
icon:
data:
id: '73'
type: icon
menu:
data:
id: '15'
type: menu
parent:
data:
id: '75'
type: menu_item
linked_resource:
data: null
children:
data: []
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'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/menu_item_reposition'
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
error:
type: object
properties:
error:
type: string
required:
- error
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
menu_item_reposition:
type: object
properties:
menu_item:
type: object
required:
- new_parent_id
- new_position_idx
properties:
new_parent_id:
type: integer
example: 1
description: The ID of the new target parent Menu Item.
new_position_idx:
type: integer
example: 1
description: The new index position of the Menu Item within its parent
required:
- menu_item
title: Reposition a Menu Item
x-internal: false
resource:
type: object
properties:
data:
$ref: '#/components/schemas/resource_properties'
required:
- data
x-internal: false
create_menu_item_params:
type: object
properties:
menu_item:
type: object
required:
- name
- menu_id
properties:
name:
type: string
example: T-Shirts
description: The name of this Menu Item
code:
type: string
nullable: true
example: MEN-TS
description: Give this Menu Item a code to identify this Menu Item from others. This is especially useful when using Container type Menu Items to group items.
subtitle:
type: string
nullable: true
example: Shop men's T-Shirts
description: Set an optional subtitle for the Menu Item, this is useful if your menu has promotional links that require more than just a link name.
destination:
type: string
nullable: true
example: https://getvendo.com
description: 'Used when the linked_resource_type is set to: URL'
menu_id:
type: integer
example: 1
description: Specify the ID of the Menu this item belongs to.
new_window:
type: boolean
description: When set to `true` the link will be opened in a new tab or window.
item_type:
ty
# --- truncated at 32 KB (35 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/spree/refs/heads/main/openapi/spree-menu-items-api-openapi.yml