Add Position
Adds a new position to WebEOC Nexus using the positions endpoint.
| Description | Adds a new position |
|---|---|
| URL | /positions |
| Method | POST |
| Parameters |
|
Review the parameter definitions and examples of how to use the positions endpoint in a JQuery and C# call.
Parameters
| Variable Name | Type | Description | Required |
|---|---|---|---|
| name | String | The name of the new position | True |
| color | String | The position color as a hex value (for example, #3366CC) | False |
| pac | String | The position access code | False |
| comments | String | Free-text comments | False |
| assignedGroups | String array | Group names to assign to the position | False |
| assignedUsers | String array | User names to assign to the position | False |
Examples
JQuery Call
Copy Code
var position = {
'name': 'Logistics Chief',
'color': '#CC0000',
'pac': '',
'comments': 'Logistics section chief',
'assignedGroups': ['Logistics'],
'assignedUsers': ['bwhite']
};
$.ajax({
url: baseUrl + '/positions',
contentType: 'application/json',
data: JSON.stringify(position),
type: 'POST'
});
C# Call
Copy Code
public void AddPosition(Cookie cookie)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(baseUrl + "/positions");
request.Method = "POST";
request.ContentType = "application/json";
CookieContainer cookieJar = new CookieContainer();
cookieJar.Add(cookie);
request.CookieContainer = cookieJar;
var position = new
{
name = "Logistics Chief",
color = "#CC0000",
pac = "",
comments = "Logistics section chief",
assignedGroups = new[] { "Logistics" },
assignedUsers = new[] { "bwhite" }
};
byte[] bytes = Encoding.UTF8.GetBytes(new JavaScriptSerializer().Serialize(position));
request.ContentLength = bytes.Length;
using (Stream s = request.GetRequestStream()) { s.Write(bytes, 0, bytes.Length); }
request.GetResponse();
}
Errors
401, 400 (blank name or other invalid input), 500.