Project

General

Profile

Authenticate a user » History » Version 1

Eric Vieillevigne, 05/12/2015 12:27 PM

1 1 Eric Vieillevigne
{{>toc}}
2
h1. Authentication - log
3
4
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.
5
6
h2. Account Creation - _logcreate_
7
8
This method creates a new account into the platform with at least one email
9
Open a session with the created account, even if the account identifier is not validated yet. (see loginByPassword for detail about the session).
10
11
By sending an HTTP request http://stagingapi.familywall.com/api/log/create?identifier=mynewid%40de.de&password=mynewpassword
12
13
*Parameters*:
14
15
|*Name*|*Type*|*Description*|
16
|Login|String|Login Information|
17
|Password|String|Password Information|
18
19
*Response*:
20
<pre><code class="javascript">
21
{
22
  "a01":{
23
    "r":{
24
      "r":"675"
25
    },
26
    "cn":"logcreate"
27
  }
28
}
29
</code></pre>
30
The Method response is a *Long* which represents the _AccountId_ of the account created . 
31
32
In case, the method encounter any error, the response is an exeception with specific parameters detailed below.
33
34
*Error*:
35
36
|*Error Code*|*Type*|*Value*|*Description*|
37
|FizAccountAlreadyExistsException|Ex|2|Login already exists|
38
|FizCredentialInvalidException|Ex|3|Authentication Exception|
39
40
h2. Account Authentication- _login_
41
42
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?
43
44
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 
45
46
because this is sent via the api session layer (usually under the form of a JSESSIONID).
47
48
*Parameters*:
49
50
|*Name*|*Type*|*Description*|
51
|identifier|String|Account Information Id|
52
|Password|String|Password Information|
53
54
*Response*:
55
<pre><code class="javascript">
56
{
57
  "a01":{
58
    "r":{
59
      "r":"130"
60
    },
61
    "cn":"login"
62
  }
63
}
64
</code></pre>
65
The Method response is a *Long* which represents the _AccountId_ of the account logged. 
66
67
In case, the method encounter any error, the response is an exeception with specific parameters detailed below.
68
69
*Error*:
70
71
|*Error Code*|*Type*|*Value*|*Description*|
72
|FizAccountIdentifierNotValidatedException|Ex|4|Email is not validated yet|
73
|FizCredentialInvalidException|Ex|3|Authentication Exception|
74
|FizAccountNotFoundException|Ex|1|Account does not exists|
75
76
h2. Account Log Out- _logout_
77
78
The client can call the method logout to terminate the session initiated by the methog login.
79
80
http://stagingapi.familywall.com/api/log/out
81
82
*Parameters*:
83
The method does not necessitate a parameter. It uses the JSESSIONID stored on the session cookie to request to the server the session invalidation
84
85
*Response*:
86
<pre><code class="javascript">
87
{
88
  "a01":{
89
    "r":{
90
      "r":"true"
91
    },
92
    "cn":"logout"
93
  }
94
}
95
</code></pre>
96
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. 
97
98
In case, the method encounter any error, the response is an exeception with specific parameters detailed below.
99
100
*Error*:
101
|*Error Code*|*Type*|*Value*|*Description*|
102
|FizAccountNotFoundInSessionException|un|501|Session is invalid|
103
|FizApiInvalidParameterException|un|502|invalid token|
104
|FizApiModelDoesNotExistException|un|503|Object does not exists|
105
|FizApiModelRightException|un|504|Right exception to use this method|
106
107
h2. Account Validation- _logtoken_
108
109
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 
110
111
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.
112
113
http://stagingapi.familywall.com/api/log/token?identifier=id&token=string
114
115
*Parameters*:
116
117
|*Name*|*Type*|*Description*|
118
|identifier|String|Account Information Id|
119
|Token|String|Token Information|
120
121
*Response*:
122
<pre><code class="javascript">
123
{
124
  "a01":{
125
    "r":{
126
      "r":"130"
127
    },
128
    "cn":"logtoken"
129
  }
130
}
131
</code></pre>
132
The Method response is a *Long* which represents the _AccountId_ of the account logged. 
133
134
In case, the method encounter any error, the response is an exeception with specific parameters detailed below.
135
136
*Error*:
137
138
|*Error Code*|*Type*|*Value*|*Description*|
139
|FizCredentialInvalidException|Ex|3|Authentication Exception|
140
|FizAccountNotFoundException|Ex|1|Account does not exists|
141
|FizAccountNotFoundInSessionException|un|501|Session is invalid|
142
|FizApiInvalidParameterException|un|502|invalid token|
143
|FizApiModelDoesNotExistException|un|503|Object does not exists|
144
|FizApiModelRightException|un|504|Right exception to use this method|