API

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

Requirements

  • Webserver or FTP server
  • 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) or FTP path on your server.

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

The (required) url encoded version is:
https%3A%2F%2Fsimresults.net%2Fexample.json

Next just add the encoded results URL to the simresults.net/remote URL as query param `results=`:
simresults.net/remote?results=https%3A%2F%2Fsimresults.net%2Fexample.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 show one result (without a dropdown for others) using `result=` (singular word) with a direct result file from your sim (so no simresults json format):
simresults.net/remote?result=https%3A%2F%2Fsimresults.net%2Fexample_result1.xml

When FTP is preferred. Your provided URL in the examples above could look like this:
ftp://YOUR.USER:YOUR.PASSWORD@YOUR.FTPSERVER/log.json
Please note that this URL login will be public to the world.

Make sure you urlencode the url after `results=` or `result=`. Most programming languages have an urlencode method for this. An other option is using an online url encoder which you will find through google.


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

An example file with a merge config (using global and overriding/merging with result group config) is located here:
https://simresults.net/example.merge.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": "",
                "hide_drivers": "",
                "q_points": "",
                "q_points_by_class": "",
                "points": "",
                "points_by_class": "",
                "best_lap_points": "",
                "led_most_points": "",
                "laps_led_points_number": "",
                "laps_led_points": "",
                "every_lap_led_points_number": "",
                "every_lap_led_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",
                "show_driver_ids": "",
                "team": "0",
                "hide_aids": "0"

              }
             ...
            

Cache

This website caches results to prevent unnecessary parsing. To invalidate cache add an additional query parameter to your own result path or simresults url.

Example your results file:
https://simresults.net/example.json?version=2

Example after the remote results file param:
simresults.net/remote?results=https%3A%2F%2Fsimresults.net%2Fexample.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.