From SmartBots Developers Docs
Jump to: navigation, search

HTTP API allows controlling your Second Life bot using HTTP queries. The query can be send from SL object (LSL script), website code or your application.

The basics

Basically the API usage consists of the following steps:

  1. Compose the query and send it (using llHTTPRequest in case of LSL)
  2. Wait for the SmartBots reply (using http_response in case of LSL)
  3. Decode the reply.

Each SmartBots bot comes with HTTP API enabled. You just need to grab the bot's access code (it is a kind of password for bot's API) and your unique Developer's API key.

API Testing Suite

There's a special page to compose and test HTTP API queries:


Raw code

string params = llDumpList2String([
  "action="  + "get_balance",

  "apikey="  + llEscapeURL(sbApiKey),
  "botname=" + llEscapeURL(sbBotName),
  "secret="  + llEscapeURL(sbBotAccessCode)
], "&");

 [HTTP_METHOD,"POST"], params);

Read Doing HTTP API Calls for more info.

Helper functions

We've written few helper functions to make HTTP API usage easier:

smartbotsAPI("status", []);

Check LSL Helper Functions for more info on helpers.

More examples

Check HTTP API examples to see how HTTP API works in LSL.