Search code examples
ucwa

Setting HTML as supported messageformat in UCWA


I have a functional ucwa client that only works with plain messages. According to the lync documentation, a PUT request is needed to change the supported modality and message format, and that an If-Match header is required to verify the request is not for an out-of-date status.

For example, a GET request to /ucwa/oauth/v1/applications/102628975647/communication will return

{
"9b5c7fdf-2c5f-462e-a4e3-39663f09301a": "please pass this in a PUT request",
"supportedModalities": [],
"supportedMessageFormats": [
    "Plain"
],
"_links": {..},/*ommitted for brevity */
"rel": "communication",
"etag": "3010254294"

}

I PUT back this, with an If-Match: 3010254294 header:

{
"9b5c7fdf-2c5f-462e-a4e3-39663f09301a": "please pass this in a PUT request",
"supportedModalities": [],
"supportedMessageFormats": [
    "Plain", "Html"
],
"rel": "communication",
"etag": "3010254294"

}

But I consistently get a 428 PreconditionRequired error, which, according to documentation, means that I am missing the If-Match header. Various combinations of ETag and If-Match also fail. What is the proper format for this request?


Solution

  • I remember running into this issue when I was trying to figure out why I could not receive HTML-formatted messages. The issue being that you appear to have the data correct except the If-Match header is very particular in that it would only work for me when I had the value quoted and it may/may not work for single quotes.

    If-Match: "3010254294"
    

    Relevant Fiddler Trace: UCWA Html Messaging.saz