Difference between revisions of "Linden Lab Official:Registration API Reference"

From Second Life Wiki
Jump to navigation Jump to search
m (Updated top bound of start_local_z)
(Registration API 2.1 update)
Line 120: Line 120:
* username  
* username  
* last_name_id  
* last_name_id  
* email 
* dob
* password


In addition, you can include any of the optional parameters listed in the table below.
In addition, you can include any of the optional parameters listed in the table below.


If successful, the Reg API will return a hash containing the new user's agent_id. If there are errors, the Reg API will instead return an array containing the applicable error codes will be returned.
If successful, the Reg API will return a hash containing the new user's agent_id and a url to redirect the user to where they can finalize the new account. If there are errors, the Reg API will instead return an array containing the applicable error codes.


=== Parameters===
=== Parameters===
Line 132: Line 129:
{| {{Prettytable}}
{| {{Prettytable}}
|-{{Hl2}}
|-{{Hl2}}
!Setting !!  Data type !! Description !! Default Value
!Setting !!  Data type !! Description !! Required !! Default Value


|---
|---
Line 138: Line 135:
| String
| String
| Desired user name (Second Life first name). Must be between 2-31 alphanumeric characters.  Certain first names are restricted; for example, those considered obscene or inappropriate for public use.
| Desired user name (Second Life first name). Must be between 2-31 alphanumeric characters.  Certain first names are restricted; for example, those considered obscene or inappropriate for public use.
| Required parameter.
| Yes
| -


|---
|---
Line 144: Line 142:
| Integer
| Integer
| ID of desired Second Life last name.   
| ID of desired Second Life last name.   
| Required parameter.
| Yes
 
| -
|---
| email
| String
| User's email address.
| Required parameter.
 
|---
| password
| String
| Desired password. Must be between 6-16 characters. 
| Required parameter.
 
|---
| dob
| String
| User's date of birth in the YYYY-MM-DD format. Users under 18 cannot be registered to the mainland.  See limited_to_estate. 
| Required parameter.


|---
|---
Line 168: Line 149:
| limited_to_estate
| limited_to_estate
| Integer
| Integer
| ID of estate that the user will be limited to.  To change this to another estate, you must own the estate. Optional parameter.
| ID of estate that the user will be limited to.  To change this to another estate, you must own the estate.
| No
| Estate 1, the mainland.
| Estate 1, the mainland.


Line 174: Line 156:
| start_region_name  
| start_region_name  
| String
| String
| Region where user will initially appear after login. This can only be set to simulators in the user's limited to estate.  Optional parameter.
| Region where user will initially appear after login. This can only be set to simulators in the user's limited to estate.   
| No
| Orientation island of the estate.  
| Orientation island of the estate.  


Line 181: Line 164:
| Real
| Real
| X coordinate of the starting region. Must be between 0-256.  Value must have two decimal places, for example: 123.00.   
| X coordinate of the starting region. Must be between 0-256.  Value must have two decimal places, for example: 123.00.   
Optional parameter; valid only when start_region_name is set. 
| No
| 128 (center).
| 128 (center).


Line 188: Line 171:
| Real
| Real
| Y coordinate of the starting region.  Must be between 0-256. Value must have two decimal places, for example: 123.00.
| Y coordinate of the starting region.  Must be between 0-256. Value must have two decimal places, for example: 123.00.
Optional parameter; valid only when start_region_name is set.
| No
| 128 (center).  
| 128 (center).  


Line 195: Line 178:
| Real
| Real
| Z coordinate of the starting region.  Must be between 0-4000.  Value must have two decimal places, for example: 123.00.
| Z coordinate of the starting region.  Must be between 0-4000.  Value must have two decimal places, for example: 123.00.
Optional parameter; valid only when start_region_name is set.  
| No  
| 128 (center).  
| 128 (center).  


Line 202: Line 185:
| Real
| Real
| X component of the unit vector representing initial look direction. Must be between -1 and 1.   
| X component of the unit vector representing initial look direction. Must be between -1 and 1.   
Optional parameter; valid only when start_region_name is set. 
| No
| 0
| 0


Line 209: Line 192:
| Real
| Real
| Y component of the unit vector representing initial look direction. Must be between -1 and 1.   
| Y component of the unit vector representing initial look direction. Must be between -1 and 1.   
Optional parameter; valid only when start_region_name is set.
| No
| 1
| 1


Line 216: Line 199:
| Real
| Real
| Z component of the unit vector representing initial look direction. Must be between -1 and 1.   
| Z component of the unit vector representing initial look direction. Must be between -1 and 1.   
Optional parameter; valid only when start_region_name is set.
| No
| 0
| 0
|---
| marketing_emails
| Boolean
| Enable marketing emails for the user by default. This will set the initial state for the user, but this value is presented to the user on the activation page as well.
| No
| True
|---
| success_url
| URI
| Page to redirect the user to after the activation page if their activation was successful.
| No
| No redirection.
|---
| error_url
| URI
| Page to redirect the user to after the activation page if their activation was not successful.
| No
| No redirection.


|}
|}
Line 230: Line 234:
   <map>  
   <map>  
       <key>agent_id</key>  
       <key>agent_id</key>  
       <string>''UNIQUE_ID''</string>  
       <string>''UNIQUE_ID''</string>
      <key>complete_reg_url</key>
      <uri>https://accounts.secondlife.com/new-account/''NONCE''</uri>
   </map>  
   </map>  
  </llsd>
  </llsd>


