Skip to main content Link Search Menu Expand Document (external link) Copy Copied

Using the Web API

Table of contents
  1. .NET 6.0
  2. TypeScript/JavaScript
  3. Python3

Raid Toolkit provides a web-accessible API that can be used both from the browser as well as from various other scripting languages. By default it is available on the local loopback interface on port 9090: wss://localhost:9090.

Any applications accessing RTK must run on the same computer as RTK. Cross-network access is not a supported scenario.

.NET 6.0

  1. Install the latest Raid.Client package from nuget:

     dotnet add package Raid.Client
    
  2. Use the Raid.Client.RaidToolkitClient class to connect to the RTK process:

     RaidToolkitClient client = new();
     try
     {
         // connect to the RTK process
         client.Connect();
         // fetch the known user account information
         var accounts = await client.AccountApi.GetAccounts();
         // dump the first account in RaidExtractor format
         AccountDump dump = await client.AccountApi.GetAccountDump(accounts[0].Id);
         // ...
     }
     catch (Exception ex)
     {
         Console.WriteLine($"An error occurred: {ex.Message}");
     }
     finally
     {
         // make sure to disconnect when you're done!
         client.Disconnect();
     }
    

TypeScript/JavaScript

  1. Install Raid.Client nuget package:

    NPM:

     npm install @raid-toolkit/webclient
    

    Yarn v1:

     yarn add @raid-toolkit/webclient
    
  2. Use the useRaidToolkitApi method to construct the API you wish to use:

     import { useRaidToolkitApi, IAccountApi } from '@raid-toolkit/webclient';
    
     const api = useRaidToolkitApi(IAccountApi);
     const account = (await api.getAccounts())[0];
     let accountDump = await api.getAccountDump(account.id);
    

Python3

  1. Install the raidtoolkit package:

     pip3 install raidtoolkit
    
  2. Use the RaidToolkitClient class to connect to the RTK process:

     import asyncio
     from raidtoolkit import RaidToolkitClient
    
     async def main():
         client = RaidToolkitClient()
         client.connect()
         accounts = await client.AccountApi.get_accounts()
         print(accounts)
         account = await client.AccountApi.get_account_dump(accounts[0]["id"])
         print(account)
         client.close()
    
     if __name__ == "__main__":
         asyncio.run(main())