POST https://devs.ouya.tv/api/v1/sessions
[ouya-store-api.git] / api / devs.ouya.tv / api-v1-sessions.rst
1 =============================================
2 ``POST https://devs.ouya.tv/api/v1/sessions``
3 =============================================
4
5 Log in and obtain a session token.
6
7 This token is stored in the console and used in the
8 ``X-OUYA-AuthToken`` and ``X-Token`` headers as well as the
9 ``auth_token`` GET parameter.
10
11
12 HTTP request
13 ============
14 Protocol
15   ``https``
16 Method
17   ``GET``
18 Host
19   ``devs.ouya.tv``
20 Path
21   ``/api/v1/sessions``
22 Headers
23   ``Accept-Encoding``
24   ``User-Agent``
25   ``X-OUYA-Console-Id``
26   ``X-OUYA-Device``
27
28   ``Content-Type``
29     ``application/x-www-form-urlencoded``
30 POST parameters
31   ``username``
32     User name used to log in
33   ``password``
34     User password
35
36 HTTP response
37 =============
38
39 Success
40 -------
41 When the user logged in successfully.
42
43 Status code
44   ``200 OK`` 
45 Content type
46   ``application/json; charset=utf-8``
47
48 Response body example:
49
50 .. include:: api-v1-sessions-response-valid.json
51    :code:
52
53
54 Invalid login data
55 ------------------
56 When the login data are invalid.
57
58 Also seen when the data were not available yet (e.g. user freshly registered)
59 but the processes on the server were not finished yet.
60 The OUYA simply tried the request a second time.
61
62 Status code
63   ``400 Bad Request``
64 Content type
65   ``application/json; charset=utf-8``
66
67 Response body example:
68
69 .. include:: api-v1-sessions-response-invalid.json
70    :code: