Defining RPCs (Remote Procedure Calls)

The Docxpresso interface for creating RPCs does not really create RPCs by itself but simply register them within Docxpresso so that they can be used within any template.

WARNING: If you want to actually learn how to create an RPC that is "Docxpresso compliant" see building Docxpresso compliant RPCs. But beware that you need some basic knowledge about web development in order to achieve that task.

To register an RPC within Docxpresso you just have to click on the Resources > create RPC of the main menu. You will be redirected to a page with a web form with the following options:

  • Method: a unique name for the method with no whitespaces (use underscores instead) or non-ASCII characters.
  • URL: the web address where to call the RPC. It should start with http:// or https://.
  • Mode: the available modes are:
    • On load: to be triggered whenever the template is loaded into the browser.
    • Dropdown: if the RPC is used to populate a dropdown type variable.
    • Triggered: this is a secondary RPC that is triggered whenever a dropdown loaded via an RPC changes its state. For example, a dropdown of products generated via an RPC may launch a new RPC that sets the price of the chosen item.
  • Trigger: this field is only available whenever one chooses "dropdown" for the mode. You may choose among the previously defined RPCs of mode "triggered" to concatenate the actions.
  • Params: an optional list of parameters separated by ";" that should be sent to the RPC URL in order to receive the required answer. Not available in the "triggered" mode. If their values are not provided by GET or POST, the user will be prompted to provide them via a standard browser dialog box.
  • Default values: list of default parameters values separated by ";". Not available in the "triggered" mode.
  • Prompt message: the message that will be shown whenever the end user is prompted to provide a value. You may include the corresponding parameter name by including the %%param%% text in your message (its value will be consecutively replaced by the corresponding parameter name).
  • Secret: a private key that will be use to generate unique API keys for your requests. If not given Docxpresso general key will be used. This only be used if you want to secure your RPCs whenever they exchange sensible info.
  • Active: If checked (default value) the RPC will be available when editing varaibles in the main template processing interface.
  • Description: a brief description of the RPC that may help editors to identify the interest or potential use of the current list.