Difference between revisions of "HTTP API"

From SmartBots Developers Docs
Jump to: navigation, search
Line 1: Line 1:
HTTP API allows controlling SL groups and Second Life bots using HTTP queries. The query can be send from SL object (LSL script) or online:
+
HTTP API allows controlling SL groups and Second Life bots using HTTP queries. The query can be send from SL object (LSL script), website code or your application.
 +
 
 +
== The basics ==
 +
 
 +
Basically the whole process consists of the following steps:
 +
 
 +
# Compose the query and send it (using '''llHTTPRequest''' in case of LSL)
 +
# Wait for the SmartBots reply (using '''http_response''' in case of LSL)
 +
# Decode the reply.
  
 
<syntaxhighlight lang="lsl">
 
<syntaxhighlight lang="lsl">
Line 14: Line 22:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Check [[HTTP_API/Examples|HTTP API examples]] to see how to control your bot from LSL.
+
Read [[HTTP_API/Doing_HTTP_API_Calls|Doing HTTP API Calls]] for more info.
  
== The basics ==
 
  
Basically the whole process consists of the following steps:
+
== Examples ==
  
# Compose the query string and send it using '''llHTTPRequest''' (either GET or POST).
+
Check [[HTTP_API/Examples|HTTP API examples]] to see how HTTP API works in LSL.
# Pickup the SmartBots reply using '''http_response'''.
+
# Decode the reply.
+
  
Read [[HTTP_API/Doing_HTTP_API_Calls|Doing HTTP API Calls]] for more info.
 
  
 
{{NavMenu}}
 
{{NavMenu}}

Revision as of 15:36, 14 October 2019

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

The basics

Basically the whole process 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.
string params = llDumpList2String([
  "action="  + "get_balance",

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

llHTTPRequest("https://api.mysmartbots.com/api/bot.html",
 [HTTP_METHOD,"POST"], params);

Read Doing HTTP API Calls for more info.


Examples

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