More work on 204 and profile
authorChristian Weiske <[email protected]>
Sun, 2 Apr 2023 10:55:21 +0000 (12:55 +0200)
committerChristian Weiske <[email protected]>
Sun, 2 Apr 2023 10:55:21 +0000 (12:55 +0200)
README.rst
api/connectcheck.gamestickservices.net/generate_204.rst
api/data.rst [new file with mode: 0644]
api/l2.gamestickservices.net/api-rest-connect-stick-stick-xxx-view.json.response-registered.json [new file with mode: 0644]
api/l2.gamestickservices.net/api-rest-connect-stick-stick-xxx-view.json.response-unregistered.json [new file with mode: 0644]
api/l2.gamestickservices.net/api-rest-connect-stick-stick-xxx-view.json.rst
api/l2.gamestickservices.net/api-rest-player-profile-view.json.response-full.json [new file with mode: 0644]
api/l2.gamestickservices.net/api-rest-player-profile-view.json.rst [new file with mode: 0644]
api/ping.rst

index 1ba99e6a8cf6c049ab2da30da9dd30cb8769b9d8..aea77c0306d7e9c90e4501362d0837594ec8539c 100644 (file)
@@ -8,7 +8,9 @@ gaming console.
 .. contents::
    :depth: 1
 
+.. include:: api/data.rst
 .. include:: api/ping.rst
 .. include:: api/connectcheck.gamestickservices.net/generate_204.rst
 .. include:: api/l2.gamestickservices.net/api-rest-connect-stick-stick-xxx-view.json.rst
+.. include:: api/l2.gamestickservices.net/api-rest-player-profile-view.json.rst
 .. include:: api/update.gamestickservices.net/check.php.rst
index c488aeed4eee42ad1092110bad5494df0bbc365d..968987fbed463933934eb9f0a9c6a56c6e0cddde 100644 (file)
@@ -4,6 +4,12 @@
 
 Network availability ping via HTTP.
 
+Firmware 2071 resolves the IP address for the hostname and
+sends the HTTP request directly to the IP address without providing
+a ``Host`` header.
+
+At least firmware 0.0.53 sends the host name in the request.
+
 
 HTTP request
 ============
diff --git a/api/data.rst b/api/data.rst
new file mode 100644 (file)
index 0000000..f0bf21d
--- /dev/null
@@ -0,0 +1,10 @@
+===================
+Common data formats
+===================
+
+JSON responses share some properties.
+
+``date``
+  Dates have format ``dd/MM/yyyy`` - e.g. 23/12/2013.
+``time``
+  Time since 01.01.1970 in milliseconds (unix timestamp * 1000)
diff --git a/api/l2.gamestickservices.net/api-rest-connect-stick-stick-xxx-view.json.response-registered.json b/api/l2.gamestickservices.net/api-rest-connect-stick-stick-xxx-view.json.response-registered.json
new file mode 100644 (file)
index 0000000..1223225
--- /dev/null
@@ -0,0 +1,29 @@
+{
+    "sid":"dummy",
+    "time":"1680109254000",
+
+    "lastaccessed": 1385115865500,
+    "x-forwarded-for": null,
+    "created": 1385115865500,
+    "accessCount": 0,
+    "addr": "10.37.137.31",
+    "remoteaddr": "135.196.28.241",
+
+    "body": {
+        "status":"CONNECTED",
+        "config": {
+            "apps": [
+            ],
+            "global": {
+                "uitranslation": {
+                    "country": [
+                    ],
+                    "version": 0
+                },
+                "newfeatured": {
+                    "ages": []
+                }
+            }
+        }
+    }
+}
diff --git a/api/l2.gamestickservices.net/api-rest-connect-stick-stick-xxx-view.json.response-unregistered.json b/api/l2.gamestickservices.net/api-rest-connect-stick-stick-xxx-view.json.response-unregistered.json
new file mode 100644 (file)
index 0000000..032f8e9
--- /dev/null
@@ -0,0 +1,8 @@
+{
+    "sid": "dummy",
+    "time": "1680109254000",
+    "body": {
+        "status":"CONNECTION_IN_PROGRESS",
+        "registrationCode": "abcdefg"
+    }
+}
index d9979989aca34b329216c41cd927a0c9b5abc2a9..810666454b6d4f7ec648964ce36b79fda8cf6b80 100644 (file)
@@ -2,36 +2,79 @@
 ``POST l2.gamestickservices.net/api/rest/connect/stick/stick/xxx/view.json``
 ============================================================================
 
-Connection check
+Used for several things:
+
+1. Network connection check
+2. Fetch registration code and session ID for this gamestick.
+3. Fetch information about games and their display in the main menu
 
 
 HTTP request
 ============
+When the GameStick is not registered yet, then this URL is fetched
+every 5 seconds.
+Once registered, it is fetched every 2 minutes.
+
+Method
+  ``POST``
+
+  Firmware 0.0.53 uses ``GET``.
+
+  ``DatabaseService.ServiceCore`` can be put into GET mode in Firmware 2071,
+  in that case, GET will be used as well.
 Protocol
   ``http``
 Host
   ``l2.gamestickservices.net``
