API Reference

Users.getUserInfoByDeviceID

This method will return the user information related to the owner of a particular mobile device.

Syntax

array users.getUserInfoByDeviceID ( mixed deviceId, int vhost )

Arguments

NameTypeRequiredDefault valueDescription
deviceIdmixedRequirednoneThe device id that you are attempting to get user info for.
vhostintRequirednoneIf the first argument is a string the vhost parameter is required.

Response

Below you will find a list and description of all of the available fields to have returned with our users.getUserInfoByDeviceID service.

NameTypeDescription
device_idSTRINGThe device id of the requested user.
userSTRINGThe username for the requested user.
passwordSTRINGAn encrypted hash containing the user's password.
emailSTRINGThe e-mail address for the requested user.
firstnameSTRINGThe first name of the requested user.
lastnameSTRINGThe last name for the requested user.
citySTRINGThe city for the requested user.
genderCHARThe gender of the requested user.
birthdateDATEThe birthdate of the requested user.
cellphoneSTRINGThe users cell phone number.
phoneSTRINGThe users telephone number.
websiteSTRINGThe users website.
occupationSTRINGThe users occupation.
address1STRINGThe first line of the users address.
address2STRINGThe second line of the users address.
postalcodeSTRINGThe postal code of the requested user.
stateSTRINGThe state of the requested user.
languageSTRINGThe requested users language.
countrySTRINGThe requested users country.
descriptionSTRINGA description of the requested user.
storageINT 
avatarINTAn integer for the media item of the requested users avatar.
createdDATETIMEThe date and time that the user was created.
lastloginDATETIMEThe date and time that the user was last logged into the system.
random1INTA random number used for activating the account.
random2INTA random number used for activating the account.
accounttypeINTNot currently implemented.
activeBOOLEANWhether or not the requested user is activated.
disabledBOOLEANWhether or not the requested user's account is disabled.
newsletterBOOLEANWhether or not the requested user has requested the newsletter. 0 is false, 1 is true.
nicknameSTRINGThe requested users nickname.
attemptsINTThe number of login attempts for the user since the last successful login.
mobileblogSTRINGA url for a mobile blog for the requested user.
publicfilesINTThe number of media items that user has uploaded to the system.
NOTE: You can find the value of notdeniedfiles by subtracting deniedfiles from publicfiles.
unmoderatedfilesINTThe number of media items that the user has uploaded to the system.
approvedfilesINTThe number of media items that the user has uploaded to the system.
deniedfilesINTThe number of media items uploaded by the user that have been denied.
unmoderatedcommentsINTThe number of comments the user has posted that have yet to be moderated.
approvedcommentsINTThe number of comments the user has posted that have been approved.
NOTE: You can find the value of notdeniedcomments by calculating the sum of approvedcomments plus unmoderatedcomments.
deniedcommentsINTThe number of comments the user has posted that have been denied.
notdeniedcommentsINTThe number of comments the user has posted that have been approved or have yet to be mopderated.
friendsINTThe number of users that have accepted this user's friend request.
friends_notconfirmedINTThe number of users that have yet to confirm this user's friend request.
geo_latitudeFLOATThe geographical latitude for the requested user.
geo_longitudeFLOATThe geographical longitude for the requested user.
vhostINTThe vhost for the requested user.
metaARRAYAny meta data that has been collected about the requested user.
no_comment_notificationsINTSet to 1 to prevent the user from receiving comment notifications. Set to 0 to allow the user to receive them.
profile_completeBOOLEANWhether or not the requested user has a complete profile.
externalidsARRAYThe user's external IDs, if any.
gravataridSTRINGAn md5 hash of the user's email address, which is used to confirm the user's gravatar.
followersINTThe number of user's following the user.
followingINTThe number of user's the user follows.

Sample Response

