Routers Resource

This REST API endpoint allows remotely loading, reloading, and evicting graphs on a running server. A GraphService maintains a mapping between routerIds and specific Graph objects. The HTTP verbs are used as follows to manipulate that mapping: GET - see the registered routerIds and Graphs, verify whether a particular routerId is registered PUT - create or replace a mapping from a routerId to a Graph loaded from the server filesystem POST - create or replace a mapping from a routerId to a serialized Graph sent in the request DELETE - de-register a routerId, releasing the reference to the associated graph The HTTP request URLs are of the form /ws/routers/{routerId}, where the routerId is optional. If a routerId is supplied in the URL, the verb will act upon the mapping for that specific routerId. If no routerId is given, the verb will act upon all routerIds currently registered. For example: GET http://localhost/otp-rest-servlet/ws/routers will retrieve a list of all registered routerId -> Graph mappings and their geographic bounds. GET http://localhost/otp-rest-servlet/ws/routers/london will return status code 200 and a brief description of the 'london' graph including geographic bounds, or 404 if the 'london' routerId is not registered. PUT http://localhost/otp-rest-servlet/ws/routers will reload the graphs for all currently registered routerIds from disk. PUT http://localhost/otp-rest-servlet/ws/routers/paris will load a Graph from a sub-directory called 'paris' and associate it with the routerId 'paris'. DELETE http://localhost/otp-rest-servlet/ws/routers/paris will release the Paris Graph and de-register the 'paris' routerId. DELETE http://localhost/otp-rest-servlet/ws/routers will de-register all currently registered routerIds. The GET methods are not secured, but all other methods are secured under ROLE_ROUTERS. See documentation for individual methods for additional parameters.

GET /routers

Returns a list of routers and their bounds.

Response Body
media type data type description
application/json RouterList (JSON) a representation of the graphs and their geographic bounds, in JSON or XML depending on the Accept header in the HTTP request.
application/xml routerList (XML)
text/xml routerList (XML)

GET /routers/{routerId}

Returns the bounds for a specific routerId, or verifies whether it is registered.

Request Parameters
name type description
routerId path
Response Body
media type data type
application/json RouterInfo (JSON)
application/xml routerInfo (XML)
text/xml routerInfo (XML)

PUT /routers

Reload the graphs for all registered routerIds from disk.

Security Roles Allowed
ROUTERS
Request Parameters
name type description default constraints
force query true boolean
path query    
preEvict query true boolean
Response Body
media type data type
application/json object (JSON)

PUT /routers/{routerId}

Load the graph for the specified routerId from disk.

Security Roles Allowed
ROUTERS
Request Parameters
name type description default constraints
routerId path    
preEvict query before reloading each graph, evict the existing graph. This will prevent memory usage from increasing during the reload, but routing will be unavailable on this routerId for the duration of the operation. true boolean
Response Body
media type data type
text/plain (custom)

POST /routers/{routerId}

Deserialize a graph sent with the HTTP request as POST data, associating it with the given routerId.

Security Roles Allowed
ROUTERS
Request Parameters
name type description default constraints
routerId path    
loadLevel query FULL "BASIC" or "DEBUG" or "FULL"
preEvict query true boolean
Request Body
media type data type
application/octet-stream (custom)
Response Body
media type data type
text/plain (custom)

POST /routers/{routerId}

Build a graph from data in the ZIP file posted over the wire, associating it with the given router ID. This method will be selected when the Content-Type is application/zip.

Security Roles Allowed
ROUTERS
Request Parameters
name type description default constraints
routerId path    
preEvict query true boolean
Request Body
media type data type
application/zip (custom)
Response Body
media type data type
text/plain (custom)

POST /routers/save

Save the graph data, but don't load it in memory. The file location is based on routerId. If the graph already exists, the graph will be overwritten.

Security Roles Allowed
ROUTERS
Request Parameters
name type description
routerId query
Request Body
media type data type
application/octet-stream (custom)
Response Body
media type data type
text/plain (custom)

DELETE /routers

De-register all registered routerIds, evicting them from memory.

Security Roles Allowed
ROUTERS
Response Body
media type data type
text/plain (custom)

DELETE /routers/{routerId}

De-register a specific routerId, evicting the associated graph from memory.

Security Roles Allowed
ROUTERS
Request Parameters
name type description
routerId path
Response Body
media type data type description
text/plain (custom) status code 200 if the routerId was de-registered, 404 if the routerId was not registered.