Difference between revisions of "HTTP API/Bot Commands/avatar picks"
Line 47: | Line 47: | ||
<syntaxhighlight lang="http"> | <syntaxhighlight lang="http"> | ||
− | + | https://www.mysmartbots.com/api/bot.html?action=avatar_picks&avatar=cd93067e-7c4e-41c0-ba91-be01f4bafe35&... | |
</syntaxhighlight> | </syntaxhighlight> | ||
Line 59: | Line 59: | ||
<syntaxhighlight lang="http"> | <syntaxhighlight lang="http"> | ||
− | + | https://www.mysmartbots.com/api/bot.html?action=avatar_picks&avatar=cd93067e-7c4e-41c0-ba91-be01f4bafe35&matchnames=earn2life&... | |
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 14:09, 7 September 2017
Returns a list of a resident's picks.
Variables
The following table shows input values (you send them with the API call) and returned output values.
Variable | Required | Description | ||
---|---|---|---|---|
This API command applies only for Standard bot | ||||
Input basic parameters: | ||||
action | yes | = avatar_picks | ||
apikey | yes | Your personal developer's API key. | ||
botname | yes | Your bot's SL login. | ||
secret | yes | Bot access code of your bot. | ||
dataType | optional | Set to "json" to get JSON reply instead of URL-encoded string | ||
custom | optional | The custom data (string) to be passed back to caller script. This value will be returned back to the caller in HTTP response. | ||
Input: | ||||
avatar | Avatar UUID to fetch picks for | |||
skipnames | Skip pick (do not return) if its name contains this substring (case insensitive) | |||
matchnames | Return only picks which names contain this substring (case insensitive) | |||
matchuuid | Return pick with this parcel UUID only | |||
Output: | ||||
(to be received in http_response LSL event, see docs for details) | ||||
result | OK - command completed successfully FAIL - command failed | |||
resulttext | Detailed reason for the failure. | |||
custom | The value from input "custom" parameter. See above. | |||
total | The total number of picks (regardless of any filters, see below). | |||
picks | The list of resident's picks: parcel UUIDs and names.
This list may be affected by skip* and match* parameters. See the "Return value" section below. |
Working with large lists
LSL llHttpRequest() function has a limitation on reply size (it is being cut to 2048 bytes, or 1024 Unicode characters). If the resident has a lot of picks, they may not fit into the http reply.
There are several solutions for this problem. Use the following parameters:
- skipnames - ignore picks which names contain this substring
- matchnames - list only picks which names contain a specific substring
- matchuuid - return specific pick by parcel UUID
Return value
total - variable contains the total number of resident's picks. It is not affected by skip* or match* parameters.
picks - the list of picks (probably filtered by skip* and match*): a string which contains the parcel UUIDs and pick names separated by newline ("\n"):
Parcel-UUID-1 name-of-the-pick-1 Parcel-UUID-2 name-of-the-pick-2 ...
Examples
Example request to get the resident's picks:
https://www.mysmartbots.com/api/bot.html?action=avatar_picks&avatar=cd93067e-7c4e-41c0-ba91-be01f4bafe35&...
A response from the bot:
07300856-2d89-754e-dfb2-dd73553d76dc Earn2Life.com Discount Shop ff1dd581-7eea-8b1f-68f5-eab19046571d Earn2Life.com: Free Lindens & Jobs! 9e1c606a-c69c-5af0-cc35-017854b8ec12 SLBiz2Life Advertising: advertise here!
The same request, groups filtered by name (only those which contain "earn2life"):
https://www.mysmartbots.com/api/bot.html?action=avatar_picks&avatar=cd93067e-7c4e-41c0-ba91-be01f4bafe35&matchnames=earn2life&...
Response from the bot:
07300856-2d89-754e-dfb2-dd73553d76dc Earn2Life.com Discount Shop ff1dd581-7eea-8b1f-68f5-eab19046571d Earn2Life.com: Free Lindens & Jobs!
<< return back to Bot commands
(Miss an API call or parameter? Submit your request in forum)