User Manual

Home HomePre page Avatar Chat Parameters | Server API Next page

Data API


Introduction
JavaScript
XML


Query Data API List
Get Rooms Data API
Request
Response
JavaScript Example
XML Example
Get Room Online Users API
Request
Response
JavaScript Example
XML Example
Get Online API
Request
Response
JavaScript Example
XML Example

Push Data API List
System Message API
Broadcast API

Introduction

123 Flash Chat HTTP Server provides some useful data APIs for the third-party application to invoke data by an HTTP request.
The chat HTTP server enables two types of request and response. Please refer to Data API for detailed information of Data API settings.

JavaScript

Request Format: http://<123 Flash Chat HTTP server IP or domain>:port/DataAPIName.js
Response Format: var variable = (JSON format);
About how to handle the JSON format, refer to http://www.json.org/

XML:

Request Format: http://<123 Flash Chat HTTP server IP or domain>:port/DataAPIName.js
Response Format: Standard XML Format

Query Data API List


Get Rooms Data API

This API is used to get the room list from the HTTP server of the chat.

Request

Data API name: rooms (.js or .xml)
Request URL: <123 Flash Chat HTTP server IP or domain>:port/

HTTP get parameters:

group: group name (eg: group=default)
listrooms: specify the return room list by room's ID, room'id split by "," (eg: listroom=1,2,3)
These two HTTP get parameters are not obligatory to follow the HTTP request URL.

Response

Response Data Attributes Description:
id: unique id
name: name
max: max user limit
desc: description
count: current users amount
owner: moderator list, split by ","
speaker: speaker list, split by ","
wm: welcome message
memberonly: whether the unregistered guest has the permission to enter or not.
passallmessage: whether to activate the moderated-chat module or not (0 means disabled / 1 means activated.)
en: room status is open or close (0 means closed / 1 means opened)
st: it determines the room will only be displayed in the avatar chat client, or in the text chat room list as well. (0 means displayed in text chat room list too, 2 means only displayed in the avatar chat client side.)

JavaScript Response Data Format:
var rooms =[{"max":200,"desc":"Tip: Here you may test enter, exit room, private chat, etc.","count":0,"speaker":"","wm":"","memberonly":"0","passallmessage":"1","id":"1","pwd":"0","name":"General Test","owner":"admin","en":"1","st":0}];

XML Response Data Format:
<rooms>
<room en="1" name="General Test" id="1" owner="admin" memberonly="0" desc="Tip: Here you may test enter, exit room, private chat, etc." count="0" passallmessage="1" pwd="0" max="200" wm="" st="0" speaker=""/>
</rooms>

JavaScript Example

The following HTML code will display the rooms' names, it can be copied and pasted to a new HTML file and run smoothly.
<html>
<head>
<script language="javascript" src="http://localhost:35555/rooms.js"></script>
</head>
<body>
<script language="javascript">
document.write("Rooms List: <br/>");
var roomsLength=rooms.length;
for(var i=0;i<roomsLength;i++)
{
document.write(rooms[i].name);
document.write("<br/>");
}
</script>
</body>
</html>

XML Example

You could use any program language to request the URL: http://localhost:35555/rooms.xml, and parse the XML response.

Get Room Online Users API

This API is used to get the user list of a special room from chat HTTP server

Request

Data API name: roomonlineusers(.js or .xml)

Request URL: http://<123 Flash Chat HTTP server IP or domain>:port/

HTTP get parameters:
group: group name (eg: group=default)
roomid: specify to get which room's user list (eg: roomid=1)
These two HTTP get parameters are not obligatory to follow the HTTP request URL.

Response

Response Data Attributes Description:
name: user's name
nickname: user's nickname

JavaScript Response Data Format:
var roomonlineusers=[{"nickname":"owen","name":"owen"}];

XML Response Data Format:
<roomonlineusers>
<user nickname="owen" name="owen"/>
</roomonlineusers>

JavaScript Example

