Skip to content

Toro Cloud Dev Center

URL alias endpoint

The URL alias endpoint binds short, easy to remember URL paths to the methods inside your services, scripts and code. This makes your APIs look much nicer to your customers, and allows for URLs to invoke different code over time without changing the URL itself. This endpoint has no requirements in terms of method signatures for code being invoked. All services that are invoked through this endpoint are available in the Martini root context /api.


Property Default Description
Name (required) The name of the endpoint.
Service (required) The service to execute when the endpoint is triggered.
Run As Anonymous The user to run the service in behalf of. This is logged to Tracker.
Document Type <Name of endpoint type> The document type to be used when adding documents to Tracker as this endpoint is triggered.
Auto Start true Whether or not to automatically start the endpoint upon package startup.

URL alias-specific configuration

Properties Default Description
URL Alias (required) The URL pattern to be used by the service.
Request Method The HTTP method used to match the request.
Secured false If true, only authorized users can hit the URL.
Users The users allowed to execute the URL alias.
Groups The groups allowed to execute the URL alias.


Gloop as service

Consider the following example:

Example URL alias endpoint configuration

This endpoint exposes the configured service under the URL GET /api/sendJMSMessage, with request parameters jmsQueue and messageContent. These request parameters correspond to the input of the service:

Example service input

Sending the request GET /api/sendJMSMessage?jmsQueue=queue://news&messageContent=Hello invokes the underlying service.

Want more examples?

The distribution ships with a Martini package called examples, which contains services (including the above example) demonstrating more use cases.

Groovy as service

We can replicate the above example in Groovy. Consider the following snippet:

class JMSExamples {

    String sendJms(String jmsQueue, String messageContent) {


Configuring this as a service of the endpoint above will expose it as well under the same URL: GET /api/sendJMSMessage?jmsQueue=queue://news&messageContent=Hello.

publishTo what?

The method publishTo used in this snippet is a Groovy extension to the String class. This allows developers to conveniently publish, in this case, a String to a JMS destination, in one line.