Patch Position

Partially updates a position. Only the fields included in the request body are changed; omitted fields are left untouched. Optionally include an If-Match request header (set to the ETag value returned by a prior Get position call) to guard against concurrent modification. If the position has changed since that read, the service responds with 412 Precondition Failed and makes no change.

positionName endpoint description
Description Partially updates a position.
URL
  • /positions/{positionName}

  • /positions/query?positionName={positionName}

Method PATCH
Parameters
  • positionName

  • 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 name of the position to patch 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) (omit to keep the existing color) False
pac String The position's new access code (omit to keep the existing PAC) False
comments String New free-text comments (omit to keep the existing comments) False
assignedGroups String array Replacement group list (omit to keep the existing list) False
assignedUsers String array Replacement user list (omit to keep the existing list) False

Examples

JQuery Call

Copy Code
$.ajax({
    url: baseUrl + '/positions/Logistics Chief',
    contentType: 'application/json',
    headers: { 'If-Match': etagFromPriorGet },
    data: JSON.stringify({ 'color': '#00AA00' }),
    type: 'PATCH'
});

C# Call

Copy Code
public void PatchPosition(Cookie cookie, string etag)
{
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(baseUrl + "/positions/Logistics Chief");
    request.Method = "PATCH";
    request.ContentType = "application/json";
    if (!string.IsNullOrEmpty(etag)) request.Headers["If-Match"] = etag;
    CookieContainer cookieJar = new CookieContainer();
    cookieJar.Add(cookie);
    request.CookieContainer = cookieJar;
    byte[] bytes = Encoding.UTF8.GetBytes(new JavaScriptSerializer().Serialize(new { color = "#00AA00" }));
    request.ContentLength = bytes.Length;
    using (Stream s = request.GetRequestStream()) { s.Write(bytes, 0, bytes.Length); }
    request.GetResponse();
}

Errors

401, 400 (blank or unknown position), 412 (If-Match mismatch), 500.