Slash (/) characters in monitored URIs

To avoid mistakenly interpreting slashes in resource ID as part of the URI path, slash (/) characters in a resource ID that is not a user-definable parameter must be encoded as: %2f or %2F.

In the path component of a URI, the slash (/) character is a reserved character that is a delimiter between path segments. For example:


Resources on a switch might also use the slash character in their identifications. For example:

  • An interface might be identified by a member/slot/port notation, such as: 1/1/7

  • A power supply unit might be identified by a member/PSU notation, such as: 1/3

To correctly specify a resource ID in a monitored URI that does not include parameters, you must substitute %2f or %2F for each slash character in the resource ID.

The following example shows the definition of a monitor for interface 1/1/7 and does not use a parameter for the resource ID:

self.monitor = Monitor('/rest/v1/system/interfaces/1%2f1%2f7?attributes=tx_bytes', 'Monitored interface')

If the script defines a user-defined parameter to specify the resource ID, URL encoding for the slash character is not used when specifying the default value. Likewise, when a user enters a value for that parameter, they do not have to use URL encoding for the slash character because the Web UI automatically uses URL encoding when storing the value.

The following example shows parts of a script that defines interface_id as a user-defined parameter and then passes that parameter to a Monitor function and to an ActionCLI function.

ParameterDefinitions = {
    'interface_id': {
        'Name': 'Monitored Interface',
        'Description': 'The id of the monitored interface,
        'Type': 'string',
        'Default': '1/1/1'
self.monitor = Monitor(
    'Monitored interface', 
    [ self.params['interface_id']])
ActionCLI('show interface {}', [self.params['interface_id']]