Create a Client Session
Creating a client session
Active login period for a user in WebEOC Nexus, visible to administrators who can view and terminate sessions through Sessions Manager. involves use of the login endpoint.
| Description | Creates a client session; if a client is logged in, they can make subsequent calls to the REST service |
|---|---|
| URL | /sessions |
| Method | POST |
| Parameters |
|
Review the parameter definitions and examples of how to use the login endpoint in JavaScript and C# calls.
Parameters
| Variable Name | Type | Description | Required |
|---|---|---|---|
| username | String | Username of the WebEOC Nexus user | True |
| password | String | Password for the user specified | True |
| position | String |
WebEOC Nexus position the user will fill while performing subsequent operations |
False |
| incident | String | WebEOC Nexus incident with which subsequent operations will be associated | False |
Examples
JavaScript Call
Copy Code
var creds = {
'username': 'webeoc administrator',
'password': 'x',
'position': 'CMD EOC Director',
'incident': 'Incident Name'
};
await fetch(`${baseUrl}/sessions`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(creds)
})
C# Call
Copy Code
public async Task Login()
{
using (var httpClient = new HttpClient(httpClientHandler))
{
var creds = new
{
username = "webeoc administrator",
password = "x",
position = "CMD EOC Director",
incident = "Incident Name"
};
string serializedCreds = JsonConvert.SerializeObject(creds);
await httpClient.PostAsync($"{baseUrl}/sessions", new StringContent(serializedCreds));
}
}