Examples
Take a look at examples of code structures for some general calls.
All parameters are of type “string” unless otherwise specified.
The terms “username” and “password” are used in the username and password fields, this must be substituted with your assigned username and password. Any other specific values used will be as examples only and need to be substituted programmatically with your own applicable values.
General structure
A typical JSON call structure will look as follows:
{ "method": "br_get_link", "params": [ { "bridge_username":"test", "bridge_password":"test1" }, "" ], "id": 1 }
where “method” is the name of the call, “params” is the parameters, and “id” is always “1”. The response to the above would look like this:
{ "id": 1, "error": null, "result": [ { "id": "3", "principal_id": "6001", "principal_name": "Test vagrant system 1", "principal_username": "api" }, { "id": "4", "principal_id": "6004", "principal_name": "Test (plinth) vagrant system 4", "principal_username": "censysad" }, { "id": "2", "principal_id": "6006", "principal_name": "Test (plinth) vagrant system 6", "principal_username": "hansolo" } ] }
Code usage
Different programming languages offer different methods of making JSON-RPC calls. An example would be the following in PHP with CURL:
$data_string = '{ "method": "br_get_link", "params": [ { "bridge_username":"test", "bridge_password":"test1" }, "" ], "id": 1 } '; $ch = curl_init('http://bridge.resrequest.com/api/'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($data_string)) ); $result = curl_exec($ch); echo $result;
Keep up to date with us
Menu
Visit our website
ResRequest Modules
- Business Intelligence
- Central Reservations
- Channel Management
- Customer Relationship Management
- Developer
- Email Series 2022
- Email Series 2023
- Financial Management
- Marketing tools
- Payment Gateways
- Point of sale
- Product
- Professional Services
- Property Management
- ResConnect
- ResInsite
- ResNova
- System Setup
- Technical Alerts
- Technical Tips
- Telephone Management
- Webinars Index