Uploaded image for project: 'Openfire'
  1. Openfire
  2. OF-1536

Of REST API - Of 4.2.3 / RestAPI 1.3.0 no longer parses Create Room json for owners & broadcast presence role same way

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.2.3
    • Fix Version/s: None
    • Component/s: Plugins
    • Labels:
      None

      Description

      Summary:Rest API 1.3.0 expects the create chat room's  JSON for owners and broadcast presence roles to be expressed differently than in Rest API 1.2.6. 

      Either...

      1. Rollback the change (unlikely. Better to update IMO)
      2. or Do both
        1. Update the restapi's readme.html to be accurate for the new approach
        2.  Review the REST-API-Client to see if it needs corresponding changes to rest API 1.3.0. Works fine as-is.

      I've noticed that the new version of the rest API 1.3.0 doesn't work exactly the same as prior version 1.2.6, in regard to creating MUC Rooms,when an "owners" or "broadcastPresenceRoles" section is included. So, either the plugin has an error or the documentation needs to be updated about how to pass in these sections.

      If I use version 1.2.6 of the plugin with Openfire 4.2.3 or 4.2.3, it works correctly.

      The below body is sent to a local (or remote) openfire instance
      Example post to http://localhost:9090/plugins/restapi/v1/chatrooms

      I get the following error message back from rest API version 1.3.0, but success from version 1.2.6.

      JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token

      I get the message about owners, if it is included
      I get the message about broadcastPresenceRoles, if it is included.

       

      Here is the message about owners

       

      2018.04.18 12:07:19 ERROR [Jetty-QTP-AdminConsole-34]: org.jivesoftware.openfire.container.PluginServlet - org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token
      at [Source: HttpInputOverHTTP@6c5b28e2; line: 13, column: 37] (through reference chain: org.jivesoftware.openfire.plugin.rest.entity.MUCRoomEntity["owners"])
      javax.servlet.ServletException: org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token
      at [Source: HttpInputOverHTTP@6c5b28e2; line: 13, column: 37] (through reference chain: org.jivesoftware.openfire.plugin.rest.entity.MUCRoomEntity["owners"])

       

      or about the broadcastPresenceRoles

      2018.04.18 12:11:31 ERROR [Jetty-QTP-AdminConsole-196]: org.jivesoftware.openfire.container.PluginServlet - org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token
      at [Source: HttpInputOverHTTP@75f7acd; line: 20, column: 38] (through reference chain: org.jivesoftware.openfire.plugin.rest.entity.MUCRoomEntity["broadcastPresenceRoles"])
      javax.servlet.ServletException: org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token
      at [Source: HttpInputOverHTTP@75f7acd; line: 20, column: 38] (through reference chain: org.jivesoftware.openfire.plugin.rest.entity.MUCRoomEntity["broadcastPresenceRoles"])
      

      Example JSON to post

      {
      "roomName": "candidate_live_10006", 
      "naturalName": "candidate_live_10006",
      "description": "example description",
      "subject": "example subject",
      "maxUsers": "30",
      "persistent": "true",
      "publicRoom": "true",
      "registrationEnabled": "true",
      "canAnyoneDiscoverJID": "true",
      "canOccupantsChangeSubject": "true",
      "canOccupantsInvite": "true",
      "logEnabled": "true",
      "owners": {
         "owner": "assignmentbot@dharrison0216.psi.local"
      },
      "admins": null,
      "members": null,
      "outcasts": null,
      "ownerGroups": null,
      "adminGroups": null,
      "memberGroups": null,
      "outcastGroups": null,
      "broadcastPresenceRoles": {
         "broadcastPresenceRole": [
            "moderator",
            "participant",
            "visitor"
         ]
      },
      "creationDate": "2018-04-12T13:51:01.803-08:00",
      "modificationDate": "2018-04-12T13:51:01.803-08:00" 
      }

        Attachments

          Activity

            People

            Assignee:
            dharrison David Harrison
            Reporter:
            dharrison David Harrison
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: