JSONP web service

Table of contents


Send requests to the following URL:

The parts between % should be replaced with the following:

Construct request

A JSONP request is sent using HTTP GET, with these URL parameters:

Keep in mind that most browsers have a limit on URL length, passing large amounts of data to the web service may not be possible with this protocol (it is not a problem for the response).


The server sends back a JSON encoded object containing these keys:

If you have provided the callback parameter in the request, your callback function is called with the response.

Example (PHP)

The following code fetches all the routes (private ones included) you have marked as favorite. Note that there is no error handling in this example.

// Start session. Acquire the token that is needed for the subsequent web service calls.
$params = array(
$url = '' .
$response = json_decode(file_get_contents($url), true);
$token = $response['result'];

// Log in.
$params = array(
$url = '' . $token .
    '?id=1&method=loginWithEmail&params=' . json_encode($params);
$response = json_decode(file_get_contents($url), true);
$user = $response['result'];

// Fetch favourite routes.
// When parameter permission.readable is omitted, only public routes are returned.
$params = array(
        '' => $user['id'],
        'permission.readable' => true
$url = '' . $token .
    '?id=1&method=search&params=' . json_encode($params);
$response = json_decode(file_get_contents($url), true);
$favorites = $response['result'];

Back to RouteYou

© 2006-2024 RouteYou -