Menus Items

    List all menu's items

    Get all the menu items of a site.

    Request

    • Method: GET
    • Version: v3, this API call supports additional sort and filter mechanisms as well as retrieving only a sub-set of fields

      Note: In order to access the v3 API endpoints please make sure you have enabled the new rendering engine.

    • Server: https://[app key here]-[site_ID here]-apps.worldsecuresystems.com. Take a look at the Authorize your API calls document for more info on how this URL is formed.
      • Note: When building apps always use relative request URLs. Do not use the "full" URL above because you might have problems running your app on a different site as the site_ID parameter will be different.
    • Path: /webresources/api/v3/sites/current/menuitems
      • Alternatively, use siteID instead of 'current'
    • Authorization header: This should contain the authorization token. Here is how to obtain the token.

    Response body

    An array of the first 10 items; each object has the following properties:

    • id - menu ID (integer)
    • menuId - menu ID (integer)
    • parentId - the ID of the parent item (integer)
    • siteId - site ID (integer)
    • name - item name, or label (string)
    • url - item url (string)
    • tagetFrame - If you want the destination URL to open in a different frame than the current one the user is in (string)
    • image - an image for your menu item that will be shown when the mouse is not over the menu item (string)
    • rollOverImage - an image for your menu item that will be shown when the mouse is over the menu item (string)
    • selectedImage - an image for your menu item that will be shown when the current page is the same as the URL you have chosen for this menu item. This option only works for root-menu items (integer)
    • repeatImage - if the image you have chosen for your menu item is smaller than the width/height that you define below, and you want this image to be repeated to fill the entire menu-item (boolean)
    • cssClassName - if you define a CSS class for an item then the tab \'Item Look\' will have no impact on the appearance of this menu item. If you don\'t define a CSS for the roll over state then \'Item Look\' values will be applied (string)
    • rollOverCssClassName - the CSS class that will be applied to this menu item when the mouse is over the menu item (string)
    • selectedCssClassName - the CSS class that will be applied to this menu item when the current page is the same as the URL you have chosen for this menu item. This option only works for root-menu items (object)
    • width - item width in pixels (string)
    • height - item height in pixels (string)
    • order - the order of the item, can contain only values greater or equal to 0 (integer)
    • createDate - item's create date (dateTime)
    • lastUpdateDate - item's update date(dateTime)
    • htmlId - the html id that will be assigned to this menu item. You can use this ID in any javascript library to achieve your own effects (string)
    • title - title is displayed when you hover over this item (string)
    • enabled (boolean)

    You can output additional fields to those listed above as default, see the API v3 Discovery APP for additional details.

    Accepts and returns JSON as Content-Type.


    Sample request

    var access_token = BCAPI.Helper.Site.getAccessToken();
    
    var request = $.ajax({
        url: "/webresources/api/v3/sites/current/menus",
        type: "GET",
        connection: "keep-alive",    
        contentType: "application/json",
        headers: {
            "Authorization": $.cookie('access_token')
        }
    });
    request.done(function (msg) {
        console.log(msg);
    });
    request.fail(function (jqXHR) {
        console.log("Request failed.");
        console.log("Error code: " + jqXHR.status);
        console.log("Error text: " + jqXHR.statusText);
        console.log("Response text: " + jqXHR.responseText);
    });

    Sample response

    {
      "items": [
        {
          "id": 528671,
          "menuId": 555053,
          "parentId": -1,
          "siteId": 38581,
          "name": "1",
          "url": "",
          "targetFrame": "",
          "image": null,
          "rollOverImage": null,
          "selectedImage": null,
          "repeatImage": false,
          "cssClassName": null,
          "rollOverCssClassName": null,
          "selectedCssClassName": null,
          "width": "120",
          "height": "20",
          "order": 1,
          "createDate": "2016-05-04T17:52:15.553",
          "lastUpdateDate": "2016-05-04T17:52:15.553",
          "htmlId": null,
          "title": "",
          "enabled": true
        },
        {
          "id": 528672,
          "menuId": 555053,
          "parentId": 528671,
          "siteId": 38581,
          "name": "2",
          "url": "",
          "targetFrame": "",
          "image": null,
          "rollOverImage": null,
          "selectedImage": null,
          "repeatImage": false,
          "cssClassName": null,
          "rollOverCssClassName": null,
          "selectedCssClassName": null,
          "width": "120",
          "height": "20",
          "order": 7,
          "createDate": "2016-05-04T17:52:18.427",
          "lastUpdateDate": "2016-05-04T17:52:24.59",
          "htmlId": null,
          "title": "",
          "enabled": true
        },
        {
          "id": 528673,
          "menuId": 555053,
          "parentId": 528672,
          "siteId": 38581,
          "name": "3",
          "url": "",
          "targetFrame": "",
          "image": null,
          "rollOverImage": null,
          "selectedImage": null,
          "repeatImage": false,
          "cssClassName": null,
          "rollOverCssClassName": null,
          "selectedCssClassName": null,
          "width": "120",
          "height": "20",
          "order": 8,
          "createDate": "2016-05-04T17:52:19.22",
          "lastUpdateDate": "2016-05-04T17:52:25.523",
          "htmlId": null,
          "title": "",
          "enabled": true
        }
      ],
      "totalItemsCount": 3,
      "skip": 0,
      "limit": 10
    }

    Get a menu's item details

    Get a menu item and it's details.

    Request

    • Method: GET
    • Version: v3, this API call supports additional sort and filter mechanisms as well as retrieving only a sub-set of fields

      Note: In order to access the v3 API endpoints please make sure you have enabled the new rendering engine.

    • Server: https://[app key here]-[site_ID here]-apps.worldsecuresystems.com. Take a look at the Authorize your API calls document for more info on how this URL is formed.
      • Note: When building apps always use relative request URLs. Do not use the "full" URL above because you might have problems running your app on a different site as the site_ID parameter will be different.
    • Path: /webresources/api/v3/sites/current/menuitems/[menuitems_ID]
      • Alternatively, use siteID instead of 'current'
    • Authorization header: This should contain the authorization token. Here is how to obtain the token.

    Response

    Displays the details for the menu as a JSON object

    • id - menu ID (integer)
    • menuId - menu ID (integer)
    • parentId - the ID of the parent item (integer)
    • siteId - site ID (integer)
    • name - item name, or label (string)
    • url - item url (string)
    • tagetFrame - If you want the destination URL to open in a different frame than the current one the user is in (string)
    • image - an image for your menu item that will be shown when the mouse is not over the menu item (string)
    • rollOverImage - an image for your menu item that will be shown when the mouse is over the menu item (string)
    • selectedImage - an image for your menu item that will be shown when the current page is the same as the URL you have chosen for this menu item. This option only works for root-menu items (integer)
    • repeatImage - if the image you have chosen for your menu item is smaller than the width/height that you define below, and you want this image to be repeated to fill the entire menu-item (boolean)
    • cssClassName - if you define a CSS class for an item then the tab \'Item Look\' will have no impact on the appearance of this menu item. If you don\'t define a CSS for the roll over state then \'Item Look\' values will be applied (string)
    • rollOverCssClassName - the CSS class that will be applied to this menu item when the mouse is over the menu item (string)
    • selectedCssClassName - the CSS class that will be applied to this menu item when the current page is the same as the URL you have chosen for this menu item. This option only works for root-menu items (object)
    • width - item width in pixels (string)
    • height - item height in pixels (string)
    • order - the order of the item, can contain only values greater or equal to 0 (integer)
    • createDate - item's create date (dateTime)
    • lastUpdateDate - item's update date(dateTime)
    • htmlId - the html id that will be assigned to this menu item. You can use this ID in any javascript library to achieve your own effects (string)
    • title - title is displayed when you hover over this item (string)
    • enabled (boolean)

    Accepts and returns JSON as Content-Type.


    Sample request

    var access_token = BCAPI.Helper.Site.getAccessToken();
    
    var request = $.ajax({
        url: "/webresources/api/v3/sites/current/menuitems/528671",
        type: "GET",
        connection: "keep-alive",    
        contentType: "application/json",
        headers: {
            "Authorization": $.cookie('access_token')
        }
    });
    request.done(function (msg) {
        console.log(msg);
    })
    request.fail(function (jqXHR) {
        console.log("Request failed.");
        console.log("Error code: " + jqXHR.status);
        console.log("Error text: " + jqXHR.statusText);
        console.log("Response text: " + jqXHR.responseText);
    })

    Sample response

    {
      "id": 528671,
      "menuId": 555053,
      "parentId": -1,
      "siteId": 38581,
      "name": "1",
      "url": "",
      "targetFrame": "",
      "image": null,
      "rollOverImage": null,
      "selectedImage": null,
      "repeatImage": false,
      "cssClassName": null,
      "rollOverCssClassName": null,
      "selectedCssClassName": null,
      "width": "120",
      "height": "20",
      "order": 1,
      "createDate": "2016-05-04T17:52:15.553",
      "lastUpdateDate": "2016-05-04T17:52:15.553",
      "htmlId": null,
      "title": "",
      "enabled": true
    }

    Create a menu item

    Request

    • Method: POST
    • Version: v3, this API call supports additional sort and filter mechanisms as well as retrieving only a sub-set of fields

      Note: In order to access the v3 API endpoints please make sure you have enabled the new rendering engine.

    • Server: https://[app key here]-[site_ID here]-apps.worldsecuresystems.com. Take a look at the Authorize your API calls document for more info on how this URL is formed.
      • Note: When building apps always use relative request URLs. Do not use the "full" URL above because you might have problems running your app on a different site as the site_ID parameter will be different.
    • Path: /webresources/api/v3/sites/current/menuitems
      • Alternatively, use siteID instead of 'current'
    • Authorization header: This should contain the authorization token. Here is how to obtain the token.

    Parameters

    • menuId - menu ID (integer)
    • parentId - the ID of the parent item (integer)
    • name - item name, or label (string)
    • url - item url (string)
    • tagetFrame - If you want the destination URL to open in a different frame than the current one the user is in (string)
    • image - an image for your menu item that will be shown when the mouse is not over the menu item (string)
    • rollOverImage - an image for your menu item that will be shown when the mouse is over the menu item (string)
    • selectedImage - an image for your menu item that will be shown when the current page is the same as the URL you have chosen for this menu item. This option only works for root-menu items (integer)
    • repeatImage - if the image you have chosen for your menu item is smaller than the width/height that you define below, and you want this image to be repeated to fill the entire menu-item (boolean)
    • cssClassName - if you define a CSS class for an item then the tab \'Item Look\' will have no impact on the appearance of this menu item. If you don\'t define a CSS for the roll over state then \'Item Look\' values will be applied (string)
    • rollOverCssClassName - the CSS class that will be applied to this menu item when the mouse is over the menu item (string)
    • selectedCssClassName - the CSS class that will be applied to this menu item when the current page is the same as the URL you have chosen for this menu item. This option only works for root-menu items (object)
    • width - item width in pixels (string)
    • height - item height in pixels (string)
    • order - the order of the item, can contain only values greater or equal to 0 (integer)
    • htmlId - the html id that will be assigned to this menu item. You can use this ID in any javascript library to achieve your own effects (string)
    • title - title is displayed when you hover over this item (string)
    • enabled (boolean)

    Response:

    HTTP/1.1 201 CREATED
    Location: /webresources/api/v3/sites/current/menuitems
    Content-Type: application/json; charset=utf-8
    Content-Length: length

    Sample request

    var access_token = BCAPI.Helper.Site.getAccessToken();
    var request = $.ajax({
        url: "/webresources/api/v3/sites/current/menuitems",
        type: "POST",
        connection: "keep-alive",    
        contentType: "application/json",
        headers: {
            "Authorization": $.cookie('access_token')
        },
        processData: false,
        data: JSON.stringify({
          "menuId": 555053,
          "parentId": 528677,
          "name": "1",
          "url": "",
          "targetFrame": "",
          "image": "test",
          "rollOverImage": "test",
          "selectedImage": "test",
          "repeatImage": false,
          "cssClassName": "test",
          "rollOverCssClassName": "test",
          "selectedCssClassName": "test",
          "width": "120",
          "height": "20",
          "order": 1,
          "htmlId": "test",
          "title": "",
          "enabled": true
        })
    });
    request.done(function (msg) {
        console.log(msg);
    })
    request.fail(function (jqXHR) {
        console.log("Request failed.");
        console.log("Error code: " + jqXHR.status);
        console.log("Error text: " + jqXHR.statusText);
        console.log("Response text: " + jqXHR.responseText);
    })

    Response

    Returns an empty body if successful or a detailed error message.

    Accepts and returns JSON as Content-Type.


    Edit a menu item

    Request

    • Method: PUT
    • Version: v3, this API call supports additional sort and filter mechanisms as well as retrieving only a sub-set of fields

      Note: In order to access the v3 API endpoints please make sure you have enabled the new rendering engine.

    • Server: https://[app key here]-[site_ID here]-apps.worldsecuresystems.com. Take a look at the Authorize your API calls document for more info on how this URL is formed.
      • Note: When building apps always use relative request URLs. Do not use the "full" URL above because you might have problems running your app on a different site as the site_ID parameter will be different.
    • Path: /webresources/api/v3/sites/current/menuitems/[menuitems_ID]
      • Alternatively, use siteID instead of 'current'
    • Authorization header: This should contain the authorization token. Here is how to obtain the token.

    Parameters

    • menuId - menu ID (integer)
    • parentId - the ID of the parent item (integer)
    • name - item name, or label (string)
    • url - item url (string)
    • tagetFrame - If you want the destination URL to open in a different frame than the current one the user is in (string)
    • image - an image for your menu item that will be shown when the mouse is not over the menu item (string)
    • rollOverImage - an image for your menu item that will be shown when the mouse is over the menu item (string)
    • selectedImage - an image for your menu item that will be shown when the current page is the same as the URL you have chosen for this menu item. This option only works for root-menu items (integer)
    • repeatImage - if the image you have chosen for your menu item is smaller than the width/height that you define below, and you want this image to be repeated to fill the entire menu-item (boolean)
    • cssClassName - if you define a CSS class for an item then the tab \'Item Look\' will have no impact on the appearance of this menu item. If you don\'t define a CSS for the roll over state then \'Item Look\' values will be applied (string)
    • rollOverCssClassName - the CSS class that will be applied to this menu item when the mouse is over the menu item (string)
    • selectedCssClassName - the CSS class that will be applied to this menu item when the current page is the same as the URL you have chosen for this menu item. This option only works for root-menu items (object)
    • width - item width in pixels (string)
    • height - item height in pixels (string)
    • order - the order of the item, can contain only values greater or equal to 0 (integer)
    • htmlId - the html id that will be assigned to this menu item. You can use this ID in any javascript library to achieve your own effects (string)
    • title - title is displayed when you hover over this item (string)
    • enabled (boolean)

    Response

    Returns an empty body if successful or a detailed error message.

    Accepts and returns JSON as Content-Type.


    Sample request

    var access_token = BCAPI.Helper.Site.getAccessToken();
    var request = $.ajax({
        url: "/webresources/api/v3/sites/current/menuitems/528671",
        type: "PUT",
        connection: "keep-alive",    
        contentType: "application/json",
        headers: {
            "Authorization": $.cookie('access_token')
        },
        processData: false,
        data: JSON.stringify({
          "menuId": 555053,
          "parentId": 528677,
          "siteId": 38581,
          "name": "Edited item",
          "url": "/contact",
          "targetFrame": "",
          "image": "test",
          "rollOverImage": "test",
          "selectedImage": "test",
          "repeatImage": false,
          "cssClassName": "test",
          "rollOverCssClassName": "test",
          "selectedCssClassName": "test",
          "width": "120",
          "height": "20",
          "order": 1,
          "htmlId": "edited test",
          "title": "",
          "enabled": false
        })
    });
    request.done(function (msg) {
        console.log(msg);
    })
    request.fail(function (jqXHR) {
        console.log("Request failed.");
        console.log("Error code: " + jqXHR.status);
        console.log("Error text: " + jqXHR.statusText);
        console.log("Response text: " + jqXHR.responseText);
    })

    Delete a menu item

    Request

    • Method: DELETE
    • Version: v3, this API call supports additional sort and filter mechanisms as well as retrieving only a sub-set of fields

      Note: In order to access the v3 API endpoints please make sure you have enabled the new rendering engine.

    • Server: https://[app key here]-[site_ID here]-apps.worldsecuresystems.com. Take a look at the Authorize your API calls document for more info on how this URL is formed.
      • Note: When building apps always use relative request URLs. Do not use the "full" URL above because you might have problems running your app on a different site as the site_ID parameter will be different.
    • Path: /webresources/api/v3/sites/current/menuitems/[menuitems_ID]
      • Alternatively, use siteID instead of 'current'
    • Authorization header: This should contain the authorization token. Here is how to obtain the token.

    Request:

    DELETE /webresources/api/v3/sites/current/menus/528671 HTTPS/1.1
    Authorization: 14f87f21c5ea4830a06a6314a8aad82b45bc61dc08f24a0fb55599cea83ca811
    Connection: keep-alive
    Content-Type: application/json
    

    Response:

    
    HTTP/1.1 204 NO CONTENT
    Location: /webresources/api/v3/sites/current/menuitems/[menuitems_ID]
    Content-Type: application/json; charset=utf-8
    Content-Length: length

    Sample request

    var access_token = BCAPI.Helper.Site.getAccessToken();
    var request = $.ajax({
    	url: "/webresources/api/v3/sites/current/menuitems/528671",
        type: "DELETE",
        connection: "keep-alive",
        contentType: "application/json",
    	
        headers: {
        	"Authorization": $.cookie('access_token')
            }
        });
        request.done(function (msg) {
        	$('.output pre').html(JSON.stringify(msg, null, 2));
            console.log(msg);
        })
        request.fail(function(jqXHR) {
        	console.log("Request failed.");
            console.log("Error code: " + jqXHR.status);
            console.log("Error text: " + jqXHR.statusText);
            console.log("Response text: " + jqXHR.responseText);
        })

    Response

    Returns an empty body if successful or a detailed error message.