Edit Position

Replaces the values for an existing position. All fields supplied overwrite the stored values; assignedGroups and assignedUsers replace the existing collections.

positionName endpoint description
Description Replaces the values for an existing position.
URL
  • /positions/{positionName}

  • /positions/query?positionName={positionName}

Method POST
Parameters
  • positonName

  • name

  • color

  • pac

  • comments

  • assignedGroups

  • assignedUsers

Review the parameter definitions and examples of how to use the positionName endpoint in a JQuery and C# call.

Parameter

positionName endpoint parameters
Variable Name Type Description Required
positionname String The current name of the position to edit True (URL)
name String The new name (omit to keep the existing name) False
color String The position's new color as a hex value (for example, #3366CC) False
pac String The position's new access code False
comments String New free-text comments False
assignedGroups String array Replacement group list False
assignedUsers String array Replacement user list False

Examples

JQuery Call

Copy Code
var position = {
    'comments': 'Updated logistics section chief',
    'assignedGroups': ['Logistics', 'Command']
};
$.ajax({
    url: baseUrl + '/positions/Logistics Chief',
    contentType: 'application/json',
    data: JSON.stringify(position),
    type: 'POST'
});

C# Call

Copy Code
public void EditPosition(Cookie cookie)
{
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(baseUrl + "/positions/Logistics Chief");
    request.Method = "POST";
    request.ContentType = "application/json";
    CookieContainer cookieJar = new CookieContainer();
    cookieJar.Add(cookie);
    request.CookieContainer = cookieJar;
    var position = new { comments = "Updated logistics section chief", assignedGroups = new[] { "Logistics", "Command" } };
    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 or unknown position), 500.