powered by Jive Software

REST API - Breaking change in JSON roster response in 1.6.0

I think I have discovered a regression bug in the latest REST API version 1.6.0. Using the JSON response type with the GET /users/{username}/roster API the name of the array in the returned structure has changed from “rosterItem” to “roster”. This breaks our code, which expects “rosterItem”.

BEFORE (Openfire 4.6.3, REST API 1.4.0, AdoptOpenJDK 11.0.11):

{
   "**rosterItem**":[
      {
         "jid":"xxx@domain",
         "nickname":"xxx",
         "subscriptionType":0,
         "groups":[]
      }
   ]
}

AFTER (Openfire 4.6.3, REST API 1.6.0, AdoptOpenJDK 11.0.11 x64):

{
   "**roster**":[
      {
         "jid":"xxx@domain",
         "nickname":"xxx",
         "subscriptionType":0,
         "groups":[]
      }
   ]
}

I have a suspicion this might be something to do with the jackson dependency changing, because looking at the code the RosterEntities.java source I see the annotations haven’t changed for years.

I cannot reproduce this with the latest code (1.7.0-SNAPSHOT as of time of writing) of the REST API plugin on Openfire 4.6.4. It seems to return rosterItem (as expected) for me. For good measure, I tested with the last release of the plugin (1.6.0). I’m not seeing any issues there either.

curl -v -X GET --header "Authorization: foobar" --header "Accept: application/xml" http://localhost:9090/plugins/restapi/v1/users/john/roster

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<roster>
	<rosterItem>
		<jid>jane@example.org</jid>
		<nickname>Jane</nickname>
		<subscriptionType>3</subscriptionType>
		<groups/>
	</rosterItem>
</roster>

curl -v -X GET --header "Authorization: foobar" --header "Accept: application/json" http://localhost:9090/plugins/restapi/v1/users/john/roster

{
  "rosterItem":[
    {
      "jid":"jane@example.org",
      "nickname":"Jane",
      "subscriptionType":3,
      "groups":[
        
      ]
    }
  ]
}

(I’ve formatted the output to improve readability)