Difference between revisions of "Nexus Pager System/API"

From Nexus
Jump to: navigation, search
(Created page with "← Nexus Pager System {|align=right |__TOC__ |} = '''<span style="color:#4D5A93">API Documentation</span>''' = :The API Documentation is only relevant ...")
(No difference)

Revision as of 21:37, 19 May 2015

← Nexus Pager System

API Documentation

The API Documentation is only relevant to version number 3.0.0. Anything older than that will not work on this page.
This API is a transmit only API. Until we find a way to effectively send messages to a user with the API, we will not be displaying our receive API.
To use this API, you must have some knowledge of Linden Script Language and Linked Messages
Want to know what an API is? Look here on Wikipedia.
To navigate this wiki better, please use the navigation on the right side of the screen.

API Features


  • Transmitting Messages
  • Receiving Messages

How to make an API Call


Before you are to start messing with this, you must have knowledge of how Linden Scripting Language works. If you can't script, then this guide will be worthless to you.
Currently, there is only one way to make an API call. You are required to use our helper script that is supplied in the box when purchased. You can also obtain this script at the vendor in world.
If you are going to use Linked Messages you must either get the script from our In World Store or from your Product Box.

Setting Everything Up


Time to start setting things up!
Follow these steps and you should have a perfect prim that will be able to send out messages to anything.
  1. Create a prim and add the API Script.
  2. Edit the Computer Terminal and copy the computer's description.
  3. Paste that description into the prim where you have the API Script.
  4. Create a new script and paste the following.
integer TRANSMIT_PAGER      = 21001;
integer TRANSMIT_SPEAKER    = 21002;
integer TRANSMIT_ALL        = 21003;

string JSON;

default {
    touch_start(integer total_number) {
        if(llDetectedKey(0) == llGetOwner()) {
            JSON = llJsonSetValue(JSON,["channel"],"CHANGE ME"); //Change the name of this channel to something you have in your own network.
            JSON = llJsonSetValue(JSON,["message"],"Hello World!");
            llMessageLinked(LINK_THIS,TRANSMIT_PAGER,JSON,NULL_KEY);
        }
    }
    link_message(integer sender_number, integer num, string value, key id) {
        if(value == JSON) return;
        llOwnerSay(llJsonGetValue(value,["success"]));
    }
}
All Done! Once you have all those items in the prim, everything should be working. All you need to do now is to change the name of the channel to a channel in your own network.

Transmitting Messages

One of the major functions that this API will allow you to do is to transmit messages to other users who have pagers or speakers.

Information required for API call

  • Channel
  • Message
You can find the channel by going to your channels in your computer terminal and selecting Channels Then List.
You must use the Channel Names exactly the way you added them to the database.

Sending a Transmission

Sending a transmission is very simple once you have the hang of it.

Example Responses

When you acquired an error because you did not supply an error, this is the response.
All errors will show up as the "Error" Key in the JSON value.
{
    "error" : "Please supply the name of the channel you would like to send a message on."
}
Send that message and have it be a success? Here is the response.
{
    "success" : "Message has been successfully sent!"
}