Scripts for authenticating and processing data from the iRacing Web API
You will need an iRacing client_id and client_secret the means of obtaining one is outlined in this iRacing forum thread.
Prior to anything run ./auth.sh from the root of the project with a .env file containing the following
IRACING_USERNAME=IRACING_USERNAME_GOES_HERE
IRACING_PASSWORD=IRACING_PASSWORD_GOES_HERE
IRACING_CLIENT_ID=IRACING_CLIENT_ID_GOES_HERE
IRACING_CLIENT_SECRET=IRACING_CLIENT_SECRET_GOES_HERE
This will then create token.json in the root of the project for the current authentication session by which all other API requests require.
Following authentication the first script to be run is /search-series/main.go at time of writing this will require all permutations of season_quarter, season_year and cust_id parameters to be set as an object within /search-series/customer-id-season-quarter-season-year-mappings.json. This will create the input file(s) that depending on how they are being used will need to be merged or used individually within /subsession/main.go.
Following runs of /search-series/main.go for all season_quarter, season_year and cust_id permutations next we will be using the output file(s) and using them as the input file for /subsession/main.go, the file output here will be used within this folder and should ultimately be a 1 dimensional array of Subsessions and saved as 1-subsessions-output.json in the aforementioned folder which means you will need to merge the outputs together likely through copy pasting and making sure the array is 1 dimensional.
Following runs of /search-series/main.go for all season_quarter, season_year and cust_id permutations next we will be using the output file(s) and using them as the input file for /past-seasons/main.go as each result in the files has the series_id for each series participated in, these series_id values are to be gathered running /utils/distinct-ids/main.go for all subsessions exported and then saved within /past-seasons as distinct-series-ids-output.json, the output of this will ultimately go within this folder saved as it is outputted named past-seasons-output.json.
Following runs of /search-series/main.go for all season_quarter, season_year and cust_id permutations next will be using the output file(s) and using them to generate input file for /standings-jake/main.go (for the iRacing account that the client_id and client_secret were generated) or /standings-other/main.go (for any other driver whose data is being exported) respectively. To do this place the respective CUST_ID_GOES_HERE-search-series-output.json file in the generate-standings-input folder, then run the respective main.go script this will then create ~CUST_ID_GOES_HERE~standings-input.json (which will need to be renamed to just standings-input.json for use within standings-jake/main.go), then you can run the respective standings script, the file output from these will be used within this folder and should ultimately be a 1 dimensional array of Subsessions and saved as standings-output.json in the aforementioned folder which means you will need to merge the outputs together likely through copy pasting and making sure the array is 1 dimensional.
Use the response from this location (/data/carclass/get). Place it as car-classes.json within this folder.
This can be accessed easiest by logging into the iRacing /data API via this link and then using the link provided above.
COMING SOON