Help: Custom API methods
Creating custom API methods
To create a custom API method you need to create an advanced behaviour rule with an API method criterion:
- Create a new advanced behaviour rule by clicking on the plus button below the advanced behaviour rules list.
- Change the type of the second row in the rule editor to “Custom API method”. The row should look like this:
- Enter the name of your custom API method into the text field on this row.
- Specify the behaviour you want to associate with your custom API method in the same way you would for any other advanced behaviour rule (see the section on behaviour of advanced rules for more information)
You might want to create several rules for the same custom API method,
each with different additional criteria, e.g. a method called
edit might have one rule to define its default behaviour and
another to define its behaviour when the shift key is held down. Advanced
behaviour rules are applied in order, so if you do have multiple rules
for the same custom API method you should put the more specific rules
before the more general ones, otherwise the general rule will match and
be applied before the more specific rules are evaluated.
Using custom API methods
You can call a custom API method in the same way as you would any other
API method. For example, if you were to create an API method called
edit you would call it by opening the URL
http://www.example.com with whatever URL you wanted the
custom API method to apply to).
For more information on calling API methods, including code examples for various languages, see the API documentation on the Choosy web site.