Redirect (Method)

The redirect method is a function method that is used to re-direct the user to another, existing API function.

Unlike the URL method, it suggests that people should use the original API point, rather than acting as a go-between.

It's generally used when documenting existing API functions - particularly in ARDI addons.

Additional Info.json Parameters

This method requires a url parameter - this is the full url to the 'real' API function. This path can include substitutions.

How It Works

For this method, the user-provided parameters are available as Substitutions.

For example, the following info.json file…

{
    "name": "Testing",
    "method": "redirect",
    "path": "[SERVER]/api/random?message=[msg]",
    "parameters": [{ 
             "name": "Message",
             "type": "string", 
             "tag": "msg",
             "default": "Hello World"
    }].
   "folder": "Testing"
}

…would result in the following steps if it was called with the default parameter values.

Building the Full URL

The full URL would be built up from the available substitutions, from…

[SERVER]/api/random?message=[msg]

to

myardiserver.com/api/random?message=Hello World

Proxying the Function Call

If this function is called directly (rather than the user choosing to call the genuine URL), the ARDI server will retrieve the results and then deliver them back to the caller.