# Module Development Example Question

**URL:** <https://forum.inductiveautomation.com/t/module-development-example-question/107639>\
**Category:** Module Development\
**Tags:** perspective\
**Created:** [June 20, 2025, 8:56pm UTC](https://forum.inductiveautomation.com/t/module-development-example-question/107639 "2025-06-20T20:56:14Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [September 12, 2025, 4:06pm UTC](https://forum.inductiveautomation.com/t/module-development-example-question/107639/3 "2025-09-12T16:06:51Z")

</div>

Contributing to the central OpenAPI definition from a module is very easy.

Just override/implement `mountRouteHandlers` in your module's gateway hook. The Route class we provide has an OpenAPI builder attached to it you can use to build up a response.

```java
    @Override
    public void mountRouteHandlers(RouteGroup routes) {
        routes.newRoute("/api/v1/session/:sessionId/pages")
            .type(RouteGroup.TYPE_JSON)
            .method(HttpMethod.GET)
            .requirePermission(PermissionType.READ)
            .itemListHandler(this::getSessionPages)
            .itemSerializer(gson)
            .itemSchema(SchemaUtil.fromType(PerspectivePageInfo.class))
            .openApi(api -> api
                .tag(SESSION_TAG)
                .summary("Perspective Pages")
                .description("Retrieves a list of all pages in a session.")
                .pathParameter("sessionId", "ID of the session", JsonType.STRING, null)
                .response(SC_NOT_FOUND, "The session ID does not exist"))
            .mount();

```

By default, routes added in this way will be exposed under `$host/data/$yourModuleId/$whateverRouteMountingPath` - so in the example above, you would  
`POST http://localhost:8088/data/myModuleId/someName`

You can override `getMountPathAlias` on your gateway hook to replace `yourModuleId` with some shorter alias for friendlier URLs - you're just in charge of avoiding collisions then.

There isn't any directly supported way to add custom URLs within an existing prefix, such as `resources`, but you can add them to `/api/v1/`, just like a bunch of our first party modules do.  
You should 'qualify' your additional methods as belonging to your module so it's clear to end users:

```python
        routes.addOpenApiGroup("Perspective", SESSION_TAG);
        routes.addOpenApiGroup("Perspective", CONFIG_THEMES_TAG);

```

And as for:

> [@Nathan\_Foster](#):
>
> Bonus if you can show how to integrate the X-Ignition-API-Token for authenticating requests.

You don't have to, if you use our route mounting system.  
`.requirePermission(PermissionType.READ)` (or `PermissionType.ACCESS/WRITE`)  
will automatically require the appropriate gateway access permission. If you _really_ want to have a distinct meaning of permissions, it's certainly possible, but you're going to have an easier time if you stick to what we provide for you automatically.

---

_[View the full topic](https://forum.inductiveautomation.com/t/module-development-example-question/107639)._
