Accessing the REST API

You can use the REST API by entering its URL in a browser window and entering your credentials.

Before you begin

Before you can use the REST API in a client, you must start the sample server or configure Rule Execution Server for your application server. See Starting and stopping the sample server or Configuring, respectively.

About this task

If you want to use the REST API through a web browser, you can log on to the Rule Execution Server console and switch to the REST API by adding /api/resourceNameAndQuery to the Rule Execution Server console context root. The application server automatically handles the session and all you have to do is log on at the first call or at each session timeout.

For example: http://localhost:9080/res/api/ruleapps

You can also use the basic HTTP authentication, or preemptive authentication, as described in the HTTP HTTP Specifications RFC 2617. This authentication method consists in passing the user name and password in the header in the Authorization header parameter. Most of the available tools that are used to test a REST API implement this authentication method.
Important: In this case, the API context root becomes apiauth.

Procedure

  1. Define the request as follows:
    • URL: http://host:port/res/api/resourceName/templateParameters?queryParameters
    • Body: None
    • Method: GET
    • Content-type: any
  2. Sign in as you would on the Rule Execution Server console.

Results

After the authentication response is successful, subsequent calls to the REST API use URLs that are built on this pattern:
http://host:port/res/api/resourceName/templateParameters?queryParameters

What to do next

You can now write and call REST methods as described in Using the REST API test tool.