Difference between revisions of "Simple Groups API/Calling"
(Created page with "Simple Group HTTP API (or Simple HTTP) has been created to easily invoke the basic group commands such as invite or eject. Unlike HTTP API: Bot Commands, Simple API does...") |
|||
(8 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{DISPLAYTITLE: Calling Simple HTTP API}} | ||
+ | |||
Simple Group HTTP API (or Simple HTTP) has been created to easily invoke the basic group commands such as invite or eject. | Simple Group HTTP API (or Simple HTTP) has been created to easily invoke the basic group commands such as invite or eject. | ||
− | Unlike [[HTTP API | + | Unlike the full-scale [[HTTP API]], Simple Groups API does not require the knowledge UUIDs. It also returns the reply in simple plain form (see below). |
To invoke Simple Group HTTP API command, call the following URL with required parameters: | To invoke Simple Group HTTP API command, call the following URL with required parameters: | ||
<syntaxhighlight lang="http"> | <syntaxhighlight lang="http"> | ||
− | + | https://api.mysmartbots.com/api/simple.html | |
</syntaxhighlight> | </syntaxhighlight> | ||
Line 13: | Line 15: | ||
== Passing parameters to API URL == | == Passing parameters to API URL == | ||
− | Imagine you need to call [[invite | + | Imagine you need to call [[HTTP_API/Simple_Groups/invite|invite]] command to invite someone to your group. |
− | # Take the Bot API URL: | + | # Take the Bot API URL: https://api.mysmartbots.com/api/simple.html |
# Add required parameters | # Add required parameters | ||
# Get the response | # Get the response | ||
Line 21: | Line 23: | ||
The resulting query looks like this: | The resulting query looks like this: | ||
− | <syntaxhighlight> | + | <syntaxhighlight lang="lsl"> |
string params = llDumpList2String([ | string params = llDumpList2String([ | ||
"action=" + "invite", | "action=" + "invite", | ||
Line 33: | Line 35: | ||
llHTTPRequest( | llHTTPRequest( | ||
− | " | + | "https://api.mysmartbots.com/api/simple.html", |
[HTTP_METHOD,"POST"], | [HTTP_METHOD,"POST"], | ||
params | params | ||
Line 50: | Line 52: | ||
== Testing == | == Testing == | ||
− | You can compose and test your queries using SmartBots API Testing Suite: | + | You can compose and test your queries using SmartBots API Testing Suite: https://www.mysmartbots.com/api/testing.html |
Line 56: | Line 58: | ||
== See also == | == See also == | ||
− | Refer to [[ | + | Refer to [[Simple Groups API]] page for information on API commands available. |
+ | {{NavMenu}} | ||
__NOTOC__ | __NOTOC__ |
Latest revision as of 15:17, 14 October 2019
Simple Group HTTP API (or Simple HTTP) has been created to easily invoke the basic group commands such as invite or eject.
Unlike the full-scale HTTP API, Simple Groups API does not require the knowledge UUIDs. It also returns the reply in simple plain form (see below).
To invoke Simple Group HTTP API command, call the following URL with required parameters:
https://api.mysmartbots.com/api/simple.html
The request can be either GET or POST. The returned value format is described down below.
Passing parameters to API URL
Imagine you need to call invite command to invite someone to your group.
- Take the Bot API URL: https://api.mysmartbots.com/api/simple.html
- Add required parameters
- Get the response
The resulting query looks like this:
string params = llDumpList2String([
"action=" + "invite",
"apikey=" + llEscapeURL(yourApiKey),
"secret=" + llEscapeURL(groupSecretCode),
"group=" + llEscapeURL("My Group Name"),
"slkey=" + (string)llDetectedKey(0),
"force=" + "1",
"message=" + llEscapeURL("Welcome!")],
"&");
llHTTPRequest(
"https://api.mysmartbots.com/api/simple.html",
[HTTP_METHOD,"POST"],
params
);
Important notices
- The group you are trying to use have to be listed in SmartBots account!
- You may use groups with shared bot or personal bots.
Parsing HTTP Reply
Simple HTTP API returns the reply as a plain string. Thus, you just need to check if reply equals to "OK". Any other reply means that something wrong, e.g. "ACCESS DENIED" means wrong security code.
Testing
You can compose and test your queries using SmartBots API Testing Suite: https://www.mysmartbots.com/api/testing.html
See also
Refer to Simple Groups API page for information on API commands available.