How to find WildFly REST Endpoints

Discovering the list of available endpoints is crucial to map and troubleshoot REST Applications. This article will teach you three simple strategies to discover WildFly REST Endpoints which are available.

Option 1: Use the Management Console

The first and simplest approach is to access the Web Management Console to discover the active WildFly REST endpoints. Follow these steps:

  • Log into the Web Console, for example at localhost:9990
  • Select the Runtime Upper Tab
  • Click on the JAX-RS subsystem to see the available Endpoints
wildfly discover REST endpoints

As you can see, for each REST Controller you can see the list of HTTP Methods and the URL to test it.

Option 2: Use the Command Line Interface

Another option is to use the CLI to discover the available REST Endpoint. In order to do that, follow these steps:

  1. Connect to the CLI, for example with ./jboss-cli.sh -c
  2. Navigate through the /deployment model and read the resource recursively.

For example:

/deployment=cucumberdemo.war/subsystem=jaxrs:read-resource(include-runtime=true,recursive=true, recursive-depth=1)
{
    "outcome" => "success",
    "result" => {"rest-resource" => {"com.mastertheboss.jaxrs.TriangleController" => {
        "resource-class" => "com.mastertheboss.jaxrs.TriangleController",
        "rest-resource-paths" => [{
            "resource-path" => "/triangle/area",
            "consumes" => undefined,
            "produces" => undefined,
            "java-method" => "jakarta.ws.rs.core.Response com.mastertheboss.jaxrs.TriangleController.calculateArea(@QueryParam dou
ble base, @QueryParam double height)",
            "resource-methods" => ["GET /cucumberdemo/rest/triangle/area"]
        }],
        "sub-resource-locators" => undefined
    }}}
}

Option 3: Use OpenAPI

Finally, you can also use the OpenAPI MicroProfile extension to have a list of all available Endpoints. In order to use this option, you need to satisfy the following requirements:

  1. Make sure the OpenAPI extension is available in your configuration
  2. Then, deploy an application which activates the OpenAPI subsystem

The following article covers in detail how to use OpenAPI in WildFly: Getting started with OpenAPI on WildFly

After you complete the above requirements you can check the available REST Endpoints by requesting the /openapi URI:

 curl -v http://localhost:8080/openapi

Then, you will see the list of Endpoints which are available per deployment unit:

---
openapi: 3.0.3
info:
  title: democucumber.war
  version: "1.0"
servers:
- url: /democucumber
paths:
  /rest/triangle/area:
    get:
      parameters:
      - name: base
        in: query
        schema:
          format: double
          type: number
      - name: height
        in: query
        schema:
          format: double
          type: number
      responses:
        "200":
          description: OK

Conclusion

Finding REST endpoints in a WildFly application can be done using a variety of methods, including using the Management Console, the CLI and the OpenAPI documention. The choice of method depends on the level of access you have to the application and your specific requirements. By using a combination of these methods, you can effectively discover and interact with REST endpoints in a WildFly application.

Found the article helpful? if so please follow us on Socials