Routers

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.

The following resources are applicable:

/routers

The following operations are supported on this resource:

GET

Returns a list of routers and their bounds.

Response Body

element: RouterList
media types: application/xml
application/json
text/xml

a representation of the graphs and their geographic bounds, in JSON or XML depending on the Accept header in the HTTP request.

PUT

Reload the graphs for all registered routerIds from disk.

Parameters

name description type default
path (no documentation provided) query
preEvict (no documentation provided) query true

Response Body

element: (custom)
media types: application/json

(no documentation provided)

DELETE

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

Response Body

element: (custom)
media types: text/plain

(no documentation provided)

/routers/{routerId}

The following operations are supported on this resource:

GET

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

Parameters

name description type default
routerId (no documentation provided) path

Response Body

element: RouterInfo
media types: application/xml
application/json
text/xml

(no documentation provided)

PUT

Load the graph for the specified routerId from disk.

Parameters

name description type default
routerId (no documentation provided) path
preEvict 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. FIXME @param upload read the graph from the PUT data stream instead of from disk. query true

Response Body

element: (custom)
media types: text/plain

(no documentation provided)

POST

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

Parameters

name description type default
routerId (no documentation provided) path
preEvict (no documentation provided) query true
loadLevel (no documentation provided) query FULL

Request Body

element: is
media types: application/octet-stream

(no documentation provided)

Response Body

element: (custom)
media types: text/plain

(no documentation provided)

POST

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.

Parameters

name description type default
routerId (no documentation provided) path
preEvict (no documentation provided) query true

Request Body

element: input
media types: application/zip

(no documentation provided)

Response Body

element: (custom)
media types: text/plain

(no documentation provided)

DELETE

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

Parameters

name description type default
routerId (no documentation provided) path

Response Body

element: (custom)
media types: text/plain

status code 200 if the routerId was de-registered, 404 if the routerId was not registered.

/routers/save

POST

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.

Parameters

name description type default
routerId (no documentation provided) query

Request Body

element: is
media types: application/octet-stream

(no documentation provided)

Response Body

element: (custom)
media types: text/plain

(no documentation provided)