Docs‎ > ‎Extensibility‎ > ‎

HTTP Handler

You can define your own RESTful end points, as an HTTP Request:


And then use it like this (copy the contents of the red box, above, to the URL):


Your handler will have access to the request object, as in this example:

return JSON.stringify({
    result: 'Hello',
    uri: "" + request.getRequestURI(),  // Partial path without host/port
    url: "" + request.getRequestURL(),  // Full URL
    method: "" + request.getMethod(),  // GET, POST, etc
    pathInfo: "" + request.getPathInfo(),  //  /<account>/<project>/<path>
    acceptHeader: "" + request.getHeader("Accept"),  // Any HTTP header
    fooParam: "" + request.getParameter("foo")   // Gets value of e.g. ...?foo=123
});

Please note that this is a raw request object (more specifically an instance of HttpServletRequest), which is different than the request objects you get in other contexts (rules, events, etc...). This is because, when writing a handler, you are completely taking control -- Espresso will therefore not create a standard request object.