The following code will display the user's nickname in a room, you could copy and paste the following code into a new html file and run it.
<html>
<head>
<script language="javascript" src="http://localhost:35555/roomonlineusers.js"></script>
</head>
<body>
<script language="javascript">
var roomOnlineUsersLength=roomonlineusers.length;
document.write("Room Online User List: <br/>");
for(var i=0;i<roomOnlineUsersLength;i++)
{
document.write(roomonlineusers[i].nickname);
document.write("<br/>");
}
</script>
</body>
</html>

XML Example

You could use any program language to request the URL: http://localhost:35555/ roomonlineusers.xml, and parse the xml response.

Get Online API

This API used to get the group chat connections, logon users and chat rooms.

Request

Data API name: online (.js or .xml)

Request URL: http:// <123 Flash Chat HTTP server IP or domain>:port/

HTTP get parameters:
group: group name (eg: group=default)
This HTTP get parameters are not obligatory to follow the HTTP request URL.

Response

Response Data Attributes Description:
cn: chat connections
ln: logon users
rn: chat rooms

JavaScript Response Data Format:
var online ={"ln":1,"cn":2, "rn":10};

XML Response Data Format:
<online ln="1" cn="2" rn="10" />

JavaScript Example

The following html code will display the group chat connections, logon users and chat rooms, you could copy and paste following code to a new html file and run it.
<html>
<head>
<script language="javascript" src="http://localhost:35555/online.js"></script>
</head>
<body>
<script language="javascript">
document.write("Chat connections: "+ online.cn);
document.write("<br/>");
document.write("Logon users: "+ online.ln);
document.write("<br/>");
document.write("Chat rooms: "+ online.rn);
</script>
</body>
</html>

XML Example

You could use any program language to request the URL: http://localhost:35555/online.xml, and parse the XML response.

Push Data API List

System Message API

Request

Data API name: systemmessage.api

Request URL: http://<123 Flash Chat HTTP server IP or domain>:port/

HTTP get parameters:

msg: the system message will be displayed in the room(obligatory, the msg's value couldn't be empty)

group: group name (not obligatory, default value is "default")

roomid: specify the room will receive the system message (not obligatory, default value is "1")

b: specify whether the message is bold font (not obligatory, default value is "1")

u: specify whether the message is underline font (not obligatory, default value is "0")

i: specify whether the message is italic font (not obligatory, default value is "0")

fontsize: specify the message's font size (not obligatory, default value is "12")

color: specify the message's font color (not obligatory, default value is "0x346AA0")

Response

Success: 0

Error status code meaning:

403: forbidden error, please check your data-api settings in <123flashchat installation directory>/server/etc/groups/default/server.xml

404: request parameters error or request API address error, please check your request URL.

Example

Simple Example:

http://localhost:35555/systemmessage.api?msg=123flashchat

Advanced Example:

http://localhost:35555/systemmessage.api?msg=123flashchat&group=default&roomid=1&b

=1&u=0&i=0&fontsize=12&color=0x346AA0

Broadcast API

Request

Data API name: broadcast.api

Request URL: http://<123 Flash Chat HTTP server IP or domain>:port/

HTTP get parameters:

msg: the broadcast message will be send to the whole group or to a room (obligatory, the msg's value couldn't be empty)

group: group name (not obligatory, default value is "default")

roomid: specify the room will receive the message (not obligatory, default value is empty)

username: specify the username who send the message (not obligatory, default value is "admin")

Response

Success: 0

Error status code meaning:

403: forbidden error, please check your data-api settings in <123flashchat installation directory>/server/etc/groups/default/server.xml

404: request parameters error or request API address error, please check your request URL.

Example

Simple Example:

http://localhost:35555/broadcast.api?msg=123flashchat

Advanced Example:

http://localhost:35555/broadcast.api?msg=123flashchat&group=default&roomid=&username=admin

Related links:

For Developers


Home HomePre page Avatar Chat Parameters | Server API Next page

About Us | Contact us | Company Blog | Partnership | Affiliate | Forum | Privacy policy | Terms of Use | SiteMap | Links

Call Sales Now! USA 408-728-6398, UK +44-20-3286-1986, HK +852-8121-1988

Share 123 Flash Chat:

Copyright © TopCMM Software Limited 2001-2016 All Rights Reserved.

Powered by Greek-Chat.gr