Linden Lab Official:Registration API Reference

From Second Life Wiki
Jump to navigation Jump to search

To gain the capability URL for each service, POST your Second Life "first_name", "last_name", and "password" to https://cap.secondlife.com/get_reg_capabilities.

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

GET operations

get_last_names

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

Example GET 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_error_codes

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

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 GET response:

<llsd> 
   <array> 
       <array> 
           <integer>10</integer> 
           <string>invalid flow</string> 
           <string>The registration flow does not exist</string> 
       </array> 
       <array> 
           <integer>20</integer> 
           <string>missing required field</string> 
           <string>You are missing one of the required fields</string> 
       </array> 
... 
       <array> 
           <integer>1500</integer> 
           <string>malformed xml</string> 
           <string>Your xml is malformed</string> 
       </array> 
   </array> 
</llsd>

POST operations

create_user

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
  • email
  • dob
  • password

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.

POST Parameters

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.
email String User's email address. Required parameter.
password String Desired password. 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.
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. Optional parameter. 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. Optional parameter. Orientation island of the estate.
start_local_x Float 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.

128 (center).
start_local_y Float 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.

128 (center).
start_local_z Float Z 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.

128 (center).
start_look_at_x Float X component of the unit vector representing initial look direction. Must be between 0-1.

Optional parameter; valid only when start_region_name is set.

0
start_look_at_y Float Y component of the unit vector representing initial look direction. Must be between 0-1.

Optional parameter; valid only when start_region_name is set.

1

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

Map - If user creation is successful, a map with the new user's information is returned

  • key: agent_id
    • value (Integer): ID of new SL user.

or

  • Array - If user creation fails, an array of error code(s) is returned.
    • Integer - Represents an error code (see get error codes)

Example Posted Message:

<llsd>
  <map>
    <key>dob</key><string>1987-07-06</string>
    <key>start_region_name</key><string>da boom</string>
    <key>username</key><string>mistaht</string>
    <key>last_name_id</key><integer>1872</integer>
    <key>password</key><string>123456</string>
    <key>email</key><string>ben@ben.com</string>
  </map>
</llsd>

Example Reply Message:

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

check_name

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

POST the new user's desired "username" and "last_name_id", and you'll get back LLSD XML, representing a boolean. The same parameter restrictions for the "create user" service apply here.

Example Posted Message:

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

Example Reply Message:

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