+
+  Firmware 0.0.53 uses ``db.gamestickservices.net``.
 Path
   ``/api/rest/connect/stick/stick/xxx/view.json``
 
   ``xxx``
     Hardware-ID, e.g. ``ac:db:da:09:18:5c``
+
+  ``;jsessionid=yyy``
+    In GET mode
 POST parameters
   None
+Cookies
+  ``JSESSIONID``
+    Session ID, only when available (not empty)
+
+    In POST mode only
+  ``AWSELB``
+    When available
+
+    In POST mode only.
 
 
 HTTP response
 =============
+When used for connection check, the response must contain
+one of the following strings (no whitespace after ``:``)::
+
+  "status":"CONNECTION_IN_PROGRESS"
+  "status":"CONNECTED"
+
 
-Connection check ok
--------------------
+Not registered yet - ``CONNECTION_IN_PROGRESS``
+-----------------------------------------------
 Status code
-  ``200 OK``
+   ``200 OK``
 
-Connection check requires the response to contain one of the following strings::
+.. include:: api-rest-connect-stick-stick-xxx-view.json.response-unregistered.json
+   :code:
+
+
+Registration complete - ``CONNECTED``
+-------------------------------------
+Status code
+   ``200 OK``
+
+.. include:: api-rest-connect-stick-stick-xxx-view.json.response-registered.json
+   :code:
 
-  "status":"CONNECTION_IN_PROGRESS"
-  "status":"CONNECTED"
 
 
 Usage
diff --git a/api/l2.gamestickservices.net/api-rest-player-profile-view.json.response-full.json b/api/l2.gamestickservices.net/api-rest-player-profile-view.json.response-full.json
new file mode 100644 (file)
index 0000000..cebd8ad
--- /dev/null
@@ -0,0 +1,33 @@
+{
+    "sid": "sessionid",
+    "time": "1680109254000",
+    "body": {
+        "avatarLargeUrl": "http://example.org/avatar.png",
+        "gamertag": "cweiske",
+        "avatarSmallUrl": "http://example.org/avatar.png",
+        "location": "Somewhere",
+        "dateOfBirth": "23/12/1942",
+        "dateJoined": "23/12/2013",
+        "email": "[email protected]",
+        "password": "mypassword",
+        "accountType": "FIXME",
+        "minAge": 17,
+        "founderFlag": 1,
+        "founderName": "cweiske-kickstarter",
+        "minAgeLabel": "17+",
+        "securityLevel": 0,
+        "balance": {
+            "amountOfMoneyLeft": "not much",
+            "transactions": [
+                {
+                    "date": "23/12/2024 - buy a game",
+                    "amount": "23.42"
+                }
+            ]
+        },
+        "achievementStatus": {
+            "lastAchievementGameName": "Some Game",
+            "numberOfAchievementsUnlocked": 23
+        }
+    }
+}
diff --git a/api/l2.gamestickservices.net/api-rest-player-profile-view.json.rst b/api/l2.gamestickservices.net/api-rest-player-profile-view.json.rst
new file mode 100644 (file)
index 0000000..070f5af
--- /dev/null
@@ -0,0 +1,58 @@
+=========================================================================
+``GET http://l2.gamestickservices.net/api/rest/player/profile/view.json``
+=========================================================================
+
+Fetch player information.
+
+In firmware v2071 OOBE setup will not finish when the profile is not returned
+properly.
+
+
+HTTP request
+============
+Protocol
+  ``http``
+Host
+  ``l2.gamestickservices.net``
+Path
+  ``/api/rest/player/profile/view.json;jsessionid=xxx``
+
+  ``xxx``
+    Session ID from the registration check
+    ``api/rest/connect/stick/stick/xxx/view.json``.
+
+    Empty when not registered yet.
+
+
+HTTP response
+=============
+
+Not registered yet
+------------------
+Status code
+  ``200 OK``
+
+FIXME
+
+
+User has been registered
+------------------------
+Property notes:
+
+``body.securityLevel``
+  Known values:
+
+  - ``0``: default
+``body.balance.transactions[].date``
+  Must contain the string " - " (space dash space).
+  Before: date, after: description
+
+
+.. include:: api-rest-player-profile-view.json.response-full.json
+   :code:
+
+
+
+Usage
+=====
+- ``com.playjam.Services.Database.ServiceCore#downloadProfile()``
index e1b63ed2fddca3291171ce6a24199bef8a98e4e3..a2d13653d6f47750a971b4a8bb4f7569510fb6a6 100644 (file)
@@ -3,7 +3,7 @@
 =========================
 
 The connection check in ``com.playjam.gamestick.WifiTools.ChecksFragment#ping``
-sends ``ping`` requests to three domains to see if the network is available:
+sends ICMP ``ping`` requests to three domains to see if the network is available:
 
 - ``connectcheck.gamestickservices.net``
 - ``l2.gamestickservices.net``