API Reference

Users.getSessionToken

Returns a session token for a specified user ID.

This method returns the session token for the provided user id. If the third argument is true it will also return any user data available for the account in the form of an array.


Syntax

mixed users.getSessionToken ( int vhost, mixed userId, bool isUserName = false, bool returnUserInfo = false, bool uploadToken = false )

Arguments

NameTypeRequiredDefault valueDescription
vhostintRequirednoneThe id of the vhost.
userIdmixedRequirednoneThe user id that you are attempting to get the session for.
isUserNameboolOptionalfalseIf this argument is true, the method will treat the user ID argument as username.
returnUserInfoboolOptionalfalseIf this parameter is true it will return user info in an array as listed below
uploadTokenboolOptionalfalseIf this parameter is 1 a temporary generated upload only token will be generated, otherwise default sessionToken will be returned, if returnUserInfo is true you will receive both tokens.

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.
metaARRAYAn 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.newspark.ca/services/rest/users/getSessionToken?vhost=[VHOST_ID]&userId=[USER_ID]&APIKEY=[APIKEY]
<?xml version="1.0" encoding="UTF-8"?>
<result>SESSION_TOKEN</result>
Sample JSON Response
{
    "status": true,
    "result": SESSION_TOKEN
}

Code examples

0 comments

Be the first to comment on getSessionToken.

Add a Comment

  • captcha