API

From Mibbit Wiki
Jump to: navigation, search

Wiki Home | FAQ | Features | IRC Commands | IRC Modes | Widget Information | Widget: WebIRC Server Setup | URI Parameters | Wish List | Registration Information | Mibbit Staff

Home | Quick Start Guide | Live Mibbit Help


API | URI Parameters | Auto Connect


What is an API

An application programming interface (API) is an interface implemented by a software program that enables it to interact with other software. It facilitates interaction between different software programs similar to the way the user interface facilitates interaction between humans and computers.

Accessing the API

The Mibbit API allows you to gather information on your widget. You have to have a manager account, and a settings ID for the API to work. Where you see <settingsID> in this document, replace it with your own settings ID. This is in the widget URL you are using or in the example links on the Manager's "Connection" page).

For example: widget.mibbit.com/?settings=42c110f3cbbaea489c0b0e40a40e6e18&channel=%23chat

Number of Users on a Widget

If you run a site, and are using the widget, you might want to show elsewhere on your site how many people are using it. We provide multiple formats for this information.

The results are updated every 20 minutes, so should give you a reasonable idea of how many mibbitians are chatting but not the exact number.

In the example output section, we assume there are 15 users using the widget.

Direct Number

A file containing only the number.

Format: http://api.mibbit.com/<settingsID>

This is most useful for server side languages, such as PHP.

Output:

15

Example:
api.mibbit.com/42c110f3cbbaea489c0b0e40a40e6e18


Javascript Function

This format outputs a snippet of javascript which will write to the document the current number. So you can include this in your HTML, without any server-side changes needed.

Format: http://api.mibbit.com/<settingsID>.js

Usage (in an HTML page):

There are <script src="http://api.mibbit.com/42c...e18.js"></script> people chatting 

Output:

document.write("15")

Examples:
api.mibbit.com/42c110f3cbbaea489c0b0e40a40e6e18.js (Javascript example)
api-demo (full blown example)

JSON Object

You might prefer to use this link, it’s likely that later on this one will contain more useful info as well.

http://api.mibbit.com/<settingsID>.json

Delivers data as json object to be processed by your javascript (e.g. ajax call):

{mibbitians:15}

Example: api.mibbit.com/42c110f3cbbaea489c0b0e40a40e6e18.json

JSONP=

Also available, as requested:

http://api.mibbit.com/<settingsID>.jsonp

(details will follow)

Example: http://api.mibbit.com/42c110f3cbbaea489c0b0e40a40e6e18.jsonp?callback=some_function

Graphical Image

The following formats give you access to an image showing the amount of users in the pass week of month.

http://api.mibbit.com/graphs/<settingsID>_week_mini.png (thumbnail)

http://api.mibbit.com/graphs/<settingsID>_month_mini.png (thumbnail)

The following graphs may have a wrong scaling (will be fixed as soon as possible)

http://api.mibbit.com/graphs/<settingsID>_month.png

http://api.mibbit.com/graphs/<settingsID>_week.png

Usage:

Last 4 weeks 
<img src="http://api.mibbit.com/graphs/42c...e18_month_mini.png">
user stats.

View Settings

When the Mibbit Widget loads, it makes an API call that returns the settings changed from the default values. The settings change is a Javascript file that sets a few global variables.

Format: http://api.mibbit.com/settings/<settingsID>.js

Usage: Used internally, does not seem to be a current usage externally.

Output: var LOADED_SETTINGS={/* modified settings */}; var PREMIUM_DOMAIN=""; var CONNECT_SERVER=""; var CONNECT_CHANNEL="";

Request a Feature

New API features are in the works, and this page will be updated when they are available.

For any feature requests for the new API, ask axod at #help on irc.mibbit.net or add them to the WishList