## Overview This guide walks you through the minimal steps to run a fire simulation: connect, configure, ignite, and run. ## Connect to the server Call `/connectToServer` to get a `userToken`. Save it — every subsequent call requires it. ## Set an ignition point Call `/setPointIgnition` with your `userToken` and the grid coordinates (`xs`, `ys`) where the fire starts. ## Run the simulation Call `/runSimulation` with your `userToken` and the number of timesteps (`time`). The response is a list of burn events. **Example response:** ```json [ { "x": "100", "y": "100", "Operation": "BurnTeam", "time": "0.0" }, { "x": "101", "y": "100", "Operation": "BurnTeam", "time": "1.2" }, { "x": "100", "y": "101", "Operation": "BurnTeam", "time": "1.5" } ] ``` ## Query results Call `/computeBurnedArea` and `/getPerimeterCells` to inspect the outcome. **Shortcut: setMultiParameters** You can combine steps 2 and 3 into a single call with [`setMultiParameters`](/api-reference/setMultiParameters) — set ignition point, location, wind conditions, and cell size all at once. --- ## Full example #### Python ```python import requests BASE = "https://firesim.cs.gsu.edu/api" # 1. Connect and capture token user_token = requests.post(f"{BASE}/connectToServer").text # 2. Set ignition point requests.post(f"{BASE}/setPointIgnition/", params={"userToken": user_token, "xs": 100, "ys": 100}) # 3. Run simulation events = requests.post(f"{BASE}/runSimulation/", params={"userToken": user_token, "time": 100}).json() print(events[:3]) # 4. Query results area = requests.post(f"{BASE}/computeBurnedArea/", params={"userToken": user_token}).json() perimeter = requests.post(f"{BASE}/getPerimeterCells/", params={"userToken": user_token}).json() print(f"Burned area: {area}, Perimeter cells: {len(perimeter)}") ``` #### JavaScript ```js const BASE = "https://firesim.cs.gsu.edu/api"; // 1. Connect and capture token const userToken = await (await fetch(`${BASE}/connectToServer`, { method: "POST" })).text(); // 2. Set ignition point await fetch(`${BASE}/setPointIgnition/?userToken=${userToken}&xs=100&ys=100`, { method: "POST" }); // 3. Run simulation const events = await (await fetch(`${BASE}/runSimulation/?userToken=${userToken}&time=100`, { method: "POST" })).json(); console.log(events.slice(0, 3)); // 4. Query results const area = await (await fetch(`${BASE}/computeBurnedArea/?userToken=${userToken}`, { method: "POST" })).json(); const perimeter = await (await fetch(`${BASE}/getPerimeterCells/?userToken=${userToken}`, { method: "POST" })).json(); console.log(`Burned area: ${area}, Perimeter cells: ${perimeter.length}`); ``` #### cURL ```bash # 1. Connect and capture token USER_TOKEN=$(curl -s -X POST "https://firesim.cs.gsu.edu/api/connectToServer") # 2. Set ignition point curl -X POST "https://firesim.cs.gsu.edu/api/setPointIgnition/?userToken=$USER_TOKEN&xs=100&ys=100" # 3. Run simulation curl -X POST "https://firesim.cs.gsu.edu/api/runSimulation/?userToken=$USER_TOKEN&time=100" # 4. Query results curl -X POST "https://firesim.cs.gsu.edu/api/computeBurnedArea/?userToken=$USER_TOKEN" curl -X POST "https://firesim.cs.gsu.edu/api/getPerimeterCells/?userToken=$USER_TOKEN" ``` #### Java ```java HttpClient client = HttpClient.newHttpClient(); String base = "https://firesim.cs.gsu.edu/api"; // 1. Connect and capture token HttpResponse connectResp = client.send( HttpRequest.newBuilder().uri(URI.create(base + "/connectToServer")) .POST(HttpRequest.BodyPublishers.noBody()).build(), HttpResponse.BodyHandlers.ofString() ); String userToken = connectResp.body(); // 2. Set ignition point client.send( HttpRequest.newBuilder().uri(URI.create(base + "/setPointIgnition/?userToken=" + userToken + "&xs=100&ys=100")) .POST(HttpRequest.BodyPublishers.noBody()).build(), HttpResponse.BodyHandlers.ofString() ); // 3. Run simulation HttpResponse simResp = client.send( HttpRequest.newBuilder().uri(URI.create(base + "/runSimulation/?userToken=" + userToken + "&time=100")) .POST(HttpRequest.BodyPublishers.noBody()).build(), HttpResponse.BodyHandlers.ofString() ); System.out.println(simResp.body()); // 4. Query results HttpResponse areaResp = client.send( HttpRequest.newBuilder().uri(URI.create(base + "/computeBurnedArea/?userToken=" + userToken)) .POST(HttpRequest.BodyPublishers.noBody()).build(), HttpResponse.BodyHandlers.ofString() ); System.out.println("Burned area: " + areaResp.body()); ``` #### Go ```go import ( "fmt" "io" "net/http" "net/url" ) base := "https://firesim.cs.gsu.edu/api" // 1. Connect and capture token connectResp, _ := http.Post(base+"/connectToServer", "", nil) defer connectResp.Body.Close() tokenBytes, _ := io.ReadAll(connectResp.Body) userToken := string(tokenBytes) // 2. Set ignition point ignitionParams := url.Values{} ignitionParams.Set("userToken", userToken) ignitionParams.Set("xs", "100") ignitionParams.Set("ys", "100") http.PostForm(base+"/setPointIgnition/", ignitionParams) // 3. Run simulation simParams := url.Values{} simParams.Set("userToken", userToken) simParams.Set("time", "100") simResp, _ := http.PostForm(base+"/runSimulation/", simParams) defer simResp.Body.Close() simBody, _ := io.ReadAll(simResp.Body) fmt.Println(string(simBody)) // 4. Query results areaResp, _ := http.PostForm(base+"/computeBurnedArea/", url.Values{"userToken": {userToken}}) defer areaResp.Body.Close() areaBody, _ := io.ReadAll(areaResp.Body) perimeterResp, _ := http.PostForm(base+"/getPerimeterCells/", url.Values{"userToken": {userToken}}) defer perimeterResp.Body.Close() perimeterBody, _ := io.ReadAll(perimeterResp.Body) fmt.Printf("Burned area: %s, Perimeter cells: %s\n", areaBody, perimeterBody) ``` #### Rust ```rust use reqwest::blocking::Client; let base = "https://firesim.cs.gsu.edu/api"; let client = Client::new(); // 1. Connect and capture token let user_token = client.post(format!("{base}/connectToServer")).send().unwrap().text().unwrap(); // 2. Set ignition point client.post(format!("{base}/setPointIgnition/")) .query(&[("userToken", user_token.as_str()), ("xs", "100"), ("ys", "100")]) .send().unwrap(); // 3. Run simulation let events = client.post(format!("{base}/runSimulation/")) .query(&[("userToken", user_token.as_str()), ("time", "100")]) .send().unwrap().text().unwrap(); println!("{}", events); // 4. Query results let area = client.post(format!("{base}/computeBurnedArea/")) .query(&[("userToken", user_token.as_str())]) .send().unwrap().text().unwrap(); let perimeter = client.post(format!("{base}/getPerimeterCells/")) .query(&[("userToken", user_token.as_str())]) .send().unwrap().text().unwrap(); println!("Burned area: {}, Perimeter cells: {}", area, perimeter); ``` ## Next steps ### [Custom terrain](/api-reference/loadFuel) Upload your own fuel, slope, and aspect maps. ### [Dynamic ignition](/api-reference/setDynamicIgnition) Simulate moving burn teams along paths. ### [Step simulation](/api-reference/continueSimulation) Advance step-by-step to adjust wind or suppress cells mid-simulation. ### [Full API reference](/api-reference/connectToServer) All 27 endpoints with interactive playground.