Bot Libre for Business

The Bot Libre web API

по admin опубликовано May 16 2014, 8:51

In addition to being able to embed your live chat channel on your own website, and access them from any Android device, you can also access your channel through the Bot Libre web API. The web API gives you the advantage of having complete control of your channel's client interface.

You can use the web API to access your channel from your own website through JavaScript, PHP or any other language. You can also use the web API to create your own mobile application to access your channel, such as an Android or iOS application.

A web API, is a set of HTTP GET/POST URI's that allow sending and receiving of message data. When you browse a website, your browser makes a series of HTTP GET/POST requests to URIs that return HTML content. In a web service the URIs return XML or JSON data, instead of HTML content.

The LIVE CHAT libre web API consists of two parts, a REST API with XML message content, and a web sockets API for distributed communication. The REST API takes HTTP POST XML data, and returns XML data.

HTTP XML POST API

  • http://www.botlibre.biz/rest/api/create-user
  • http://www.botlibre.biz/rest/api/check-user
  • http://www.botlibre.biz/rest/api/get-channels
  • http://www.botlibre.biz/rest/api/check-channel

create-user

The create-user API creates a new user, and returns the user's details.

URI: http://www.botlibre.biz/rest/api/create-user
Parameters: application, user, password, hint, name, showName, email, website, bio

XML POST Example

check-user

The check-user API validates a user, and returns the user's details.

URI: http://www.botlibre.biz/rest/api/check-user
Parameters: application, user, password, token

Parameters

applicationREQUIRED: The application ID. You can obtain an application ID from your user details page on the Bot Libre website.
userREQUIRED: The ID of the user.
passwordREQUIRED: The password of the user. A token can also be used.
tokenREQUIRED: The token of the user. A token can be obtained through check-user, and is valid until reset.

XML POST Example

get-channels

The get-channels API queries the details for all channels matching the criteria.

URI: http://www.botlibre.biz/rest/api/get-channels
Parameters: application, user, password, token, type, tag, category, sort, typeFilter, filter.

XML POST Example

check-channel

The check-channel API validates that a channel ID or name exists, and returns the channel's details.

URI: http://www.botlibre.biz/rest/api/check-channel
Parameters: application, user, password, token, id, name

Parameters

applicationREQUIRED: The application ID.
userOPTIONAL: The ID of the user. The user must be registered with FORUMS libre. If not passed the user will be anonymous. The user is required if the forum is private.
passwordOPTIONAL: The password of the user. A token can also be used.
tokenOPTIONAL: The token of the user. A token can be obtained through check-user, and is valid until reset.
idREQUIRED: The ID of the channel to validate. The channel's name can also be used, but the ID is better as it is guaranteed to be unique.
nameREQUIRED: The name of the channel to validate. The channel's ID can also be used.

XML POST Example

Web Socket API

The web socket API uses web sockets to communicate with the Bot Libre server. Most web browsers support web sockets from JavaScript, you can also get free open source web socket implementations for most programming languages, and mobile platforms.

Here is some example web socket code using JavaScript in a web browser. It assumes an HTTP connection has already been made to the Bot Libre server. If you have not connected to a channel through a web session, you can still establish a connection. Once you establish a connection, you will need to send a text message to connect to a channel of the form "connect channel-id user password application-id".

So, that is the basic web API. You can now build your own interface for your channel. You can use the API on your own website, or in your own mobile application.

For a complete Java code example of using the full API, refer to the SDK source code on Bot Libre on GitHub.


Идентификатор: 278
Теги: api, rest, mobile, android, ios, web
Опубликовано: May 16 2014, 8:51
Обновлено: May 4 2016, 11:56
Ответы: 0
Вид: 11190, сегодня: 3, неделю: 12, месяц: 50
0 0 0.0/5