Skip to main content
PATCH
/
api
/
v2
/
platform
/
menu_items
/
{id}
/
reposition
Reposition a Menu Item
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({menu_item: {new_parent_id: 1, new_position_idx: 1}})
};

fetch('http://{defaultHost}/api/v2/platform/menu_items/{id}/reposition', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "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": []
      }
    }
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string
required

Body

application/json
menu_item
object
required

Response

Record updated

data
object
required