# loadWindFlow **Endpoint:** `POST https://firesim.cs.gsu.edu/api/loadWindFlow` Upload a wind-flow schedule file for dynamically changing wind conditions. **File format** (matches [SIMS sample weather_artificial.txt](https://sims.cs.gsu.edu/sims/research/DEVSFIREAPI/weather_artificial.txt)): ```text ncols 5 nrows 13 Hour Min Temp wspd Dir 0 0 0 5.6 67 ... ``` - Line 1: `ncols N` — number of columns - Line 2: `nrows N` — number of data rows - Line 3: column headers (space-separated) - Line 4+: space-separated rows: hour, minute, temperature, windSpeed, windDirection Send as `text/plain` body with a `fileName` header. ## Parameters | Name | Type | Required | Default | Description | |------|------|----------|---------|-------------| | `userToken` | string | yes | — | Your simulation token. | | `fileName` | string | yes | — | Name of the uploaded file, echoed back by the server. | ## Responses ### HTTP 200 Wind flow file loaded successfully Observed: Load: valid minimal. Use the SIMS weather file format (`ncols` / `nrows` header lines). See operation description. Observed: Load: valid minimal. Use the SIMS weather file format (`ncols` / `nrows` header lines). See operation description. **Example:** ```json "Updated Wind Flow Model" ``` ### HTTP 400 Bad request. Observed when: empty body. **Example:** ```json "" ``` ### HTTP 500 Internal server error (Spring JSON). Returned when `userToken` is missing or invalid, or when the uploaded file is malformed. **Example:** ```json { "timestamp": "2026-05-20T16:42:20.430+00:00", "status": 500, "error": "Internal Server Error", "path": "/api/loadWindFlow" } ``` ## Examples ### Python ```python import requests base_url: str = "https://firesim.cs.gsu.edu/api/loadWindFlow/" response = requests.post( base_url, params={"userToken": "abc123xyz"}, files={"file": open("weather_artificial.txt", "rb")}, headers={"fileName": "weather_artificial.txt"}, ) print(response.text) ``` ### JavaScript ```javascript /** @type {string} */ const BASE_URL = "https://firesim.cs.gsu.edu/api/loadWindFlow/"; // Node.js: const fs = require("fs"); const fileData = fs.readFileSync("weather_artificial.txt"); // Browser: use a File/Blob object for fileData fetch(`${BASE_URL}?userToken=abc123xyz`, { method: "POST", headers: { "Content-Type": "text/plain", "fileName": "weather_artificial.txt", }, body: fileData, }) .then(res => res.text()) .then(console.log); ``` ### cURL ```bash BASE_URL="https://firesim.cs.gsu.edu/api/loadWindFlow/" curl -s -X POST \ -H "Content-Type: text/plain" \ -H "fileName: weather_artificial.txt" \ --data-binary @"weather_artificial.txt" \ "${BASE_URL}?userToken=abc123xyz" ``` ### Java ```java import java.net.URI; import java.net.http.*; import java.nio.file.Path; String BASE_URL = "https://firesim.cs.gsu.edu/api/loadWindFlow/"; String url = BASE_URL + "?userToken=abc123xyz"; Path path = Path.of("weather_artificial.txt"); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(url)) .header("Content-Type", "text/plain") .header("fileName", "weather_artificial.txt") .POST(HttpRequest.BodyPublishers.ofFile(path)) .build(); HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); ``` ### Go ```go import ( "fmt" "io" "net/http" "os" ) baseURL := "https://firesim.cs.gsu.edu/api/loadWindFlow/" f, _ := os.Open("weather_artificial.txt") defer f.Close() req, _ := http.NewRequest("POST", baseURL+"?userToken=abc123xyz", f) req.Header.Set("Content-Type", "text/plain") req.Header.Set("fileName", "weather_artificial.txt") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() body, _ := io.ReadAll(resp.Body) fmt.Println(string(body)) ``` ### Rust ```rust use reqwest::blocking::Client; use std::fs; let base_url = "https://firesim.cs.gsu.edu/api/loadWindFlow/"; let file_bytes = fs::read("weather_artificial.txt").unwrap(); let client = Client::new(); let response = client .post(format!("{}?userToken={}", base_url, "abc123xyz")) .header("Content-Type", "text/plain") .header("fileName", "weather_artificial.txt") .body(file_bytes) .send().unwrap(); println!("{}", response.text().unwrap()); ```