API Reference

Users.confirmCredentials

Confirms a users username and password, and optionally returns user information.

If returnUserInfo is set to false, this method will return the user id when the settings were correct. This method always returns false when username or password is incorrect.

If login is set to true a session will be started and the system will return a sessiontoken property in the userData struct. If the returnUserInfo is false, login will be ignored.


Syntax

mixed users.confirmCredentials ( int vhost, string username, string password, bool returnUserInfo = false, bool login = false, bool isEmail = false )

Arguments

NameTypeRequiredDefault valueDescription
vhostintRequirednoneThe id of the vhost.
usernamestringRequirednoneThe username of the user you are attempting to confirm.
passwordstringRequirednoneThe password for the user you are attempting to confirm.
returnUserInfoboolOptionalfalseIf this parameter is true it will return user info in an array as listed below
loginboolOptionalfalseIf this parameter is true it will create a user session token for the user. For this to be available you need to call the method with the returnUserInfo argument set to true.
isEmailboolOptionalfalseIf this parameter is true it will treat the username parameter as an e-mail address instead of a username string.

Response: Optionally returned array

This is the data array that could potentially be returned if returnUserInfo is set to true

NameTypeDescription
idINTThe user id for the username/email provided.
userSTRINGThe username for the account requested.
vhostINTThe vhost for the account requested.
firstnameSTRINGThe first name for the account requested.
lastnameSTRINGThe last name for the account requested.
nicknameSTRINGThe nickname for the account requested.
address1STRINGThe first line of the address for the account requested.
address2STRINGThe second line of the address for the account requested.
citySTRINGThe city for the account requested.
stateSTRINGThe state/province for the account requested.
countrySTRINGThe country for the requested account.
postalSTRINGThe postal code or zip code for the requested account.
emailSTRINGThe e-mail address for the requested account.
websiteSTRINGThe website for the requested account.
genderCHARThe gender of the requested account owner, obviously this is only going to be M for male or F for female.
phoneSTRINGThe phone number for the requested account owner.
cellphoneSTRINGThe cell phone number for the requested account owner.
occupationSTRINGThe occupation for the requested account owner.
metaSERIALIZED ARRAYAn array containing any meta data that was provided by the account owner that has been saved by the system.
newsletterBOOLWhether or not the account owner wanted the newsletter or not. 1 is true, 0 is false.

Sample Response

Sample REST Response
http://api.filemobile.com/services/rest/users/confirmCredentials?vhost=[VHOST_ID]&username=[USERNAME]&password=[USER_PASSWORD]&APIKEY=[APIKEY]
<?xml version="1.0" encoding="UTF-8"?>
<result>USER_ID</result>
Sample JSON Response
{
    "status": true,
    "result": USER_ID
}
Sample REST Response
http://api.filemobile.com/services/rest/users/confirmCredentials?vhost=[VHOST_ID]&username=[USERNAME]&password=[USER_PASSWORD]&returnUserInfo=true&APIKEY=[APIKEY]
<?xml version="1.0" encoding="UTF-8"?>
<result>
  <id>USER_ID</id>
  <user>USER_NAME</user>
  <email>USER_EMAIL</email>
  <firstname>USER_FIRSTNAME</firstname>
  <lastname>USER_LASTNAME</lastname>
  <city>Toronto</city>
  <gender>M</gender>
  <cellphone>4162222222</cellphone>
  <phone>4162222222</phone>
  <website/>
  <occupation/>
  <address1>1 Toronto Street</address1>
  <address2/>
  <state>ON</state>
  <country>CA</country>
  <newsletter>0</newsletter>
  <nickname/>
  <vhost>VHOST_ID</vhost>
  <meta>
    <lang>en</lang>
    <twitterUserName/>
    <rules>1</rules>
  </meta>
</result>

Sample JSON Response
{
    "status": true,
    "result": {
        "id": USER_ID,
        "user": "USER_NAME",
        "email": "USER_EMAIL",
        "firstname": "USER_FIRSTNAME",
        "lastname": "USER_LASTNAME",
        "city": "Toronto",
        "gender": "M",
        "cellphone": "4162222222",
        "phone": "4162222222",
        "website": "",
        "occupation": "",
        "address1": "1 Toronto Street",
        "address2": null,
        "state": "ON",
        "country": "CA",
        "newsletter": "0",
        "nickname": "",
        "vhost": VHOST_ID,
        "meta": {
            "lang": "en",
            "twitterUserName": "",
            "rules": "1"
        }
    }
}

Code examples

0 comments

Be the first to comment on confirmCredentials.

Add a Comment

  • captcha