Difference between revisions of "Catalogue"

From SimplyBook.me
 
Line 61: Line 61:
 
===Authentication===
 
===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#getUserToken|getUserToken]]</code> or <code>[[Authentication#getToken|getToken]]</code> API methods 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'.  
+
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#getUserToken|getUserToken]]</code> or <code>[[Authentication#getToken|getToken]]</code> API methods 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 'Custom Features' link and select [[Custom_Features#API|API Custom Feature]] 'Settings'.  
  
 
== Methods ==
 
== Methods ==

Latest revision as of 19:07, 26 December 2016

General Information

SimplyBook.me API service build on 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:

  • jsonrpc - a version of JSON-RPC protocol. Always "2.0"
  • method - A String with the name of the method to be invoked.
  • params - An Array of objects to be passed as parameters to the defined method.
  • id - 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.

  • result - The data returned by the invoked method. If an error occurred while invoking the method, this value must be null.
  • error - A specified error code if there was an error invoking the method, otherwise null.
  • id - The id of the request it is responding to.

Example

  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"
  }

All calls of public service methods should have additional HTTP header:

Endpoint

Use URL https://user-api.simplybook.me/catalogue for all service API calls listed in methods section.

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 getUserToken or getToken API methods 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 'Custom Features' link and select API Custom Feature 'Settings'.

Methods

getCategories

getCategories()

No arguments. Returns Array.

Get lsit of ALL categories



getCities

getCities($country)

Parameters:

  • $country String

Returns Array.

Returns city list as Array order by name



getCompanyCount

getCompanyCount($filter)

Parameters:

  • $filter Object - filter object

Returns array.

Returns total companies count with specified filter$filter filter params. Object that contains following params

'search_string': String,
'service_name': String,
'company_name': String,
'company_address': String,
'tag_ids': [Integer, Integer, ...],
'tags': String,
'country_id': String,
'city_id': String,
'nearby': {
    'radius': Integer,
    'center': {
       'lat': Number,
       'lng': NUmber
    }
}

Use tag_ids OR tags



getCompanyInfo

getCompanyInfo($login)

Parameters:

  • $login String

Returns Object.

Returns company information by company login



getCompanyList

getCompanyList($filter, $from, $limit)

Parameters:

  • $filter Object - filter object
  • $from Integer - from position
  • $limit Integer - rows limit

Returns array.

Returns companies list$filter filter params. Object that contains following params

'search_string': String,
'service_name': String,
'company_name': String,
'company_address': String,
'tag_ids': [Integer, Integer, ...],
'tags': String,
'country_id': String,
'city_id': String,
'nearby': {
    'radius': Integer,
    'center': {
       'lat': Number,
       'lng': NUmber
    }
}

Use tag_ids OR tags



getCompanyMarkers

getCompanyMarkers($filter, $bounds, $zoom, $clustering)

Parameters:

  • $filter Object - filter object
  • $bounds
  • $zoom
  • $clustering

Returns array.

Returns company markers$filter filter params. Object that contains following params

'search_string': String,
'service_name': String,
'company_name': String,
'company_address': String,
'tag_ids': [Integer, Integer, ...],
'tags': String,
'country_id': String,
'city_id': String,
'nearby': {
    'radius': Integer,
    'center': {
       'lat': Number,
       'lng': NUmber
    }
}

Use tag_ids OR tags



getCompanyReviews

getCompanyReviews($login)

Parameters:

  • $login String

Returns Object.

Returns company reviews list



getCountries

getCountries()

No arguments. Returns Array.

Returns country list as Array order by name



getFeedbackList

getFeedbackList()

No arguments. Returns Array.

Get lsit of ALL simplybook feedbacks



getPromotionCount

getPromotionCount($filter)

Parameters:

  • $filter Object - filter object

Returns array.

Returns total active promotions count with specified filter$filter filter params. Object that contains following params

'search_string': String,
'service_name': String,
'company_name': String,
'company_address': String,
'tag_ids': [Integer, Integer, ...],
'tags': String,
'country_id': String,
'city_id': String,
'nearby': {
    'radius': Integer,
    'center': {
       'lat': Number,
       'lng': NUmber
    }
}

Use tag_ids OR tags



getPromotionInfo

getPromotionInfo($id, $feedbackFrom, $feedbackCount)

Parameters:

  • $id Integer
  • $feedbackFrom Integer = 0
  • $feedbackCount Integer = 100

Returns Object.

Returns promotion information by id



getPromotionList

getPromotionList($filter, $from, $limit)

Parameters:

  • $filter Object - filter object
  • $from Integer - from position
  • $limit Integer - rows limit

Returns array.

Returns active promotion list$filter filter params. Object that contains following params

'search_string': String,
'service_name': String,
'company_name': String,
'company_address': String,
'tag_ids': [Integer, Integer, ...],
'tags': String,
'country_id': String,
'city_id': String,
'nearby': {
    'radius': Integer,
    'center': {
       'lat': Number,
       'lng': NUmber
    }
}

Use tag_ids OR tags



getPromotionListByIds

getPromotionListByIds($ids)

Parameters:

  • $ids

Returns array.

Returns active promotion list



getPromotionReviews

getPromotionReviews($promotionId)

Parameters:

  • $promotionId Integer

Returns Object.

Returns promotion reviews list



getRecentCompanies

getRecentCompanies($count)

Parameters:

  • $count Integer

Returns Array.

Returns list of companies ordered by date DESC



getRecentFeedbacks

getRecentFeedbacks($count)

Parameters:

  • $count Integer

Returns Array.

Returns list of feedbacs ordered by date DESC



getRecentPromotions

getRecentPromotions($count)

Parameters:

  • $count Integer

Returns Array.

Returns list of promotions ordered by date DESC



getRelatedPromotions

getRelatedPromotions($id, $count)

Parameters:

  • $id Integer
  • $count Integer = 10

Returns Array.

Returns related promotions by given promotion id



getTags

getTags($filter)

Parameters:

  • $filter Object - filter object

Returns Array.

Returns tags list$filter filter params. Object that contains following params

'tag_ids': [Integer, Integer, ...],
'tags': String,
'country_id': String,
'city_id': String

Use tag_ids OR tags



getTopCities

getTopCities()

No arguments. Returns Array.

Returns city list as Array order by company count in city



getTopCountries

getTopCountries()

No arguments. Returns Array.

Returns country list as Array order by company count in country