Skip to content
Gwyneth Llewelyn edited this page Jan 15, 2022 · 24 revisions

Introduction

The original instructions are minimalistic, they just deal with establishing a connection and exiting a bot.

Except for establishing a connection, the original REST API is as follows:

Call http://your-host-where-RESTbot-lives.com:9080/<command_name>/<session_id>

while on the POST data, you put the actual parameters.

Establishing a connection will give you the <session_id>

Establishing a Connection

using cURL:

curl http://localhost:9080/establish_session/<RESTbot password> -d first=<BotFirstName> -d last=<BotLastName> -d pass=<md5'ed bot password>

RESTbot password: the default is simply pass. You can (and should!) change it on configuration.xml.

The avatar password is another story. Under OpenSimulator, you can get away with your own generated MD5'ed password; the underlying libraries will add the "$1$" prefix (that properly identifies MD5 encoding as, well, MD5 encoding) and it works fine. Second Life, however, mumbles and grumbles and ultimately refuses to use your MD5'd password. Why that happens is completely beyond my knowledge and understanding.

However, LibreMetaverse has added a neat feature — if a password is passed in plaintext (i.e. not MD5-encoded), then it will go through all proper steps to ensure that the Second Life Grid gets a properly MD5'd password that SL accepts. Weird, but it certainly works! So, if you are unable to login to SL with your MD5'd password, try to use your non-encoded password instead. A safety issue? Sure, if you connect via http and not https to your RESTbot instance. The truth is that MD5 is easily breakable anyway, so encoding a password with MD5 and passing it unencrypted is not really safe these days (it might have been the case in 2003, but today it's reasonably easy to crack.

If successful, this call will return a session identification key:

<restbot><success><session_id>5defa00c-1590-410b-a9e1-98066abd5ae4</session_id></success></restbot>

If the wrong username or password was sent, you'll get (for Second Life):

<restbot>
    <error fatal="true">Sorry! We couldn't log you in.

Please check to make sure you entered the right

    * Username (like bobsmith12 or steller.sunshine)

    * Password

Also, please make sure your Caps Lock key is off. If you feel this is an error, please contact support@secondlife.com.</error>
</restbot>

(of course, Linden Lab may change the message at any time)

Other errors preventing the session to be instantiated might be possible (not tested as of 20220111!).

Exiting

curl http://localhost:9080/exit/<session_id>

where session_id is the session identification key received on the previous call.

Returns:

<restbot><disposed>true</disposed></restbot>

Avatar Plugin

avatar_name

Parameters: key

curl http://localhost:9080/avatar_key/<session_id>/ -d key=d2cdf457-5027-4887-abd8-573c62a85226

Returns:

<restbot><name>Gwyneth Llewelyn</name></restbot>

avatar_key

Parameters: name

curl http://localhost:9080/avatar_key/<session_id>/ -d name=Gwyneth%20Llewelyn

Returns:

<restbot><key>d2cdf457-5027-4887-abd8-573c62a85226</key></restbot>

avatar_online

Parameters: key

curl http://localhost:9080/avatar_online/<session_id>/ -d key=d2cdf457-5027-4887-abd8-573c62a85226

Returns:

<restbot><online>False</online></restbot>

avatar_profile

Parameters: key

curl http://localhost:9080/avatar_profile/<session_id>/ -d key=d2cdf457-5027-4887-abd8-573c62a85226

Returns:

True

***

In RL I work for Beta Technologies: [https://betatechnologies.info](https://betatechnologies.info/)

What should I say more? I'm 40 and in a stable relationship, currently living in Portugal, at Europe's westernmost tip. 0488b909-b5d7-dd58-fe96-600a801d6c6f 00000000-0000-0000-0000-000000000000 7/31/2004 I'm accused by immersionists of being an augmentist; and augmentists believe I'm an immersionist. But I'm really just a virtual girl in a virtual world, enjoying this space just like you :)

Second Life mirrors the real life. The good and the bad of it.

Email me at gwyneth.llewelyn@gwynethllewelyn.net

... and in real life, I'm the European Operations Manager for Beta Technologies.

Joaz Janus: A rose by any other name would render so slowly

Distorted image? Well, I'm using a viewer that likes it! Resident 71416a9e-25a2-6e95-f96f-31bfb88ea7bc False True True http://gwynethllewelyn.net/

avatar_groups

Parameters: key

curl http://localhost:9080/avatar_groups/<session_id>/ -d key=d2cdf457-5027-4887-abd8-573c62a85226

Returns:

<restbot>
    <groups>
        <group>
            <name>Fashion Consolidated</name>
            <key>0726f59a-ca0c-9e73-7c1e-075c5242eb5b</key>
            <title>FashConnoisseur</title>
            <notices>True</notices>
            <powers>SendNotices, ReceiveNotices, VoteOnProposal</powers>
            <insignia>349d1efa-176d-9995-a3f2-ffd4f61cc0e3</insignia>
        </group>
        <group>
            <name>Neufreistadt</name>
            <key>1436766e-2212-1062-fe69-f43b0095c890</key>
            <title>Neufreistadter</title>
            <notices>True</notices>
            <powers>18446744073709551615</powers>
            <insignia>31c58113-f7e7-f282-acf8-6265acab8285</insignia>
        </group>
        <group>
        ...
        </group>
    </groups>
</restbot>

Reaper Plugin

This plugin, originally developed by Pleiades and not documented, attempts to clean up stalled sessions every hour. I'm not even sure if it is 'always running' in the background or not.

reaper_info

Function unknown. Seems to have no parameters. My guess is that it shows if the Reaper process is running or not.

Stats Plugin

dilation

curl http://localhost:9080/dilation/<session_id>

Returns:

<restbot><dilation>0,9987054</dilation></restbot>

where the value is the current sim's dilation.

sim_stat

curl http://localhost:9080/sim_stat/<session_id>

Returns:

0,9964779 459 210 0 0 0 45 44,90754 2 82 2 2 0 20 0 31 29 0 0 0 0 0 106 22,24652 0,009069572 0,2268104
0,1629531
0,1085776

New Functionality

The commands below are new and manually added.

Groups Plugin

group_key_activate

Used to set the avatar to an active group, using the group UUID. Returns active group and, in parenthesis, the group's role that is shown on the title.

Can be set to NULL key (00000000-0000-0000-0000-000000000000) to unset group.

curl http://localhost:9080/group_key_activate/<session_id> -d key=150829ee-a295-4ef6-3965-9f5c77ac3b52

Returns:

<restbot><active>Beta Technologies (Beta Technologies)</active></restbot>

group_name_activate

Used to set the avatar to an active group, using the group name. Returns active group and, in parenthesis, the group's role that is shown on the title.

curl http://localhost:9080/group_name_activate/<session_id> -d name=Beta%20Technologies

Returns:

<restbot><active>Beta Technologies (Beta Technologies)</active></restbot>

group_im

Sends messages in Group IM Chat (on any group the 'bot has joined). Returns just if the message was sent or not.

Parameters are the UUID key for the group and a text message (urlencoded)

curl http://localhost:9080/group_im/<session_id> -d key=<group UUID> -d message="This%20is%20a%20test"

Returns:

<restbot><message>message sent</message></restbot>

Inventory Plugin

list_inventory

Returns the whole inventory of this avatar. With an empty key, it starts from the root folder; add a folder key to just list that folder instead.

Parameters: key for the folder where it should start

curl http://localhost:9080/list_inventory/<session_id> -d key=<folder UUID>

Returns:

<restbot>
    <inventory>
        <item>
            <name>...</name>
            <itemid>...</itemid>
        </item>
        ...
    </inventory>
</restbot>

list_item

Returns information from a single item in the inventory of this avatar.

Parameters: key for the item ID

curl http://localhost:9080/list_item/<session_id> -d key=<item ID>

Returns:

<restbot>
    <item>
        <AssetUUID>251ff15a-25c5-ebd7-ea13-c45e4e520f23</AssetUUID>
        <PermissionsOwner>---</PermissionsOwner>
        <PermissionsGroup>---</PermissionsGroup>
        <AssetType>Texture</AssetType>
        <InventoryType>Texture</InventoryType>
        <CreatorID>d2cdf457-5027-4887-abd8-573c62a85226</CreatorID>
        <Description>(No Description)</Description>
        <GroupID>00000000-0000-0000-0000-000000000000</GroupID>
        <GroupOwned>False</GroupOwned>
        <SalePrice>10</SalePrice>
        <SaleType>Not</SaleType>
        <Flags>0</Flags>
        <CreationDate>19-06-2009 18:20:35</CreationDate>
        <LastOwnerID>00000000-0000-0000-0000-000000000000</LastOwnerID>
    </item>
</restbot>

give_item

Transfers a single item from the inventory of this avatar to another avatar.

Parameters:

  • itemID for the item ID to give
  • avatarKey for the recipient's avatar UIID
curl http://localhost:9080/list_item/<session_id> -d itemID=<item ID> -d avatarKey=<avatar UUID>

Returns:

<restbot>
    <item>
        <name>BetaTech_OV_RGB</name>
        <assetType>Texture</assetType>
        <itemID>6e89002b-6788-ecc5-c314-95f795b08cd8</itemID>
        <avatarKey>d2cdf457-5027-4887-abd8-573c62a85226</avatarKey>
    </item>
</restbot>

create_notecard

Creates a notecard on the 'bot's inventory with name, text, and optionally an attachment (for some reasons the attachment seems to be broken)

Parameters:

  • name (name for the notecard; if empty, a default name will be selected)
  • notecard (text for the notecard's content; not tested with UTF-8 and special formatting yet)
  • key (itemID for the attachment)
curl http://localhost:9080/create_notecard/<session_id> -d name=<string> -d notecard=<string> -d key=<item UUID>

Returns:

<restbot>
    <notecard>
        <ItemID>f2890f40-44ba-d123-0709-ec73ca42f237</ItemID>
        <AssetID>093dea8c-8231-8515-decc-0f13ee0abada</AssetID>
        <name>Notecard name</name>
    </notecard>
</restbot>

Movement Plugin

location

Shows the current region name, the IP and port addresses of that region, and the actual position of the 'bot inside it.

Parameters: none

curl http://localhost:9080/location/<session_id>

Returns:

<restbot>
    <location>
        <CurrentSim>Beta Technologies (216.82.45.92:13000)</CurrentSim>
        <Position>103.0242,211.2815,30.03234</Position>
    </location>
</restbot>

goto

Teleports 'bot to a specific simulator and a position (x,y,z) inside that sim. Position coordinates are floats.

Parameters:

  • sim for the simulator name (spaces should work fine if properly quoted)
  • x, y, z Position inside the simulator to teleport to
curl http://localhost:9080/goto/<session_id> -d sim=<string> -d x=<float> -d y=<float> -d z=<float>

Returns:

<restbot><teleport>Beta Technologies</teleport></restbot>

Prims Plugin

Contributed by @otakup0pe

nearby_prims

Gets a list of primitives in the neighbourhood of the 'bot, in a certain radius.

Parameters:

  • type (it will do a partial search on the prim name; leave empty to retrieve all prims; it's case-sensitive)
  • radius (in meters around the avatar)
curl http://localhost:9080/nearby_prims/<session_id> -d type=<string> -d radius=<float>

Returns:

<restbot>
    <nearby_prims>
        <prim>
            <name>{0}</name>
            <pos>{1},{2},{3}</pos>
        </prim>
    </nearby_prims>
</restbot>