API

Simresults.net offers a simple way to show your results without uploading.

Requirements

  • Webserver
  • Log files
  • Basic programming knowledge


How

Create a JSON file/output on your server that is dynamically generated with your logs:

             {
              "name": "[YOUR LEAGUE NAME]",
              "results": [
                {
                  "name": "Example multiple result files",
                  "log": [
                    "https://YOUR.WEBSEVER/server_output.txt",
                    "https://YOUR.WEBSEVER/server_output2.txt"
                  ]
                },
                {
                  "name": "Example single result file",
                  "log": "https://YOUR.WEBSEVER/server_output3.txt"
                }
              ]
             }
            

The log files must have a valid HTTP(S) path on your webserver.

An example file is located here:
https://simresults.net/example.json

Next just add the results URL to the simresults.net/remote URL as query param `results=`:
simresults.net/remote?results=https://simresults.net/example.json

Simresults.net will load the first result it will find and let the user choose any other result from the dropdown.

You can also just show one result (without a dropdown for others) using `result=`:
simresults.net/remote?result=https://simresults.net/example_result1.xml


Customize

You can use the same customize settings as this website uses.

An example file with a config per results group is located here:
https://simresults.net/example.config.json

An example file with a global config for all result groups is located here:
https://simresults.net/example.global.config.json

To see which values to use, upload a result on this website and look at the Customize tab to see what values to fill in.

             ....
              "config": {
                "logo": "",
                "logo_link": "",
                "league": "",
                "league_link": "",
                "event": "",
                "event_link": "",
                "hide_sessions": "",
                "q_points": "",
                "q_points_by_class": "",
                "points": "",
                "points_by_class": "",
                "best_lap_points": "",
                "led_most_points": "",
                "laps_points_number": "",
                "laps_points": "",
                "stopgo_lose_points": "",
                "drivethrough_lose_points": "",
                "dnf_lose_points": "",
                "dq_lose_points": "",
                "dnf_no_points": "0",
                "dnf_ignore_losing_points": "",
                "no_indexing": "0",
                "shorten_lastnames": "1",
                "shorten_firstnames": "0",
                "team": "0",
                "hide_aids": "0"
              }
             ...
            

Cache

This website caches results to prevent unnecessary parsing. To invalidate cache add an additional query parameter. For example `&version=2`:
simresults.net/remote?results=https://simresults.net/example.json&version=2

Please do not include random values such as current timestamps. Only invalidate when needed. A random value per day is ok.


Recommendations

Please consider disabling cache for the json and log files on your server. This ensures no server in the middle will cache your files.

Example for an apache2 .htaccess file:

              <FilesMatch "\.(json|txt|xml|log)$">

              <IfModule mod_expires.c>
                ExpiresActive Off
              </IfModule>
              <IfModule mod_headers.c>
                FileETag None
                Header unset ETag
                Header unset Pragma
                Header unset Cache-Control
                Header unset Last-Modified
                Header set Pragma "no-cache"
                Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
                Header set Expires "Mon, 10 Apr 1972 00:00:00 GMT"
              </IfModule>
            </FilesMatch>
            

Sponsoring

If you would like to use the api without ads, consider sponsoring the project.