API Reference
From Sl-Messenger Wiki
API is currently in BETA
1) API is usable through simple HTTP requests, thus it will be accessible for any web and SL developer
2) Requests will be made through POST (currently for debugging it is using GET)
3) Some publicly available data will not require providing login/pass (like info of an avatar status, last visited sim name, sending messages)
4) Obtaining private data through API will require using login and password
5) api.php is the main PHP to access the api functions
6) api.php?func=function is called to execute a function
7) By default results are returned as CSV string if not stated otherwise. This behaviour could be overriden by mode parameter (supported: XML, JSON, CSV)
@param func - function to be called (see below for function and their definition) @param format - (optional, default: CSV) output format, could be either: CSV, JSON, XML
getpriv
@param login - login name @param password - password @param avatar - name of the avatar @return simname;position;status;n; simname - name of the sim position - <x,y,z> status - online or offline n - number of messages pending
getavnearby
@param login - login name @param password - password @param avatar - name of the avatar @return avname;avkey;
avatar
@param avatar - name of the avatar @return status;simname;position; status - online or offline simname - name of the sim position - <x,y,z>
send
@param avatar - name of the avatar @param from - name to show as who sent the message @param msg - message body @param login - (optional) login name @param password - (optional) password @return either SNT if successful or ERR otherwise
getmsg
@param login @param password @param avatar @param msgid - (optional) id of the message @return gets next pending message if the msgid is not passed, otherwise returns the message with id = msgid (id is local to an avatar and increments by 1 and is equal of count on the rows with messages to the avatar) - if msgid is passed and there is no such message an empty string is returned
getfriends
@param login @param password @para avatar @params start - (optional) start from x friend on the list (useful for paging the results or for use with LSL) @params stop - (optional) stop on the x friend on the list (useful for paging the results or for use with LSL) @return avname;status;sim;position; avname - name of the avatar status - online or offline sim - sim name position - <x,y,z> if the last element on the list divided by ';' will be #NXT# it means that there are more results (only when start and stop is used)
getfriendsonline
@param login @param password @param avatar @params start - (optional) start from x friend on the list (useful for paging the results or for use with LSL) @params stop - (optional) stop on the x friend on the list (useful for paging the results or for use with LSL) @return avname;sim;position; avname - name of the avatar sim - sim name position - <x,y,z> if the last element on the list divided by ';' will be #NXT# it means that there are more results (only when start and stop is used)
badge
Generate and return a badge
@param avatar - avatar name
@param template - a template for the badge
@return html containing the dynamically generated badge
The template is a normal HTML. There are few tags that will be replaced by dynamically generated content.
If you wish to be able for your template to switch between 'badge' and 'messageBox' you have to have two divs, one with ID=badge the other one with ID=messageBox.
Please note: avoid using " and ' inside the templates. They will work without them (ie instead of id="badge" write id=badge).
tags:
{avimg} - image of the avatar (img class: 'avimg')
{avname} - name of the avatar
{sim} - sim the avatar was last in
{status} - online status of the avatar (div class: 'online' or 'offline')
{lastseen} - when the avatar was last seen
{teleport} - teleport link to the last location (a class: 'teleport')
{sendfrom} - input text field for the 'From' (input class: 'from')
{sendmsg} - input text field for the 'Message' (input class: 'msg')
{sendbutton} - input button for sending the message, pressing this button will send the message, and try to hide the messageBox and show the badge (input class: 'sendButton')
{sendbox) - a link triggering the swap between the badge and the messageBox - it hides the badge div and shows the messageBox div
example: http://sl-messenger.com/beta/api.php?func=badge&avatar=Kri%20Ayakashi&template=< html>< head>< style type=text/css>div.messageBox{background-color: black; color: white; height: 90px; width: 400px;} img.avimg{height:90px;width:70px;float:left;} div.badge{height:100px; width: 400px; background-color: BBE0F5; color: black; padding: 5px; font-size: 125%; font-weight: bold; font-family: monospace;} div.online{font-weight: bolder; color: green;} div.offline{font-weight: bolder; color: red}</style></head><body>< div id=badge class=badge >{avimg}{avname} is currently {status} and was last seen at {sim} {teleport} there. {sendbox}< /div>< div id=messageBox class=messageBox>From{sendfrom}< br/>Message {sendmsg}< br/>{sendbutton}< /div></body></html>
To be imblemented
getavpict
@param avatar @return jpeg file stream
