Modifiers

get
Get Modifiers

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.
Request
Response
Request
Response
200: OK
Retrieves two objects: categories and modifiers
{
"categories": {
"object": {
"label": "Object",
"index": 1
},
"list": {
"label": "List",
"index": 2
},
...
},
"modifiers": {
"g_stringify": {
"name": "stringify",
"label": "Stringify",
"category": [
"object",
"list"
],
"description": "Convert an object or list to a JSON string.",
"arguments": [
{
"name": "space",
"type": "number",
"isHash": true
}
],
"returns": {
"type": "string"
},
"helperFn": "function(value, { hash }) {\n\n return JSON.stringify(value, null, hash.space);\n }"
},
"g_length": {
"name": "length",
"label": "Length",
"category": [
"list",
"text"
],
"description": "Find length of text or list.",
"arguments": [],
"returns": {
"type": "number"
},
"helperFn": "function(value) {\n\n return value && value.hasOwnProperty('length') ? value.length : 0;\n }"
},
...
}
}

put
Edit Modifiers

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
Response
Request
Body Parameters
categories
required
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
required
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.
Response
200: OK
It returns the whole updated definition, like the GET endpoint.
{
"categories": {
"object": {
"label": "Object",
"index": 1
},
"list": {
"label": "List",
"index": 2
},
...
},
"modifiers": {
"g_stringify": {
"name": "stringify",
"label": "Stringify",
"category": [
"object",
"list"
],
"description": "Convert an object or list to a JSON string.",
"arguments": [
{
"name": "space",
"type": "number",
"isHash": true
}
],
"returns": {
"type": "string"
},
"helperFn": "function(value, { hash }) {\n\n return JSON.stringify(value, null, hash.space);\n }"
},
"g_length": {
"name": "length",
"label": "Length",
"category": [
"list",
"text"
],
"description": "Find length of text or list.",
"arguments": [],
"returns": {
"type": "number"
},
"helperFn": "function(value) {\n\n return value && value.hasOwnProperty('length') ? value.length : 0;\n }"
},
...
}
}

delete
Delete Modifiers

https://api.appmixer.com/modifiers
Delete all modifiers. Restricted to admin users only.
Request
Response
Request
Response
200: OK
Empty response
{}

post
Test Modifier Function

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
Response
Request
Body Parameters
helperFn
required
string
The Javascript helper function as a string.
arguments
required
array
The arguments to be passed to the helper function.
Response
200: OK
The endpoint will respond with the returned value from the helperFn.
4
400: Bad Request
The helper function must always return a value. In the case it does not, this response is received.
{
"statusCode": 400,
"error": "Bad Request",
"message": "The function returned \"undefined\""
}