Extract real API calls from browser traffic and generate C# or JMeter tests—with optional AI-powered filtering.
STAF API Extractor is a Windows desktop application that reads HTTP Archive (HAR) files, filters out noise (analytics, tracking, static assets), and produces ready-to-use C# API test code or Apache JMeter test plans. An optional AI analysis step helps identify which requests are essential for your API testing workflow.
Keywords: HAR · HTTP Archive · API extractor · API testing · REST API · browser traffic · C# · .NET · HttpClient · JMeter · load testing · test automation · test code generation · Chrome DevTools · Firefox · Edge · network capture · Bearer token · authentication · Windows · STAF
- Features
- Requirements
- Quick Start
- How to Capture a HAR File
- Using the Application
- Output Formats
- Authentication
- Troubleshooting
- Support
- Author
- License
| Feature | Description |
|---|---|
| HAR import | Load standard HAR (HTTP Archive) files exported from Chrome, Edge, or Firefox. |
| Smart filtering | Keeps only real API calls; excludes documentation, analytics, tracking, and ads. |
| AI analysis (optional) | Use an LLM to identify which HAR requests are essential for API testing. |
| C# test generation | Generate C# sample code using HttpClient with headers, body, and optional Bearer token. |
| JMeter test plans | Generate JMeter 5.x–compatible .jmx files (single user, flow order, headers/cookies/body). |
| Auth detection | Detects Authorization and API-key headers and surfaces hints for generated tests. |
| Header filtering | Retains only API-relevant headers (e.g. Authorization, Content-Type, Accept, X-*). |
- OS: Windows 10 or later
- .NET: The application runs as a standalone executable; ensure any required .NET runtime (if not self-contained) is installed.
- HAR file: Captured from a supported browser (Chrome, Edge, or Firefox).
- AI analysis (optional): API key and endpoint for your chosen LLM provider when using AI filtering.
- Capture traffic in your browser and save as a HAR file (see How to Capture a HAR File).
- Run
STAF.APIExtractor.exe. - Load your HAR file via the application’s file/open option.
- Review the list of extracted API entries. Use AI analysis (if configured) to reduce the set to essential requests.
- Choose output: generate C# test code or a JMeter test plan and save to your desired location.
- Open DevTools:
F12or Right-click → Inspect. - Go to the Network tab.
- Optionally enable Preserve log.
- Perform the actions that trigger the API calls you care about.
- Right-click in the request list → Save all as HAR with content.
- Open DevTools:
F12or Ctrl+Shift+I. - Open the Network tab.
- Reproduce the API flow.
- Right-click in the list → Save All As HAR.
Save the file with a .har extension. Use this file in STAF API Extractor.
- Use File → Open (or the equivalent control) and select your
.harfile. - The tool parses the HAR and shows only real API requests (REST/JSON, etc.), in the order they occurred.
- The initial list is already filtered to exclude common non-API traffic.
- If AI analysis is enabled and configured (provider, API key, endpoint), you can run it to further reduce the list to requests that are essential for API testing.
- Progress and status are shown in the UI.
- C#: Choose to generate C# test code. You can set options such as namespace and whether to include a Bearer token placeholder. Save the generated
.csfile. - JMeter: Choose to generate a JMeter test plan. You can optionally set a Bearer token for the plan. Save the generated
.jmxfile and open it in Apache JMeter.
- Only headers relevant for API testing are kept (e.g.
Authorization,Content-Type,Accept, andX-*headers). - Detected auth (e.g. Bearer, API key) is used to add hints or placeholders in the generated C# or JMeter output; replace placeholders with your own tokens as needed.
- Uses
HttpClientwith method, URL, query string, headers, and body. - Optional Bearer token and namespace/config options.
- Suitable for integration into C# test projects (e.g. NUnit, xUnit, MSTest).
- JMeter 5.x compatible.
- Single thread, requests in flow order.
- Includes headers, cookies, and request body where present.
- Optional Bearer token can be set in options or later in JMeter.
- Detection: The tool scans request headers and detects common auth (Bearer, API keys, etc.) and adds hints in comments or placeholders.
- Secrets: Never commit real tokens. Use placeholders, environment variables, or secret managers in your tests.
- Bearer in JMeter: You can set a Bearer token in the generator options or configure it in JMeter (e.g. HTTP Header Manager).
| Issue | Suggestion |
|---|---|
| No requests after loading HAR | Ensure the HAR was captured while performing actions that call your API; avoid saving an empty or pre-load-only session. |
| Missing APIs in the list | The filter keeps “real” API calls (e.g. JSON/REST). If your API uses an unusual path or content type, it might be excluded; check the HAR in DevTools to confirm the requests are present. |
| AI analysis not working | Verify API key, endpoint, and network access for your LLM provider. Check any error message shown in the UI. |
| Generated C# doesn’t compile | Ensure your project targets a compatible .NET version and has the same HttpClient usage (e.g. using System.Net.Http). |
| JMeter plan fails or skips requests | Open the .jmx in JMeter and check HTTP Request samplers, domain, and headers (e.g. Base URL, Auth). |
- Source / issues: STAF.APIExtractor
- For bugs or feature requests, please open an issue in the repository above.
Sooraj Ramachandran
This project is licensed under the MIT License.
Copyright (c) Sooraj Ramachandran
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
| File | Purpose |
|---|---|
STAF.APIExtractor.exe |
Main application. Double-click to run. |
STAF.APIExtractor.pdb |
Debug symbols (optional; not required for normal use). |
STAF.APIExtractor.xml |
IntelliSense/documentation for the assembly (optional). |
STAF API Extractor — from browser HAR to C# and JMeter tests.
© Sooraj Ramachandran. MIT License.