powered by Jive Software

Chatroom update API returning error - 415 Unsopported Media Type

Hi,

I am using REST API to update Chatroom and also tying to add members. Every time I am sending request via Postmane it’s returning error - 415 Unsopported Media Type.

I removed the request to add new member but only to update chatroom description it’s still returning same error.
Method: PUT (according to the REST API documentation)

Is it possible to update member listing using ChatRoom Update API? Or am I sending unsupported request?

Did you added the required content type header to your request?

Content-Type: application/xml

Yes I did, I used PUT and here goes the payload:

asdad FEB28 2019-9C Test Room - 9C Doesn't Even Matter 2019-03-28T13:58:00.181+01:00 2019-04-01T16:14:46.557+02:00 0 true false true true true true false true false true true moderator 1596038345@localhost.com chhavi7@localhost.com 6162410818@localhost.com 5335405682@localhost.com 5005337382@localhost.com

I kept the the ADMIN and OWNER same just tried to add three new members and update the room DESCRIPTION.

Can you show us the full request? (payload, headers etc.)

PUT: http://domain.com:9090/plugins/restapi/v1/chatrooms/asdad

(application/xml)

<roomName>asdad</roomName>
<naturalName>FEB28 2019-NAME</naturalName>
<description>Test Room - 9D</description>
<subject>Doesn't Even Matter</subject>
<creationDate>2019-03-28T13:58:00.181+01:00</creationDate>
<modificationDate>2019-04-01T16:14:46.557+02:00</modificationDate>
<maxUsers>0</maxUsers>
<persistent>true</persistent>
<publicRoom>false</publicRoom>
<registrationEnabled>true</registrationEnabled>
<canAnyoneDiscoverJID>true</canAnyoneDiscoverJID>
<canOccupantsChangeSubject>true</canOccupantsChangeSubject>
<canOccupantsInvite>true</canOccupantsInvite>
<canChangeNickname>false</canChangeNickname>
<logEnabled>true</logEnabled>
<loginRestrictedToNickname>false</loginRestrictedToNickname>
<membersOnly>true</membersOnly>
<moderated>true</moderated>
<broadcastPresenceRoles>
    <broadcastPresenceRole>moderator</broadcastPresenceRole>
</broadcastPresenceRoles>

<owners>
    <owner>1596038345@localhost.com</owner>
</owners>

<admins>
    <admin>chhavi7@localhost.com</admin>
    <admin>6162410818@localhost.com</admin>
</admins>

<members>
    <member>8836151706@localhost.com</member>
    <member>8024942152@localhost.com</member>
    <member>8416010527@localhost.com</member>
    <member>demo@localhost.com</member>
    <member>7781676196@localhost.com</member>
</members>

<outcasts/>
<ownerGroups/>
<adminGroups/>
<memberGroups/>
<outcastGroups/>

I found something inside Openfire console, it’s throwing some kind of exception:

2019-NAME (asdad) Exception:
java.lang.IllegalArgumentException: Illegal JID: collage frds@conference.localhost.com
at org.xmpp.packet.JID.&lt;init&gt;(JID.java:542)
at org.xmpp.packet.JID.&lt;init&gt;(JID.java:496)
at org.jivesoftware.openfire.muc.spi.LocalMUCRoom.getJID(LocalMUCRoom.java:394)
at org.jivesoftware.openfire.admin.muc_002droom_002dsummary_jsp._jspService(muc_002droom_002dsummary_jsp.java:329)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1655)
at com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129)
at com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at org.jivesoftware.util.LocaleFilter.doFilter(LocaleFilter.java:73)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at org.jivesoftware.util.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:49)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at org.jivesoftware.admin.PluginFilter.doFilter(PluginFilter.java:226)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at org.jivesoftware.admin.AuthCheckFilter.doFilter(AuthCheckFilter.java:216)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1634)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1340)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1242)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:220)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:503)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
at java.lang.Thread.run(Thread.java:748)

Caused by: java.lang.IllegalArgumentException: The input is not a valid JID node: collage frds
at org.xmpp.packet.JID.nodeprep(JID.java:294)
at org.xmpp.packet.JID.&lt;init&gt;(JID.java:529)
… 49 more

Not sure if this can be the issue the API is returning error.

you are missing the <chatRoom> and </chatRoom>
You can find here the documentation: https://www.igniterealtime.org/projects/openfire/plugins/1.3.8/restAPI/readme.html#update-a-chat-room

Thank you. It worked but the Exception still appearing inside Openfire admin panel.

Could you please tell me why this exception coming?

I’m not sure if its related to the REST API plugin.
Does is happen if you do the request?

Yes. I created this chatoom than run the ChatRoom Update API and it started to throw exception.
The strange thing is when I call the ChatRoom delete API it deleted the chatroom but the next chatroom started to throw exception like this.

Is there any way to resolve this or just trace the reason of it?

It seems if I delete that chatroom the next chatroom will appear like this. I just attached a screenshot.!

Is that an unencoded space in your JID?

I hide the host name there. The actual string is :slight_smile:

java.lang.IllegalArgumentException: Illegal JID: collage frds@conference.localhost.com

And yes, there’s a space in the JID “collage frds” and I tried to delete the room but it happens again and again.
But there is no client/user with such JID in the User list

It’s the room name (“collage frds”) that has the space in it, not a user.

I’m unsure how this could have happened. How did you create this room?

Sorry, my mistake. Yes, it’s the room ID which appearing but the actual ID is abcd@conference.localhost.com which I marked. When I call the API to get the details of that chatroom it also returns the correct one, which is - abcd@conference.localhost.com I also marked the ID/Name with in the screenshot.

I don’t know where it’s coming from, it’s appearing beside the room which has completely different id.

Is there any way I can go through the DB and check if there’s anything exist which match with such strange room id?

There are various database tables in play, the most central one to this problem is probably ofMucRoom. I don’t recommend making changes to the database directly, though - but if you must, be sure to shut down Openfire before you do.

Thank you for your reply. Do you think Openfire admin console hiding this room but it’s actually exist inside DB?

Since you don’t recommend DB changes, what are the other ways to find this room and delete it?

I found that Room, it exists in the DB but can’t delete it via REST API and the Room itself not appearing inside Openfire Admin console.

Any suggestion how to delete this room?

I think in this case you don’t have other choice. Stop Openfire and then delete it from DB.

1 Like