GET https://devs.ouya.tv/api/v1/themes
[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 Usage
13 =====
14
15 #. After logging with an existing account
16 #. After new user registration
17
18
19 HTTP request
20 ============
21 Protocol
22   ``https``
23 Method
24   ``GET``
25 Host
26   ``devs.ouya.tv``
27 Path
28   ``/api/v1/sessions``
29 Headers
30   ``Accept-Encoding``
31   ``User-Agent``
32   ``X-OUYA-Console-Id``
33   ``X-OUYA-Device``
34
35   ``Content-Type``
36     ``application/x-www-form-urlencoded``
37 POST parameters
38   ``username``
39     User name used to log in
40   ``password``
41     User password
42
43 HTTP response
44 =============
45
46 Success
47 -------
48 When the user logged in successfully.
49
50 Status code
51   ``200 OK`` 
52 Content type
53   ``application/json; charset=utf-8``
54
55 Response body example:
56
57 .. include:: api-v1-sessions-response-valid.json
58    :code:
59
60
61 Invalid login data
62 ------------------
63 When the login data are invalid.
64
65 Also seen when the data were not available yet (e.g. user freshly registered)
66 but the processes on the server were not finished yet.
67 The OUYA simply tried the request a second time.
68
69 Status code
70   ``400 Bad Request``
71 Content type
72   ``application/json; charset=utf-8``
73
74 Response body example:
75
76 .. include:: api-v1-sessions-response-invalid.json
77    :code: