.. 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
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
============
--- /dev/null
+===================
+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)
--- /dev/null
+{
+ "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": []
+ }
+ }
+ }
+ }
+}
--- /dev/null
+{
+ "sid": "dummy",
+ "time": "1680109254000",
+ "body": {
+ "status":"CONNECTION_IN_PROGRESS",
+ "registrationCode": "abcdefg"
+ }
+}
``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
--- /dev/null
+{
+ "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",
+ "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
+ }
+ }
+}
--- /dev/null
+=========================================================================
+``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()``
=========================
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``