Answering REST API Questions

The /api/* surface is wide and grows organically. Most agents over-rely on search to find endpoints, when the truth is two greps away in web.xml.

When to use this runbook

When a user asks "is there an API to do X" and you cannot name the endpoint, or when you need an endpoint's HTTP method or permission model before recommending it.

Context

wikantik-war/src/main/webapp/WEB-INF/web.xml is the contract: every servlet (every *Resource.java) has both a <servlet> declaration and a <servlet-mapping>. The mapping shows the URL pattern; the declaration shows the implementation class. Together they answer "is there an endpoint for X" with full certainty. As of 2.4.56 the file maps:

Sub-paths are handled inside a single servlet, because a servlet cannot match a variable in the middle of a path. For example POST /api/pages/{name}/rename is dispatched by PageResource.doPost, and the page-scoped Knowledge Graph curation lives under /api/page-knowledge/*, not under /api/pages/{name}/....

The Resource classes themselves (wikantik-rest/src/main/java/com/wikantik/rest/*Resource.java) are the source of truth for HTTP method shape and permission model. They are plain servlets that extend RestServletBase, so there are no JAX-RS style @GET or @QueryParam annotations to look for:

Several layers sit in front of the servlet:

Walkthrough

The frontmatter steps are the canonical procedure. The order matters: web.xml first (it tells you whether the endpoint exists at all), then the Resource (it tells you the method and permission), then the body (it tells you the response shape). Only then write the curl or client call, and test it as the weakest principal that should succeed and as an anonymous caller that should be refused.

Pitfalls

The frontmatter pitfalls cover the recurring traps. The permission-by-analogy mistake is the most common — agents see view work and assume delete will too on the same path. Related traps: renaming is a POST to /api/pages/{name}/rename with a newName body, not a PUT of a new name, and operator functions (users, groups, policy grants, connectors, drift, audit) live under /admin/*, not /api/*.


Cluster Hub: Agent Cookbook (agent-cookbook)