name2key
Returns an avatar’s UUID by their Second Life name.
// See "LSL Helper Functions" page for this function
smartbotsAPI("name2key", [
"name", "BarKeeeper",
"request_case", 1
]);Variables
The following table shows input values (you send them with the API call) and returned output values.
This API command applies only for Standard bots.
Input basic parameters
Variable | Required | Description |
|---|---|---|
action | yes | = name2key |
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
Variable | Required | Description |
|---|---|---|
name | yes | The Second Life name of the avatar |
request_case | optional | Set to |
Output
(To be received in *http_response* LSL event, see docs for details)
Variable | Description |
|---|---|
result | OK - command completed successfully |
resulttext | Detailed reason for the failure |
custom | The value from input "custom" parameter. See above |
key | Avatar’s UUID |
name | Second Life name you’ve sent |
normalname | Second Life name, normalized (see Return value) |
Return value
The command returns an avatar’s UUID by searching its Second Life name.
It provides two name fields:
name— the exact name as you sent itnormalname— the “normalized” name (the system adds “Resident” if necessary)
Name case
Second Life ignores name case (e.g., glaznah gassner equals Glaznah GASSner),
so normalname may appear in lowercase.
If you want the exact name case from Second Life servers, set request_case to 1.
Examples
1. Requesting the avatar UUID by Second Life name:
https://www.mysmartbots.com/api/bot.html?action=name2key&name=barKeeeper&...Result:
name = barKeeeper
normalname = barkeeeper resident
key = 76e96174-ddcf-482f-86aa-c9394664082fOr, with request_case=1:
name = barKeeeper
normalname = BarKeeeper Resident
key = 76e96174-ddcf-482f-86aa-c9394664082f2. Looking for a nonexistent avatar:
https://www.mysmartbots.com/api/bot.html?action=name2key&name=ThisAvatarNotExists&...Result:
result = FAIL
resulttext = name lookup failed, ThisAvatarNotExists Resident
normalname = ThisAvatarNotExists Resident
name = ThisAvatarNotExists