# connectToServer **Endpoint:** `POST https://firesim.cs.gsu.edu/api/connectToServer` Creates a new simulation session and returns a `userToken` that must be passed to all subsequent API calls. Each simulation run requires a new token. ## Parameters | Name | Type | Required | Default | Description | |------|------|----------|---------|-------------| | `accept` | string | no | — | Requested response content type. | ## Responses ### HTTP 200 Session created successfully. Returns a plain-text `userToken` string (not JSON-wrapped). **Example:** ```json "abc123xyz" ``` ## Examples ### Python ```python import requests base_url: str = "https://firesim.cs.gsu.edu/api/connectToServer/" response = requests.post(base_url, data="testtest", headers={"accept": "application/json"}) print(response.text) ``` ### JavaScript ```javascript /** @type {string} */ const BASE_URL = "https://firesim.cs.gsu.edu/api/connectToServer/"; fetch(BASE_URL, { method: "POST", headers: { accept: "application/json" }, body: "testtest", }) .then(res => res.text()) .then(console.log); ``` ### cURL ```bash BASE_URL="https://firesim.cs.gsu.edu/api/connectToServer/" curl -s -X POST \ -H "accept: application/json" \ -d "testtest" \ "$BASE_URL" ``` ### Java ```java import java.net.URI; import java.net.http.*; String BASE_URL = "https://firesim.cs.gsu.edu/api/connectToServer/"; HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(BASE_URL)) .header("accept", "application/json") .POST(HttpRequest.BodyPublishers.ofString("testtest")) .build(); HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); ``` ### Go ```go import ( "fmt" "io" "net/http" "strings" ) baseURL := "https://firesim.cs.gsu.edu/api/connectToServer/" req, _ := http.NewRequest("POST", baseURL, strings.NewReader("testtest")) req.Header.Set("accept", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() body, _ := io.ReadAll(resp.Body) fmt.Println(string(body)) ``` ### Rust ```rust use reqwest::blocking::Client; let base_url = "https://firesim.cs.gsu.edu/api/connectToServer/"; let client = Client::new(); let response = client .post(base_url) .header("accept", "application/json") .body("testtest") .send().unwrap(); println!("{}", response.text().unwrap()); ```