JSON-RPC web service
Table of contents
For information on how to construct a JSON-RPC request, see the Wikipedia article about JSON-RPC.
Send requests to the following URL:
The parts between
% should be replaced with the following:
%service-version%: the version of the service
%service-name%: the name of the service
%token%: a token which gives you access to the web service
- This token can be generated by using the Session web service's "start" method.
- When calling the Session web service's "start" method, the token can be omitted or replaced by a dash (
- If you use our OAuth2 implementation, you should work with a bearer token instead of the token in the URL. More information can be found here.
In a PHP application, the easiest way to invoke our web services is by using our library. For this you need the following:
- The RouteYou class files: https://source.routeyou.com/php/RouteYou_Json_Client.zip
- The PHP cURL and JSON libraries
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);