JSON API » menus » menus/create

Creates a new menu.

Input parameters

Requires authentication and the menus role privilege.

NameTypeDescriptionRequiredDefault value
auth_usernameStringAuthentication username.Yes
auth_passwordStringAuthentication password.Yes
nameStringName as displayed to users.Yes
typeStringType of menu. Can be "item", "section", or "subsection". Cannot be changed once created.Yes
pathStringURL path when clicked.Yes
tagStringTag as referenced in code.Yes
configStringOnly display menu if this Configuration key is enabled. Empty string for none.NoEmpty string.
descriptionStringDescription.NoEmpty string.
featuresStringOnly display menu if any of these rate plan features are allowed. Separate with commas. Empty string for any.NoEmpty string.
iconStringIcon URL. Only used if parent=0.NoEmpty string.
languageStringOnly display menu if user is set to this language key. Empty string for any.NoEmpty string.
parentIntegerID of parent menu. 0 for top-level menu.No0
planIntegerOnly display menu if user is on this rate plan. 0 for any.No0
plan_recursiveIntegerOnly display menu if user is on this rate plan, recursively. 0 for any.No0
rankIntegerOrder to show menu in. 1 for first, 100 for last.No1
rolesStringOnly display menu if any of these role privileges are allowed. Separate with commas. Empty string for any.NoEmpty string.
specialStringOnly display menu if special condition is met. Normally empty string.NoEmpty string.
validationInteger1 to validate input then return, 0 for full action.No0

Responses

CodeDescription
200Success.
201Input passed validation. Only returned if validation=1.
400Invalid input parameters specified. Check the key and message fields for more details.
401The authentication details provided are invalid.
402Your role does not allow this.

Data returned

The ID of the created menu.

Example: With required parameters

http://enswitch.example.com/api/json/menus/create/?auth_username=user;auth_password=password;name=example;path=/example/;tag=example

{ "responses":[ { "code":"200", "key":"", "message":"OK" } ], "data":{ "id":123 } }

Change history

VersionChanges
4.0type parameter added.
3.13Function added.