API Reference

Users.register

This method registers a new user.

Optionally the user can be activated immediately. If the email parameter contains a string, an email template named by that string will used to send out an activation or welcome email.

The return value is the newly created user id.

This method can only be called with a valid developer key.

Required fields for userData are user and email.

Optional fields are firstname, lastname, password, address1, address2, city, state, country, postal, gender (M or F), birthdate, cellphone, phone, website, occupation, school, language, geo_latitude, geo_longitude and newsletter.

The "user" field must only contain letters (a-z), digits (0-9), underscore (_), hyphen (-), period (.), and the "at" sign (@).

There's also an optional meta field in the userData array. This field can contain any data array.


Syntax

int users.register ( int vhost, array userData, bool activate = false, mixed sendEmail = false )

Arguments

NameTypeRequiredDefault valueDescription
vhostintRequirednoneThe id of the vhost.
userDataarrayRequirednoneAn array with user information. Only user and email are required, other possible key / value pairs are listed below.
activateboolOptionalfalseAutomatically activate user. This may be either true or false. When true the user is activated upon registration.
sendEmailmixedOptionalfalseWhether or not to send an e-mail to activate the user that is used in the registration call. When true an e-mail is sent to the e-mail address provided in the array.

Array key / value pairs

The possible key value pairs that you can use in your userData array.

NameTypeRequiredDefault ValueDescription
userSTRINGRequirednoneUsername for the account. The user parameter must only contain letters (a-z or A-Z), digits (0-9), underscore (_), hyphen (-), period (.), and the "at" sign (@).
emailSTRINGRequirednoneEmail address for the account holder. This has to be a properly formatted email address.
firstnameSTRINGOptionalnoneFirstname for the account holder
lastnameSTRINGOptionalnoneLastname for the account holder
passwordSTRINGOptionalrandom stringPassword for the account holder (if none is provided the system will generate one and send it to the user)
address1STRINGOptionalnoneThe account holders address.
address2STRINGOptionalnoneA second line for the account holders address.
citySTRINGOptionalnoneThe account holders city.
languageSTRINGOptionalnoneThe language the account holder is using poss.
stateSTRINGOptionalnoneThe account holders state/province.
countrySTRINGOptionalnoneThe account holders country.
postalcodeSTRINGOptionalnoneThe account holders zip or postal code.
birthdateSTRINGOptionalnoneThe account holders birth date.
cellphoneSTRINGOptionalnoneThe account holders cell phone.
phoneSTRINGOptionalnoneThe account holders phone number.
websiteSTRINGOptionalnoneThe account holders website.
accounttypeSTRINGOptional0The account type for the account holder.
occupationSTRINGOptionalnoneThe account holders occupation.
newsletterBOOLEANOptional0Whether the account holder wants to receive a newsletter.
profile_completeBOOLEANOptional0If a users profile should be marked as complete or not.
genderCHARNot requirednoneThe account holders gender, acceptable values are M or F.
metaSTRINGOptionalnoneAny meta data you wish to store about the account holder.
external_idSTRINGOptionalnoneThe id provided by a 3rd party external authorization system.
NB: This is to be used with 'external_id_provider'.
external_id_providerINTEGEROptionalnoneThe integer that represents the 3rd party that provided the external id.
Possible values are:
  • 1 (Facebook)
  • 4 (Janrain)
  • 5 (Gigya)
  • 6 (Stripe)

NOTE: The external_id_provider is required if external_id is passed.

Sample Response

Sample REST Response
http://api.filemobile.com/services/rest/users/register?vhost=[VHOST]&userData[user]=[NEW_USER_NAME]&userData[email]=[NEW_USER_EMAIL_ADDRESS]&userData[meta][key]=value&activate=true&APIKEY=[APIKEY]
<?xml version="1.0" encoding="UTF-8"?>
<result>NEW_MEDIA_ID</result>
Sample JSON Response
{
    "status": true,
    "result": NEW_MEDIA_ID
}
Sample REST Response
http://api.filemobile.com/services/rest/users/register?vhost=[VHOST]&userData[user]=[NEW_USER_NAME]&userData[email]=[NEW_USER_EMAIL_ADDRESS]&userData[meta][key]=value&activate=true&APIKEY=[APIKEY]
<?xml version="1.0" encoding="UTF-8"?>
<result>NEW_MEDIA_ID</result>
Sample JSON Response
{
    "status": true,
    "result": NEW_MEDIA_ID
}
Sample REST Response
http://api.filemobile.com/services/rest/users/register?vhost=[VHOST]&userData[user]=[NEW_USER_NAME]&userData[email]=[NEW_USER_EMAIL_ADDRESS]&userData[meta][key]=value&activate=true&APIKEY=[APIKEY]
<?xml version="1.0" encoding="UTF-8"?>
<result>NEW_MEDIA_ID</result>
Sample JSON Response
{
    "status": true,
    "result": NEW_MEDIA_ID
}
Sample REST Response
http://api.filemobile.com/services/rest/users/register?vhost=[VHOST]&userData[user]=[NEW_USER_NAME]&userData[email]=[NEW_USER_EMAIL_ADDRESS]&userData[meta][key]=value&activate=true&APIKEY=[APIKEY]
<?xml version="1.0" encoding="UTF-8"?>
<result>NEW_MEDIA_ID</result>
Sample JSON Response
{
    "status": true,
    "result": NEW_MEDIA_ID
}

Code examples

0 comments

Be the first to comment on register.

Add a Comment

  • captcha