// example of utilizing a path parameter to output an xml-document.
// This route was configured as GET /routes/multiply/:a/:b
var req = require('request'),
res = require('response'),
xml = require('xml');
var response = {
total: req.params.a * req.params.b
};
res.setHeader('Content-Type', 'text/xml');
res.write( xml.toXml(response) );
A route script creates new API endpoints for an organization. Route matching is available using wildcards, named-parameters and regular expression matching. A route can be set to run as the calling principal or as any other available org principal. ACL can also be applied at the configuration level in order to restrict endpoint access to a set of roles or specific accounts.
PUT and POST routes can be configured to parse application/x-www-form-urlencoded form data, as well as accept text/ content-types. When accepting text/ content, the request body will be in raw form. Otherwise, application/json and application/x-www-form-urlencoded are parsed into json objects.