Changes

From SimplyBook.me
no edit summary
Line 1: Line 1:  +
==General Information==
 +
 +
SimplyBook.me API service build on [https://en.wikipedia.org/wiki/JSON-RPC JSON-RPC] remote procedure call protocol. A remote method is invoked by sending a request to a remote service using HTTPS. All transfer types are single objects, serialized using JSON. A request is a call to a specific method provided by a remote system. It must contain three certain properties:
 +
 +
* <code>jsonrpc</code> - a version of JSON-RPC protocol. Always <code>"2.0"</code>
 +
* <code>method</code> - A String with the name of the method to be invoked.
 +
* <code>params</code> - An Array of objects to be passed as parameters to the defined method.
 +
* <code>id</code> - A value of any type, which is used to match the response with the request that it is replying to.
 +
 +
The receiver of the request must reply with a valid response to all received requests. A response must contain the properties mentioned below.
 +
 +
* <code>result</code> - The data returned by the invoked method. If an error occurred while invoking the method, this value must be null.
 +
* <code>error</code> - A specified error code if there was an error invoking the method, otherwise null.
 +
* <code>id</code> - The id of the request it is responding to.
 +
 +
Example
 +
 +
<pre>
 +
  Request
 +
  {
 +
    "jsonrpc": "2.0",
 +
    "method": "getEventList",
 +
    "params":[],
 +
    "id":1
 +
  }
 +
 
 +
  Response
 +
  {
 +
    "result": {
 +
        "1": {
 +
            "id": "1",
 +
            "name": "Часовая фотосесcия",
 +
            "duration": "60",
 +
            "hide_duration": "0",
 +
            "description": "<p>Если Вы хотите попробовать себя в роли модели, но не определились с образом. <br /> 5-7 отретушированных и готовых к печати фотографий + отснятый материал на диске</p>",
 +
            "picture": "a200edab10b669225e22d2b3803a38b5.jpg",
 +
            "is_public": "1",
 +
            "is_active": "1",
 +
            "position": "0",
 +
            "is_recurring": "0",
 +
            "picture_path": "/uploads/mib/event__picture/small/a200edab10b669225e22d2b3803a38b5.jpg",
 +
            "price": "300.0000",
 +
            "currency": "UAH",
 +
            "categories": ["1"]
 +
        },
 +
        ...
 +
    },
 +
    "id": "1",
 +
    "jsonrpc": "2.0"
 +
  }
 +
</pre>
 +
 +
All calls of public service methods should have two additional HTTP headers:
 +
 +
* <code>X-Company-Login</code>
 +
* <code>X-Token</code> an authentication token. See [[#Authentication|authentication]] section.
 +
 +
===Endpoint===
 +
 +
Use URL <code>https://user-api.simplybook.me/</code> for all public service API calls.
 +
 +
===Authentication===
 +
 +
Using Simplybook API methods require an authentification. To authorize in Simplybook API you need to get an access key — access-token. In order to get this access-token you should call the JSON-RPC method <code>[[Authentication#getToken|getToken]]</code> API method on https://user-api.simplybook.me/login service passing your personal API-key. You can copy your API-key at admin interface: go to the 'Plugins' link and select [[Plugins#API|API plugin]] 'Settings'.
 +
 +
After
 +
 
== Methods ==
 
== Methods ==