Difference between revisions of "API"

From Mibbit Wiki
Jump to: navigation, search
(xhr api demo)
(<settingsID>)
Line 8: Line 8:
 
{{notice|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.}}
 
{{notice|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.}}
  
First thing you need, is the settingsID. This is in the widget URL you are using.
+
First thing you need, is the settingsID. This is in the widget URL you are using (last line in [[Manager]] "Prefs").
  
 
For example:
 
For example:
widget.mibbit.com/?settings='''42c110f3cbbaea489c0b0e40a40e6e18'''&channel=%23mibbit
+
widget.mibbit.com/?settings='''42c110f3cbbaea489c0b0e40a40e6e18'''&channel=%23chat
  
 
The section in bold is the settingsID
 
The section in bold is the settingsID
  
Just replace (settingsID) with your particular ID.
+
Just replace <settingsID> with your particular ID.
  
 
===Using the API===
 
===Using the API===
Line 21: Line 21:
 
The link below outputs just the number of mibbitians using your widget. You could use this from PHP,Python,etc and get it to output in the page.
 
The link below outputs just the number of mibbitians using your widget. You could use this from PHP,Python,etc and get it to output in the page.
  
'''<nowiki>http://api.mibbit.com/(settingsID)</nowiki>'''
+
'''<nowiki>http://api.mibbit.com/<settingsID></nowiki>'''
  
 
Output:
 
Output:
Line 34: Line 34:
 
This one outputs a snippet of javascript which will write to the document the current number. So you can include this in your HTML, without any backend changes needed.
 
This one outputs a snippet of javascript which will write to the document the current number. So you can include this in your HTML, without any backend changes needed.
  
'''<nowiki>http://api.mibbit.com/(settingsID).js</nowiki>'''
+
'''<nowiki>http://api.mibbit.com/<settingsID>.js</nowiki>'''
  
 
Usage (on your html-page):
 
Usage (on your html-page):
Line 49: Line 49:
 
You might prefer to use this link, it’s likely that later on this one will contain more useful info as well.
 
You might prefer to use this link, it’s likely that later on this one will contain more useful info as well.
  
'''<nowiki>http://api.mibbit.com/(settingsID).json</nowiki>'''
+
'''<nowiki>http://api.mibbit.com/<settingsID>.json</nowiki>'''
  
 
Delivers data as json object to be processed by your javascript (e.g. ajax call):  
 
Delivers data as json object to be processed by your javascript (e.g. ajax call):  
Line 59: Line 59:
 
There are also a couple of graphs updated at
 
There are also a couple of graphs updated at
  
'''<nowiki>http://api.mibbit.com/graphs/(settingsID)_week_mini.png</nowiki>''' (thumbnail)
+
'''<nowiki>http://api.mibbit.com/graphs/<settingsID>_week_mini.png</nowiki>''' (thumbnail)
  
'''<nowiki>http://api.mibbit.com/graphs/(settingsID)_month_mini.png</nowiki>''' (thumbnail)
+
'''<nowiki>http://api.mibbit.com/graphs/<settingsID>_month_mini.png</nowiki>''' (thumbnail)
  
'''<nowiki>http://api.mibbit.com/graphs/(settingsID)_month.png</nowiki>'''  
+
'''<nowiki>http://api.mibbit.com/graphs/<settingsID>_month.png</nowiki>'''  
  
 
Usage:
 
Usage:

Revision as of 11:37, 26 December 2009

API | URI Parameters | Auto Connect


How many people are using my 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. Well now you can do that easily.

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.

First thing you need, is the settingsID. This is in the widget URL you are using (last line in Manager "Prefs").

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

The section in bold is the settingsID

Just replace <settingsID> with your particular ID.

Using the API

The link below outputs just the number of mibbitians using your widget. You could use this from PHP,Python,etc and get it to output in the page.

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

Output:

15

Examples:
api.mibbit.com/42c110f3cbbaea489c0b0e40a40e6e18
ajax api demo



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

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

Usage (on your 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)


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


There are also a couple of graphs updated at

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

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

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

Usage:

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


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 at #help on irc.mibbit.net or add them to the WishList