Always keep the overview: A menu to provide structure and guide you quickly

JavaScript API

In some cases it may be desirable to render the menu structure yourself. We have built some JavaScript components that get the menu structure for the current user in JSON format (both just use the REST API which is documented below) or the information whether the current user is allowed to edit the menu structure.

/**
 * Get the JSON representation for the menu of the current user.
 * @return jQuery Ajax (jqXHR) object.

 */
SeibertMedia.MenuEditor.MenuBuilder.getMenu()


/**
 * Get the information whether the current user is allowed to edit the menu structure.
 * @return jQuery Deferred that is resolved when the current user has permission to edit the menu and rejected when not.
 */
SeibertMedia.MenuEditor.MenuBuilder.getEditPermission()
/**
 * Get the JSON representation for the menu of the current user.
 * The JSON also includes a boolean field "userHasEditPermission" that is true when the current user is allowed to edit the menu structure
 * @param callback Function to process JSON, e.g. processJSON(Object menuJson) { ... }
 */
SeibertMedia.MenuEditor.MenuBuilder.buildJsonMenu(function callback)

REST API

ResourceDescriptionPermission
GET menueditor/2.0/menu/current-userReturns the navigation structure for the current user in JSON formatEveryone
GET menueditor/2.0/permissions/currentuserReturns true or false if the current user has permission to edit the navigation structureEveryone

Resource URL: <HOST><CONTEXT>/rest/menueditor/2.0/menu/current-user

{
   "entries":[
      {
         "title":"Item 1",
         "entityID":"852021",
         "type":"internal-page-link",
         "link":"",
         "targetBlank":false,
         "filters":[ 
            "",
            "",
            ""
         ],
         "menu":{
            "entries":[
               {
                  "entityID":"",
                  "title":"Item 1.1",
                  "link":"http://www.example.com",
                  "type":"external-link",
                  "targetBlank":false,
                  "filters":[ 
                    "",
                    "",
                    ""
                  ]
               },
               {
                  "entityID":"",
                  "title":"Item 1.2",
                  "link":"http://www.example.com",
                  "type":"external-link",
                  "targetBlank":false,
                  "filters":[ 
                    "",
                    "",
                    ""
                  ]
               },
               {
                  "entityID":"SPACE",
                  "title":"Item 1.3",
                  "link":"",
                  "type":"internal-space-link",
                  "targetBlank":false,
                  "filters":[ 
                    "",
                    "",
                    ""
                  ]
               },
               {
                  "entityID":"",
                  "title":"Category 1.4 (with subcategory)",
                  "link":"",
                  "type":"category",
                  "targetBlank":false,
                  "filters":[ 
                    "",
                    "",
                    ""
                  ]
                  "menu":{
                     "entries":[
                        {
                           "entityID":"",
                           "title":"Category 1.4.1",
                           "link":"",
                           "type":"category",
                           "targetBlank":false,
                           "filters":[ 
                             "",
                             "",
                             ""
                           ]
                        }
                     ]
                  }
               }
            ]
         }
      }
   ]
}
keydescription
entityIDID of the Confluence Entity (Page ID or SpaceKey)
title 
linkexternal URL if entry is an external link
type"category", "separator", "internal-space-link", "internal-page-link", "dashboard-link", "external-link"
targetBlankif "true", the link opens in a new tab/window
filters 

Resource URL: <HOST><CONTEXT>/rest/menueditor/2.0/permissions/currentuser

{
    "permitted":true
}
  • No labels

This content was last updated on 02/13/2018.

This content hasn't been updated in a while. That doesn't have to be a problem. Some of our pages live for years without becoming obsolete.

Old content can be incorrect, misleading or outdated. Please get in contact with us via a form on this page, our live chat or via email with content@seibert.group if you are in doubt, have a question, suggestion, or want changes from us.