Difference between revisions of "HTTP API"

From SmartBots Developers Docs
Jump to: navigation, search
Line 8: Line 8:
 
# Wait for the SmartBots reply (using '''http_response''' in case of LSL)
 
# Wait for the SmartBots reply (using '''http_response''' in case of LSL)
 
# Decode the reply.
 
# Decode the reply.
 
=== Helper functions ===
 
 
We've written few helper functions to make HTTP API usage easier:
 
 
<syntaxhighlight lang="lsl">
 
smartbotsAPI("status", []);
 
</syntaxhighlight>
 
 
Check [[HTTP API/LSL Helper Functions|LSL Helper Functions]] for more info on helpers.
 
  
 
== API Testing Suite ==
 
== API Testing Suite ==
Line 24: Line 14:
  
  
== Examples ==
+
== Usage ==
  
 
=== Raw code ===
 
=== Raw code ===
Line 43: Line 33:
 
Read [[HTTP_API/Doing_HTTP_API_Calls|Doing HTTP API Calls]] for more info.
 
Read [[HTTP_API/Doing_HTTP_API_Calls|Doing HTTP API Calls]] for more info.
  
 +
 +
=== Helper functions ===
 +
 +
We've written few helper functions to make HTTP API usage easier:
 +
 +
<syntaxhighlight lang="lsl">
 +
smartbotsAPI("status", []);
 +
</syntaxhighlight>
 +
 +
Check [[HTTP API/LSL Helper Functions|LSL Helper Functions]] for more info on helpers.
  
 
=== More examples ===
 
=== More examples ===

Revision as of 15:43, 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.

API Testing Suite

There's a special page to compose and test HTTP API queries: https://www.mysmartbots.com/api/testing.html


Usage

Raw code

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.


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.