Modifiers
Get Modifiers
GET
https://api.appmixer.com/modifiers
Get available modifiers. Appmixer is shipped by default with its own set of modifiers by default. Checkout this API to see what they are. You can then redefine the default set with the following API endpoint.
Edit Modifiers
PUT
https://api.appmixer.com/modifiers
Change the modifiers and their categories as a whole. Restricted to admin users only. Before editing existing modifiers or adding new ones, checkout the GET /modifiers API to see the structure.
Request Body
categories
object
The object containing available modifier categories. Each category is composed by the following properties: - label: label to be shown in the Modifier Editor. It can be overridden by string customization. - index: position on which this category is displayed in the Modifier Editor.
modifiers
object
The object containing available modifiers. Each modifier is composed of the following properties:
- label: label to be shown in the Modifier Editor. Can be overridden by string customization.
- category: an array containing the categories which the modifier will appear under.
- description: short description of the modifier. It will appear under modifier's label. Can be overridden by string customization.
- arguments (optional): an array of objects describing the arguments for the modifier if there is any. For each argument, an inspector field is generated in the editor. The structure of each object is {
name: String,
type: String,
isHash: Boolean, Optional
}
- returns (optional): an object with just one property type indicating the expected return type.
- isBlock (optional): boolean. Indicates if this is a block modifier.
- private (optional): boolean. Indicates if the modifier is private and therefore not available for users.
- variableArguments (optional): boolean. If set to true the modifier accepts any number of arguments. The inspector will render an "Add" button to add as many arguments as the user wants.
- helperFn: the javascript function as a string, which does the transformation of the variable. The function definition can have arguments being the first one always the variable value, and the subsequent each of the modifier's arguments, in the same order they are defined on arguments
array.
Delete Modifiers
DELETE
https://api.appmixer.com/modifiers
Delete all modifiers. Restricted to admin users only.
Test Modifier Function
POST
https://api.appmixer.com/modifiers/test
This endpoint can be used to test a helper function with the desired arguments, to check how it will behave under different conditions.
curl -XPOST "https://api.appmixer.com/modifiers/test" -H "Content-type: application/json" -H "Authorization: Bearer [ACCESS-TOKEN]" -d '{ "helperFn": "function(value) { return value && value.hasOwnProperty('\''length'\'') ? value.length : 0; }", "arguments": ["test"]}'
Request Body
helperFn
string
The Javascript helper function as a string.
arguments
array
The arguments to be passed to the helper function.
Last updated