get_function_info (GET)

Purpose

Returns information about one of the functions of the application.


Input parameters

  • fn: Function number, from 1 to the value of functions_count returned by get_app_info.

Output data

A JSON object with the following format:

{
  "type":"trigger",
  "disabled":"false",
  "id":"weather_city",
  "form":"< label for='city' >{{City}}:< /label >< input type='text' name='city' >",
  "texts":{
     "en":{
        "caption":"Forecast",
        "form":{
           "City":"City"
        },
        "output_vars":{
           "from":"From field",
           "send_date":"Send date",
           "amount":"Total amount"
        }
     },
     "es":{
        "caption":"El tiempo",
        "form":{
           "City":"Ciudad"
        },
        "output_vars":{
           "from":"Remitente",
           "send_date":"Fecha de envio",
           "amount":"Importe total"
        }
     }
  },
  "trigger_data":{
     "max_poll_interval":"15m",
     "output_vars":{
        "from":"text",
        "send_date":"date",
        "amount":"decimal",
        "var1":"custom1"
     }
  }
  "action_data":{
     "input_vars":{
        "var1?":"custom2",
        "var2":"url"
     }
  }
}

  • type: The type of the function, either “trigger” or “action”.
  • id: An unique function identifier. Botize will pass in this value to the process_trigger and do_action commands in order to identify the target function.
  • disabled: Either “true” or “false”. If it is “true”, Botize will ignore this function.
  • form: Function configuration form, optional for triggers and mandatory for actions. See the Configuring tasks with forms section for details on how function configuration forms work.
  • texts/XX/caption: A short title for the function. This is what allows the user to identify the function in the list of available functions when configuring the task.
  • texts/XX/form: The texts for the form markers in the appropriate language. See the Localization of texts in function forms section for details.
  • texts/XX/output_vars: (triggers only) A short description for each of the variables produced by the function, in the appropriate language. These descriptions are shown to the user in the list of the trigger variables available to be supplied to the action. There must be one element with the same name for each of the elements in the trigger_data/output_vars section.
  • trigger_data: (triggers only) Trigger specific information:
    • trigger_data/max_poll_interval: The maximum frequency with which Botize is allowed to invoke this trigger. Must be an integer number followed by “m” (minutes), “h” (hours) or “d” (days). The maximum interval that can be specified is one year (365d, 8760h or 525600m).
    • trigger_data/output_vars: A list with the data variables that the trigger will produce every time it's invoked. There must be one element for each variable, whose value is the variable type. See below for a list of the allowed variable types.
  • action_data: (actions only) Action specific information:
    • action_data/input_vars: A list with the input data variables that the action accepts when it's invoked. A question mark (“?”) after the variable name means that the variable is optional, that is, Botize does not need to mandatorily supply this variable when invoking the action. There must be one element for each variable, whose value is the variable type. See below for a list of the allowed variable types.

Notes

How functions are mapped to function numbers is application dependant, but every existing function must have a number assigned and every number from 1 to functions_count must have a function assigned.

The data types for the output and input variables can be either standard or custom. Here is the list of the standard data types recognized by Botize:

  • text: A text string of up to 8192 characters.
  • int: A signed integer number in the range -2147483648 through 2147483647 (32 bits number).
  • decimal: A floating point number such as 1.234, 1.23e10 or 5E-15. The maximum value is 1e300 with a precision of 14 decimal digits.
  • url: An URL for a web site. The maximum length is 8192 characters.
  • file: An URL for a file or any other type of content not intended to be displayed directly to a human user. The maximum length is 8192 characters.
  • date: A date in the format YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS.
  • time: A time in the format HH:MM:SS.
  • binary: Base64 encoded binary data. The maximum length is 10923 bytes (for 8192 bytes of unencoded data).
  • geo_lat: The latitude part of a geographical coordinates pair. A decimal number from -90 to 90.
  • geo_long: The longitude part of a geographical coordinates pair. A decimal number from -180 to 180.

Any variable type not in the above list will be considered a custom type. Standard and custom variable types are treated by Botize differently as follows:

  1. In the list of trigger output variables that is displayed to the user when configuring a task, only variables of standard types will be included.
  2. If an action contains non-optional input variables of custom types, Botize will allow the user to pair a trigger with the action in a task, only if the trigger contains at least one output variable of the same type for each of these input variables.
  3. Inside a task, Botize will automatically hook each trigger output variable with a custom type to the existing action input variable of the same type. If there are more than one variable of the same type, they will be hooked randomly.

It is not recommended to design a function so that it produces or accepts more than one variable of the same custom type. Instead, use only one variable and encode in it all the needed data in a suitable format (for example JSON).