Publicitat

No hi ha cap versió Català disponible d'aquest tema. La versió següent és en Anglès.

JSON-RPC web service

Continguts

Construct request

For information on how to construct a JSON-RPC request, see the Wikipedia article about JSON-RPC.

Endpoint

Send requests to the following URL:

https://api.routeyou.com/%service-version%/json/%service-name%/%token%

The parts between % should be replaced with the following:

PHP: RouteYou_Json_Client library class

In a PHP application, the easiest way to invoke our web services is by using our library. For this you need the following:

Example

The following code fetches all the routes, including private ones, you have marked as favorite.

// Simply provide the class with your key, the token will be generated automatically.
RouteYou_Json_Client::setKey('<key>');

// Log in.
$userService = new RouteYou_Json_Client('User', '2.0');
$user = $userService->logInWithEmail('<email>', '<password>');

// Fetch favorite routes.
// When parameter permission.readable is omitted, only public routes are returned.
$routeService = new RouteYou_Json_Client('Route', '2.0');
$favorites = $routeService->search(array(
        'favorite.user.id' => $user['id'],
        'permission.readable' => true
    ));
var_dump($favorites);

Torna a RouteYou

© 2006-2024 RouteYou - www.routeyou.com