# loadSlope **Endpoint:** `POST https://firesim.cs.gsu.edu/api/loadSlope` Upload a custom slope map from a space- or tab-separated .txt file. Sent as a raw `text/plain` body with a `fileName` header. Also updates `cellResolution` from the file's `cellsize` field if present. **File format:** space- or tab-separated grid of double-precision slope values (percent), one row per line. Must match the dimensions of any uploaded fuel or aspect map. ## 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 Slope map loaded successfully. **Example:** ```json "Slope Map Updated" ``` ### 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:18.015+00:00", "status": 500, "error": "Internal Server Error", "path": "/api/loadSlope" } ``` ## Examples ### Python ```python import requests base_url: str = "https://firesim.cs.gsu.edu/api/loadSlope/" response = requests.post( base_url, params={"userToken": "abc123xyz"}, files={"file": open("slope.txt", "rb")}, headers={"fileName": "slope.txt"}, ) print(response.text) ``` ### JavaScript ```javascript /** @type {string} */ const BASE_URL = "https://firesim.cs.gsu.edu/api/loadSlope/"; // Node.js: const fs = require("fs"); const fileData = fs.readFileSync("slope.txt"); // Browser: use a File/Blob object for fileData fetch(`${BASE_URL}?userToken=abc123xyz`, { method: "POST", headers: { "Content-Type": "text/plain", "fileName": "slope.txt", }, body: fileData, }) .then(res => res.text()) .then(console.log); ``` ### cURL ```bash BASE_URL="https://firesim.cs.gsu.edu/api/loadSlope/" curl -s -X POST \ -H "Content-Type: text/plain" \ -H "fileName: slope.txt" \ --data-binary @"slope.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/loadSlope/"; String url = BASE_URL + "?userToken=abc123xyz"; Path path = Path.of("slope.txt"); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(url)) .header("Content-Type", "text/plain") .header("fileName", "slope.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/loadSlope/" f, _ := os.Open("slope.txt") defer f.Close() req, _ := http.NewRequest("POST", baseURL+"?userToken=abc123xyz", f) req.Header.Set("Content-Type", "text/plain") req.Header.Set("fileName", "slope.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/loadSlope/"; let file_bytes = fs::read("slope.txt").unwrap(); let client = Client::new(); let response = client .post(format!("{}?userToken={}", base_url, "abc123xyz")) .header("Content-Type", "text/plain") .header("fileName", "slope.txt") .body(file_bytes) .send().unwrap(); println!("{}", response.text().unwrap()); ```