Where ''UNIQUE_ID'' is the new user's unique Second Life ID number.
Where ''UNIQUE_ID'' is the new user's unique Second Life ID number, and ''NONCE'' is a single-use UUID string for account activation.


If the operation is not successful, then it returns an array of error codes similar to that returned by [[#get_error_codes|get_error_codes]].
If the operation is not successful, then it returns an array of error codes similar to that returned by [[#get_error_codes|get_error_codes]].
Line 244: Line 250:
  <llsd>
  <llsd>
   <map>
   <map>
    <key>dob</key><string>1987-07-06</string>
     <key>start_region_name</key><string>da boom</string>
     <key>start_region_name</key><string>da boom</string>
     <key>username</key><string>mistaht</string>
     <key>username</key><string>mistaht</string>
     <key>last_name_id</key><integer>1872</integer>
     <key>last_name_id</key><integer>1872</integer>
    <key>password</key><string>123456</string>
    <key>email</key><string>ben@ben.com</string>
   </map>
   </map>
  </llsd>
  </llsd>
Line 258: Line 261:
   <map>  
   <map>  
       <key>agent_id</key>  
       <key>agent_id</key>  
       <string>87cfdb64-c852-4359-ae16-dce36099ff68</string>  
       <uuid>87cfdb64-c852-4359-ae16-dce36099ff68</uuid>
      <key>complete_reg_url</key>
      <uri>https://accounts.secondlife.com/new_account/13da66b8-8635-4019-a7b4-0582397d8b83/</uri>  
   </map>  
   </map>  
</llsd>
== regenerate_user_nonce ==
'''HTTP method''': POST
The regenerate_user_nonce operation will recreate an activation url for a user, provided the user has not already completed their own activation.
=== Parameters ===
POST the user's "agent_id", and the Reg API returns an LLSD document identical to the original create_user call containing "agent_id" and "complete_reg_url".
{| {{Prettytable}}
|-{{Hl2}}
!Setting !!  Data type !! Description !! Default Value
|---
| agent_id
| UUID
| The agent_id of the created user.
| Required parameter.
|}
=== Example ===
Posted message:
<llsd>
  <map>
      <key>agent_id</key>
      <uuid>87cfdb64-c852-4359-ae16-dce36099ff68</uuid>
  </map>
</llsd>
Reply message:
<llsd>
  <map>
      <key>agent_id</key>
      <uuid>87cfdb64-c852-4359-ae16-dce36099ff68</uuid>
      <key>complete_reg_url</key>
      <uri>https://accounts.secondlife.com/new_account/13da66b8-8635-4019-a7b4-0582397d8b83/</uri>
  </map>
</llsd>
== get_experiences ==
'''HTTP method''': GET
This operation will get a list of experiences you have admin privileges to as a registrar. The keys can be used set up newly-created users with experiences.
=== Example ===
Reply message:
<llsd>
  <map>
    <key>64d4500e-00da-11e6-8174-fa4c4c28149b</key>
    <string>An Experience Name</string>
    <key>8bba1a36-05a4-11e6-a370-fa4c4c046a71</key>
    <string>Another experience name</string>
  <map>
</llsd>
== set_user_experience ==
'''HTTP method''': POST
The set_user_experience operation will attempt to set an experience for a given user, provided you have admin access to the experience and the user has not already logged in.
=== Parameters ===
POST the user's "agent_id" and the "experience_id" of the experience you wish to set them up with, which can be located using the get_experiences endpoint.
{| {{Prettytable}}
|-{{Hl2}}
!Setting !!  Data type !! Description !! Default Value
|---
| agent_id
| UUID
| The agent_id of the created user.
| Required parameter.
|---
| experience_id
| UUID
| The experience_id of the desired experience.
| Required parameter.
|}
=== Example ===
Posted message:
<llsd>
  <map>
      <key>agent_id</key>
      <uuid>87cfdb64-c852-4359-ae16-dce36099ff68</uuid>
      <key>experience_id</key>
      <uuid>64d4500e-00da-11e6-8174-fa4c4c28149b</uuid>
  </map>
</llsd>
Reply message:
<llsd>
  <boolean>true</boolean>
</llsd>
== get_avatars ==
'''HTTP method''': GET
This operation will get a list of default avatars that can be assigned to newly-created users before they log in for the first time.
=== Example ===
Reply message:
<llsd>
  <map>
  <key>fcac7613-6adf-d701-d71e-5b7703347d81</key>
  <string>Lucy (Mesh)</string>
  ...
  <key>a92276cb-8b32-4066-7364-d726cb0a9e98</key>
  <string>Vampire Tristan (Mesh)</string>
</llsd>
== set_user_avatar ==
'''HTTP method''': POST
The set_user_avatar operation will attempt to set one of a selection of avatars for a given user, provided the user has not already logged in.
=== Parameters ===
POST the user's "agent_id" and the "avatar_id" of the avatar you wish to set them up with, which can be located using the get_avatars endpoint.
{| {{Prettytable}}
|-{{Hl2}}
!Setting !!  Data type !! Description !! Default Value
|---
| agent_id
| UUID
| The agent_id of the created user.
| Required parameter.
|---
| avatar_id
| UUID
| The avatar_id of the desired avatar.
| Required parameter.
|}
=== Example ===
Posted message:
<llsd>
  <map>
      <key>agent_id</key>
      <uuid>87cfdb64-c852-4359-ae16-dce36099ff68</uuid>
      <key>avatar_id</key>
      <uuid>fcac7613-6adf-d701-d71e-5b7703347d81</uuid>
  </map>
</llsd>
Reply message:
<llsd>
  <boolean>true</boolean>
  </llsd>
  </llsd>


Line 280: Line 449:


  <llsd>  
  <llsd>  
     </array>  
     <array>  
         <array>  
         <array>  
             <integer>20</integer>  
             <integer>10</integer>  
             <string>missing required field</string>  
             <string>missing required field</string>  
             <string>You are missing one of the required fields</string>  
             <string>You are missing one of the required fields</string>  
Line 289: Line 458:
         <array>  
         <array>  
             <integer>1500</integer>  
             <integer>1500</integer>  
             <string>malformed xml</string>  
             <string>unhandled exception</string>  
             <string>Your xml is malformed</string>  
             <string>There was an unhandled exception attempting to process this request. Please contact support with the endpoint you were trying to access.</string>  
         </array>  
         </array>  
     </array>  
     </array>  

Revision as of 09:56, 26 October 2016

NOTE: This is an official Second Life API provided and documented by Linden Lab. Its use is subject to the API Terms of Use.

add_to_group

HTTP method: POST

The add_to_group operation adds a new Resident (user) to the specified group.

NOTE: This operation will work for one hour after a user initially registers. After that time, the operation will have no effect for that user.

To use this operation, you must:

  • Receive the "add_to_group" capability before the user registers.
  • Have a role in the group with the ability to add Residents to the group, shown in the Viewer as ability "Invite People to this Group." For more information, see Group Roles Knowledge Base article.
    • The group owner always has this ability
    • By default, officers have it.
    • Other group members may have the ability, if they have a role for which it has been granted.
  • Register the user yourself using your granted capabilities.

Parameters

POST an LLSD map containing the user's first and last name and the group name and the Reg API returns a Boolean value indicating whether the operation was successful.

Parameter Data type Description Default Value
first String User's first name None. Required parameter.
last String User's last name None. Required parameter.
group_name String Group name None. Required parameter.

Return value

The Reg API returns an LLSD document containing a Boolean value that indicates whether the operation was successful. If the value is "true" then the Resident was added to the specified group.

Example

Posted message:

<llsd>
   <map>
       <key>first</key>
       <string>Noobie</string>
       <key>last</key>
       <string>Filbert</string>
       <key>group_name</key>
       <string>Cool Group</string>
   </map>
</llsd>

If the Resident was successfully added to the group, Reg API returns the following:

<llsd> 
  <boolean>true</boolean> 
</llsd>

check_name

HTTP method: POST

The check_name operation checks to see if a user can be registered with a given Second Life first name and last name.

Parameters

POST the new user's desired "username" and "last_name_id", and the Reg API returns an LLSD document that contains a Boolean value indicating whether the name is available.

Setting Data type Description Default Value
username String Desired user name (Second Life first name). Must be between 2-31 alphanumeric characters. Certain first names are restricted; for example, those considered obscene or inappropriate for public use. Required parameter.
last_name_id Integer ID of desired Second Life last name. Required parameter.

Example

Posted message:

<llsd> 
  <map> 
      <key>username</key><string>mistaht</string> 
      <key>last_name_id</key><integer>1872</integer> 
  </map> 
</llsd>

Reply message:

<llsd> 
  <boolean>true</boolean> 
</llsd>

create_user

HTTP method: POST

The create_user operation creates a new Second Life Resident (user) account. POST to this URL a LLSD document containing at least the following parameters:

  • username
  • last_name_id

In addition, you can include any of the optional parameters listed in the table below.

If successful, the Reg API will return a hash containing the new user's agent_id and a url to redirect the user to where they can finalize the new account. If there are errors, the Reg API will instead return an array containing the applicable error codes.

Parameters

Setting Data type Description Required Default Value
username String Desired user name (Second Life first name). Must be between 2-31 alphanumeric characters. Certain first names are restricted; for example, those considered obscene or inappropriate for public use. Yes -
last_name_id Integer ID of desired Second Life last name. Yes -
limited_to_estate Integer ID of estate that the user will be limited to. To change this to another estate, you must own the estate. No Estate 1, the mainland.
start_region_name String Region where user will initially appear after login. This can only be set to simulators in the user's limited to estate. No Orientation island of the estate.
start_local_x Real X coordinate of the starting region. Must be between 0-256. Value must have two decimal places, for example: 123.00. No 128 (center).
start_local_y Real Y coordinate of the starting region. Must be between 0-256. Value must have two decimal places, for example: 123.00. No 128 (center).
start_local_z Real Z coordinate of the starting region. Must be between 0-4000. Value must have two decimal places, for example: 123.00. No 128 (center).
start_look_at_x Real X component of the unit vector representing initial look direction. Must be between -1 and 1. No 0
start_look_at_y Real Y component of the unit vector representing initial look direction. Must be between -1 and 1. No 1
start_look_at_z Real Z component of the unit vector representing initial look direction. Must be between -1 and 1. No 0
marketing_emails Boolean Enable marketing emails for the user by default. This will set the initial state for the user, but this value is presented to the user on the activation page as well. No True
success_url URI Page to redirect the user to after the activation page if their activation was successful. No No redirection.
error_url URI Page to redirect the user to after the activation page if their activation was not successful. No No redirection.

NOTE: You can get the numeric estate ID via the debug menus (Ctrl+Alt+Shift+D to enable them). Then use Client > View Admin Options. This will allow you to view, but not use, the options that admins (Lindens) can use. Now go to the Server menu, which appeared with the Client one. Select God Tools, look at the Region tab... the Estate ID is listed there. Don't worry about pressing or changing something you shouldn't... as they are just viewable options, any changes you make won't stick.

Return value

If the operation successfully creates a new user, it returns a document like this:

<llsd> 
  <map> 
      <key>agent_id</key> 
      <string>UNIQUE_ID</string>
      <key>complete_reg_url</key> 
      <uri>https://accounts.secondlife.com/new-account/NONCE</uri>
  </map> 
</llsd>

Where UNIQUE_ID is the new user's unique Second Life ID number, and NONCE is a single-use UUID string for account activation.

If the operation is not successful, then it returns an array of error codes similar to that returned by get_error_codes.

Example

Posted message:

<llsd>
  <map>
    <key>start_region_name</key><string>da boom</string>
    <key>username</key><string>mistaht</string>
    <key>last_name_id</key><integer>1872</integer>
  </map>
</llsd>

Reply message:

<llsd> 
  <map> 
      <key>agent_id</key> 
      <uuid>87cfdb64-c852-4359-ae16-dce36099ff68</uuid> 
      <key>complete_reg_url</key> 
      <uri>https://accounts.secondlife.com/new_account/13da66b8-8635-4019-a7b4-0582397d8b83/</uri> 
  </map> 
</llsd>

regenerate_user_nonce

HTTP method: POST

The regenerate_user_nonce operation will recreate an activation url for a user, provided the user has not already completed their own activation.

Parameters

POST the user's "agent_id", and the Reg API returns an LLSD document identical to the original create_user call containing "agent_id" and "complete_reg_url".

Setting Data type Description Default Value
agent_id UUID The agent_id of the created user. Required parameter.

Example

Posted message:

<llsd> 
  <map> 
      <key>agent_id</key> 
      <uuid>87cfdb64-c852-4359-ae16-dce36099ff68</uuid> 
  </map> 
</llsd>

Reply message:

<llsd> 
  <map> 
      <key>agent_id</key> 
      <uuid>87cfdb64-c852-4359-ae16-dce36099ff68</uuid> 
      <key>complete_reg_url</key> 
      <uri>https://accounts.secondlife.com/new_account/13da66b8-8635-4019-a7b4-0582397d8b83/</uri> 
  </map> 
</llsd>


get_experiences

HTTP method: GET

This operation will get a list of experiences you have admin privileges to as a registrar. The keys can be used set up newly-created users with experiences.

Example

Reply message:

<llsd> 
  <map>
   <key>64d4500e-00da-11e6-8174-fa4c4c28149b</key>
   <string>An Experience Name</string>
   <key>8bba1a36-05a4-11e6-a370-fa4c4c046a71</key>
   <string>Another experience name</string>
  <map>
</llsd>

set_user_experience

HTTP method: POST

The set_user_experience operation will attempt to set an experience for a given user, provided you have admin access to the experience and the user has not already logged in.

Parameters

POST the user's "agent_id" and the "experience_id" of the experience you wish to set them up with, which can be located using the get_experiences endpoint.

Setting Data type Description Default Value
agent_id UUID The agent_id of the created user. Required parameter.
experience_id UUID The experience_id of the desired experience. Required parameter.

Example

Posted message:

<llsd> 
  <map> 
      <key>agent_id</key> 
      <uuid>87cfdb64-c852-4359-ae16-dce36099ff68</uuid> 
      <key>experience_id</key> 
      <uuid>64d4500e-00da-11e6-8174-fa4c4c28149b</uuid> 
  </map> 
</llsd>

Reply message:

<llsd> 
  <boolean>true</boolean> 
</llsd>

get_avatars

HTTP method: GET

This operation will get a list of default avatars that can be assigned to newly-created users before they log in for the first time.

Example

Reply message:

<llsd> 
 <map>
 <key>fcac7613-6adf-d701-d71e-5b7703347d81</key>
 <string>Lucy (Mesh)</string>
 ...
 <key>a92276cb-8b32-4066-7364-d726cb0a9e98</key>
 <string>Vampire Tristan (Mesh)</string>
</llsd>

set_user_avatar

HTTP method: POST

The set_user_avatar operation will attempt to set one of a selection of avatars for a given user, provided the user has not already logged in.

Parameters

POST the user's "agent_id" and the "avatar_id" of the avatar you wish to set them up with, which can be located using the get_avatars endpoint.

Setting Data type Description Default Value
agent_id UUID The agent_id of the created user. Required parameter.
avatar_id UUID The avatar_id of the desired avatar. Required parameter.

Example

Posted message:

<llsd> 
  <map> 
      <key>agent_id</key> 
      <uuid>87cfdb64-c852-4359-ae16-dce36099ff68</uuid> 
      <key>avatar_id</key> 
      <uuid>fcac7613-6adf-d701-d71e-5b7703347d81</uuid> 
  </map> 
</llsd>

Reply message:

<llsd> 
  <boolean>true</boolean> 
</llsd>

get_error_codes

HTTP method: GET

The get_error_codes operation returns an LLSD document describing the Reg API error codes. This information is reproduced in Registration API Error Codes. This operation does not take any parameters.

The errors are in an array, and each error is, in addition, contained in an array. The first element in the array is the error code, the second is the name of the error, the third is the description.

Example

The following HTML code illustrates a simple form to get the error codes:

<form action="https://cap.secondlife.com/cap/0/UUID" method="GET">
   <input type='submit' value="Get Error Codes">
</form>

Example response:

<llsd> 
   <array> 
       <array> 
           <integer>10</integer> 
           <string>missing required field</string> 
           <string>You are missing one of the required fields</string> 
       </array> 
... 
       <array> 
           <integer>1500</integer> 
           <string>unhandled exception</string> 
           <string>There was an unhandled exception attempting to process this request. Please contact support with the endpoint you were trying to access.</string> 
       </array> 
   </array> 
</llsd>

get_last_names

HTTP method: GET

The get_last_names operation retrieves the last names and corresponding IDs with which you are able to register new users.

Example

The following HTML code illustrates a simple form to get the valid last names:

<form action="https://cap.secondlife.com/cap/0/UUID" method="GET">
   <input type="submit" value="Get Last Names">
</form>

Example response:

<llsd> 
  <map> 
      <key>1926</key><string>Morellet</string> 
      <key>1683</key><string>Okamoto</string> 
      <key>1738</key><string>Rankin</string> 
... 
      <key>1870</key><string>Yang</string> 
  </map> 
</llsd>

get_reg_capabilities

HTTP method: POST

This operation returns the capability URL for each operation for which your account is authorized.

URI: https://cap.secondlife.com/get_reg_capabilities

POST parameters

  • first_name (Second Life first name)
  • last_name (Second Life surname)
  • password

For more information on capability URLs, see Using capability URLs.

DTD

This simplified version of the full LLSD DTD, enables stricter validation of result documents.

<xml><!DOCTYPE llsd [

<!ELEMENT llsd (map)> <!ELEMENT map ((key,(string|uri))*)> <!ELEMENT key (#PCDATA)> <!ELEMENT string (#PCDATA)> <!ELEMENT uri (#PCDATA)>

<!ATTLIST string xml:space (default|preserve) 'preserve'>

]></xml>