Authenticate a user » History » Revision 2
Revision 1 (Eric Vieillevigne, 05/12/2015 12:27 PM) → Revision 2/6 (Eric Vieillevigne, 05/12/2015 12:27 PM)
{{>toc}} 
 
 h1. Authentication - log 
 In order to use the API you must be a valid user and be authenticated by the platform. First you have to create an account. In order to perform this tasks you shall use the API. 
 h2. Account Creation - _logcreate_ 
 This method creates a new account into the platform with at least one email 
 Open a session with the created account, even if the account identifier is not validated yet. (see loginByPassword for detail about the session). 
 By sending an HTTP request http://stagingapi.familywall.com/api/log/create?identifier=mynewid%40de.de&password=mynewpassword 
 *Parameters*: 
 |*Name*|*Type*|*Description*| 
 |Login|String|Login Information| 
 |Password|String|Password Information| 
 *Response*: 
 <pre><code class="javascript"> 
 { 
   "a01":{ 
     "r":{ 
       "r":"675" 
     }, 
     "cn":"logcreate" 
   } 
 } 
 </code></pre> 
 The Method response is a *Long* which represents the _AccountId_ of the account created .  
 In case, the method encounter any error, the response is an exeception with specific parameters detailed below. 
 *Error*: 
 |*Error Code*|*Type*|*Value*|*Description*| 
 |FizAccountAlreadyExistsException|Ex|2|Login already exists| 
 |FizCredentialInvalidException|Ex|3|Authentication Exception| 
 h2. Account Authentication- _login_ 
 In order to log-in into the platform and create a session, the _log_ method shall be called. By calling http://stagingapi.familywall.com/api/log/in? 
 identifier=accid&password=pwd the system will provide a session token enabling the client application to perform authenticated operations. However this is transparent to the API  
 because this is sent via the api session layer (usually under the form of a JSESSIONID). 
 *Parameters*: 
 |*Name*|*Type*|*Description*| 
 |identifier|String|Account Information Id| 
 |Password|String|Password Information| 
 *Response*: 
 <pre><code class="javascript"> 
 { 
   "a01":{ 
     "r":{ 
       "r":"130" 
     }, 
     "cn":"login" 
   } 
 } 
 </code></pre> 
 The Method response is a *Long* which represents the _AccountId_ of the account logged.  
 In case, the method encounter any error, the response is an exeception with specific parameters detailed below. 
 *Error*: 
 |*Error Code*|*Type*|*Value*|*Description*| 
 |FizAccountIdentifierNotValidatedException|Ex|4|Email is not validated yet| 
 |FizCredentialInvalidException|Ex|3|Authentication Exception| 
 |FizAccountNotFoundException|Ex|1|Account does not exists| 
 h2. Account Log Out- _logout_ 
 The client can call the method logout to terminate the session initiated by the methog login. 
 http://stagingapi.familywall.com/api/log/out 
 *Parameters*: 
 The method does not necessitate a parameter. It uses the JSESSIONID stored on the session cookie to request to the server the session invalidation 
 *Response*: 
 <pre><code class="javascript"> 
 { 
   "a01":{ 
     "r":{ 
       "r":"true" 
     }, 
     "cn":"logout" 
   } 
 } 
 </code></pre> 
 The Method response is a *Boolean* which returns *TRUE* as a results when session is effectively invalidated and *FALSE* when the session does not exists anymore.  
 In case, the method encounter any error, the response is an exeception with specific parameters detailed below. 
 *Error*: 
 |*Error Code*|*Type*|*Value*|*Description*| 
 |FizAccountNotFoundInSessionException|un|501|Session is invalid| 
 |FizApiInvalidParameterException|un|502|invalid token| 
 |FizApiModelDoesNotExistException|un|503|Object does not exists| 
 |FizApiModelRightException|un|504|Right exception to use this method| 
 h2. Account Validation- _logtoken_ 
 The logtoken method is used to validate an account identifier. If the account identifier is existing, the account identifier shall not be verified yet. If the validation Token  
 is ok, the account identifier is validated and a session with the account is opened. If the validation token is invalid, the FizCredentialInvalidException will be thrown. 
 http://stagingapi.familywall.com/api/log/token?identifier=id&token=string 
 *Parameters*: 
 |*Name*|*Type*|*Description*| 
 |identifier|String|Account Information Id| 
 |Token|String|Token Information| 
 *Response*: 
 <pre><code class="javascript"> 
 { 
   "a01":{ 
     "r":{ 
       "r":"130" 
     }, 
     "cn":"logtoken" 
   } 
 } 
 </code></pre> 
 The Method response is a *Long* which represents the _AccountId_ of the account logged.  
 In case, the method encounter any error, the response is an exeception with specific parameters detailed below. 
 *Error*: 
 |*Error Code*|*Type*|*Value*|*Description*| 
 |FizCredentialInvalidException|Ex|3|Authentication Exception| 
 |FizAccountNotFoundException|Ex|1|Account does not exists| 
 |FizAccountNotFoundInSessionException|un|501|Session is invalid| 
 |FizApiInvalidParameterException|un|502|invalid token| 
 |FizApiModelDoesNotExistException|un|503|Object does not exists| 
 |FizApiModelRightException|un|504|Right exception to use this method|