Sample REST Response
http://api.newspark.ca/services/rest/users/getUserInfoByDeviceID?vhost=[VHOST_ID]&deviceId=[DEVICE_ID]&APIKEY=[APIKEY]
<?xml version="1.0" encoding="UTF-8"?>
<result>
  <id>USER_ID</id>
  <user>USER_NAME</user>
  <password>HASHED_USER_PASSWORD</password>
  <email>USER_EMAIL</email>
  <firstname>USER_FIRSTNAME</firstname>
  <lastname>USER_LASTNAME</lastname>
  <city>USER_CITY</city>
  <gender>M</gender>
  <birthdate>2011-02-01</birthdate>
  <cellphone>4162222222</cellphone>
  <phone>4162222222</phone>
  <website/>
  <occupation/>
  <address1>1 Toronto Road</address1>
  <address2/>
  <postalcode>M1M1M1</postalcode>
  <state>ON</state>
  <language/>
  <country>CA</country>
  <description/>
  <storage>0</storage>
  <avatar>0</avatar>
  <created>2012-02-03 14:48:50</created>
  <lastlogin>2012-02-03 16:30:11</lastlogin>
  <random1>5045</random1>
  <random2>151285996</random2>
  <accounttype>0</accounttype>
  <active>1</active>
  <disabled>0</disabled>
  <newsletter>0</newsletter>
  <openidurl/>
  <nickname/>
  <attempts>0</attempts>
  <mobileblog>0</mobileblog>
  <publicfiles>0</publicfiles>
  <unmoderatedfiles>0</unmoderatedfiles>
  <approvedfiles>0</approvedfiles>
  <deniedfiles>0</deniedfiles>
  <friends>1</friends>
  <friends_notconfirmed>0</friends_notconfirmed>
  <geo_latitude>41.83209336689739</geo_latitude>
  <geo_longitude>-84.44921875</geo_longitude>
  <vhost>VHOST_ID</vhost>
  <meta>
    <lang>en</lang>
    <twitterUserName/>
    <rules>1</rules>
  </meta>
  <no_comment_notifications>0</no_comment_notifications>
  <profile_complete>1</profile_complete>
  <externalids/>
</result>
Sample JSON Response
{
    "status": true,
    "result": {
        "id": USER_ID,
        "user": "USER_NAME",
        "password": "HASHED_USER_PASSWORD",
        "email": "USER_EMAIL",
        "firstname": "USER_FIRSTNAME",
        "lastname": "USER_LASTNAME",
        "city": "Toronto",
        "gender": "M",
        "birthdate": "2011-02-01",
        "cellphone": "4162222222",
        "phone": "4162222222",
        "website": "",
        "occupation": "",
        "address1": "1 Toronto Road",
        "address2": null,
        "postalcode": "M1M1M1",
        "state": "ON",
        "language": "",
        "country": "CA",
        "description": "",
        "storage": 0,
        "avatar": 0,
        "created": "2012-02-03 14:48:50",
        "lastlogin": "2012-02-03 16:30:11",
        "random1": 5045,
        "random2": 151285996,
        "accounttype": 0,
        "active": "1",
        "disabled": "0",
        "newsletter": "0",
        "openidurl": "",
        "nickname": "",
        "attempts": 0,
        "mobileblog": 0,
        "publicfiles": 0,
        "unmoderatedfiles": 0,
        "approvedfiles": 0,
        "deniedfiles": 0,
        "friends": 1,
        "friends_notconfirmed": 0,
        "geo_latitude": "41.83209336689739",
        "geo_longitude": "-84.44921875",
        "vhost": 231,
        "meta": {
            "lang": "en",
            "twitterUserName": "",
            "rules": "1"
        },
        "no_comment_notifications": 0,
        "profile_complete": 1,
        "externalids": {},
	"deviceInfo": 
            "0":  {
                    "id" : DEVICE_ID,
                    "uid" : USER_ID,
                    "vhost" : 239,
                    "device_id" : "04dbc117fbe284db71d3be1f37fe2e00fa13176da87f4e66de376606fdf05558",
                    "latitude" : "43.635872",
                    "longitude" : "-79.424721",
                    "lastupdatetime" : "2012-11-23 12:33:19",
                    "commentnotification" : 0,
                    "assignmentnotification" : 0,
                    "settings] : "a:1:{s:22:"notificationBadgeCount";s:1:"0";}"
                },
	    "1":  {
                    "id" : DEVICE_ID,
                    "uid" : USER_ID,
                    "vhost" : 239,
                    "device_id" : "14dbc117fbe284db71d3be1f37fe2e00fa13176da87f4e66de376606fdf05558",
                    "latitude" : "45.635872",
                    "longitude" : "-78.424721",
                    "lastupdatetime" : "2012-11-24 12:33:19",
                    "commentnotification" : 0,
                    "assignmentnotification" : 0,
                    "settings] : "a:1:{s:22:"notificationBadgeCount";s:1:"0";}"
                }	
    }
}

Code examples

0 comments

Be the first to comment on getUserInfoByDeviceID.

Add a Comment

  • captcha