API Reference

Users.updateUserInfo

Updates a user's information personal information and metadata.

The meta data field is a bit special. The meta field must be supplied as an array. The new user meta-data will be a merge of the existing meta-date + the newly supplied metadata. Only the top-level elements in the array will be merged, if you have an array within an array, the old top-level array will be completely overwritten. If you just want to get rid of some metadata, we advice to simply supply an empty value.

If no user id is supplied this method will update the information of the currently logged in user.


Syntax

bool users.updateUserInfo ( int id, array newProperties )

Arguments

NameTypeRequiredDefault valueDescription
idintRequirednoneThe user id that you wish to update information for.
newPropertiesarrayRequirednoneThe properties that you wish to change for a particular user id. The complete list of updateable properties are available below.

Details of the newProperties array

These are the fields that can be updated using the updateUserInfo call. To update these fields, the arguments have to be passed as an array in the newProperties parameter.

NameTypeDescription
firstnameSTRINGThe users first name.
lastnameSTRINGThe users last name.
emailSTRINGThe users e-mail address.
userSTRINGThe users user name.
passwordSTRINGThe users password.
citySTRINGThe users city.
countrySTRINGThe users country.
postalcodeSTRINGThe users postal code.
newsletterBOOLEANWhether or not the user wants the newsletter, 0 is false, 1 is true.
genderCHARThe sex of the user, M is male and F is female.
birthdayDATEThe users date of birth.
languageSTRINGThe users language
stateSTRINGThe users state.
websiteSTRINGThe users website.
occupationSTRINGThe users occupation.
phoneSTRINGThe user telephone number.
cellphoneSTRING The users cell phone number.
address1STRINGThe first line of the users address.
address2STRINGThe second line of the users address.
nicknameSTRINGThe users nickname.
external_idSTRINGThe id provided by a 3rd party external authorization system.
NOTE: If this is set to blank, the user's external id will be deleted.
external_id_providerINTEGERThe 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.
external_id_provider_urlSTRINGThe URL of the 3rd party that provides the external id.
external_avatar_urlSTRINGThe URL of the avatar from the 3rd party that provided the external id.
external_id_sub_providerSTRINGThe sub-provider of the Janrain external id.
Currently, the external id sub-providers are:
  • facebook
  • gigya

NOTE: The external_id_sub_provider is required if Janrain is set as the external_id_provider.
descriptionSTRINGThe users description.
metaARRAYAny meta data that you may want to save.
deviceinfoARRAYArray of mobile device information. An example:

$deviceinfo[0] = Array
(
'latitude' => '43.648311',
'longitude' => '-79.396021',
'lastupdatetime' => '2012-12-10 18:32:21',
'commentnotification' => 1,
'appcode' => 'MOB123',
'assignmentnotification' => 1,
'settings' => 'a:1:{s:22:"notificationBadgeCount";s:1:"0";}'

$deviceinfo[1] = Array
(
'latitude' => '44.648311',
'longitude' => '-78.396021',
'lastupdatetime' => '2012-12-11 18:32:21',
'commentnotification' => 0,
'assignmentnotification' => 1,
'appcode' => 'MOB123' );
createdDATETIMEThe time that the user was created.
no_comment_notificationsINTThe number of comments that user has made.
disabledBOOLEANWhether or not the user is disabled, 0 is false, 1 is true.
overrideExistingMetaBOOLEANIf set to TRUE, the existing meta data will be overwritten, otherwise the existing meta data will be merged with the new meta data
avatarINTThe media id to be shown as the user's avatar.
disable_media_notificationsINTSet to 1 to disable the user's media notifications. Set to 0 to allow them.
disable_thread_notificationsINTSet to 1 to disable the user's thread notifications. Set to 0 to allow them.

Sample Response

Sample REST Response
http://api.filemobile.com/services/rest/users/updateUserInfo?id=[USER_ID]&newProperties[firstname]=[USER_NEW_FIRSTNAME]&newProperties[meta][key]=[THE_NEW_VALUE]&APIKEY=[APIKEY]
<?xml version="1.0" encoding="UTF-8"?>
<result>1</result>
Sample JSON Response
{
    "status": true,
    "result": 1
}

Code examples

0 comments

Be the first to comment on updateUserInfo.

Add a Comment

  • captcha