Template:API HTTP Example Boilerplate

From SmartBots Developers Docs
Revision as of 21:42, 2 May 2017 by Gg (Talk | contribs) (Created page with "<syntaxhighlight lang="lsl"> smartbotsAPI(string command, list params) { // You need to adjust the vars below: string sbApiKey = "..."; string sbBotName = "..."; strin...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
smartbotsAPI(string command, list params) {
  // You need to adjust the vars below:
  string sbApiKey = "...";
  string sbBotName = "...";
  string sbBotAccessCode = "...";

  // Populate the query data
  params += [
    "action="  + command,
    "apikey="  + llEscapeURL(sbApiKey),
    "botname=" + llEscapeURL(sbBotName),
    "secret="  + llEscapeURL(sbBotAccessCode)
  ];

  string query = llDumpList2String(params, "&");
 
  llHTTPRequest("http://api.mysmartbots.com/api/bot.html",
    [HTTP_METHOD,"POST"], query);
}