JSON API » menus » menus/create
Creates a new menu.
Input parameters
Requires authentication and the menus role privilege.
Name | Type | Description | Required | Default value |
---|---|---|---|---|
auth_username | String | Authentication username. | Yes | |
auth_password | String | Authentication password. | Yes | |
name | String | Name as displayed to users. | Yes | |
path | String | URL path when clicked. | Yes | |
tag | String | Tag as referenced in code. | Yes | |
config | String | Only display menu if this Configuration key is enabled. Empty string for none. | No | Empty string. |
description | String | Description. | No | Empty string. |
features | String | Only display menu if any of these rate plan features are allowed. Separate with commas. Empty string for any. | No | Empty string. |
icon | String | Icon URL. Only used if parent=0. | No | Empty string. |
language | String | Only display menu if user is set to this language key. Empty string for any. | No | Empty string. |
parent | Integer | ID of parent menu. 0 for top-level menu. | No | 0 |
plan | Integer | Only display menu if user is on this rate plan. 0 for any. | No | 0 |
plan_recursive | Integer | Only display menu if user is on this rate plan, recursively. 0 for any. | No | 0 |
rank | Integer | Order to show menu in. 1 for first, 100 for last. | No | 1 |
roles | String | Only display menu if any of these role privileges are allowed. Separate with commas. Empty string for any. | No | Empty string. |
special | String | Only display menu if special condition is met. Normally empty string. | No | Empty string. |
validation | Integer | 1 to validate input then return, 0 for full action. | No | 0 |
Responses
Code | Description |
---|---|
200 | Success. |
201 | Input passed validation. Only returned if validation=1. |
400 | Invalid input parameters specified. Check the key and message fields for more details. |
401 | The authentication details provided are invalid. |
402 | Your 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
Version | Changes |
---|---|
3.13 | Function added. |