Hi John
very clear on the first part. About DELETE problem, my request is (taken from firebug):
Creation POST:
Request:
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding:gzip, deflate
Cache-Control:no-cache
Connection:keep-alive
Content-Length: 291
Content-Type:application/xml; charset=UTF-8
Host:cms9.default
Pragma:no-cache
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20100101 Firefox/12.0
Reply:
Content-Length: 0
Content-Type: text/plain
Date: Tue, 31 Jul 2012 15:26:32 GMT
Location: http://cms9.default/ccp-webapp/ccp/socialcontact/DDA54527100001380000024E3F57FFC8
Set-Cookie:JSESSIONID=042504FBC6027ED5E3767BDD9D2E4A83; Path=/chatproxy
then I try with a DELETE:
DELETE http://cms9.default/chatproxy/api/chat/DDA54527100001380000024E3F57FFC8
Request:
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding:gzip, deflate
Connection:keep-alive
Content-Length:291
Content-Type:text/plain; charset=UTF-8
Cookie:JSESSIONID=042504FBC6027ED5E3767BDD9D2E4A83
Host:cms9.default
User-Agent:Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20100101 Firefox/12.0
Reply:
405 - Method not allowed
Allow

OST,GET,OPTIONS,HEAD
Content-Length:2266
Content-Type:text/html;charset=utf-8
Date:Tue, 31 Jul 2012 15:29:19 GMT
It seems that method DELETE is not allowed on that URL. Cookie is set as you can see..
Also tried with PUT Message:
PUT http://cms9.default/chatproxy/api/chat
<Message>
<body>body of message </body>
</Message>
Request:
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding:gzip, deflate
Connection:keep-alive
Content-Length:50
Content-Type:application/xml; charset=UTF-8
Cookie:JSESSIONID=042504FBC6027ED5E3767BDD9D2E4A83
Host: cms9.default
User-Agent:Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20100101 Firefox/12.0
Reply:
Content-Type:application/xml
Date:Tue, 31 Jul 2012 15:33:41 GMT
Transfer-Encoding:chunked
<apiErrors>
<apiError>
<errorType>notFound</errorType>
</apiError>
</apiErrors>
Let me know where I'm wrong (I'm using RestClient for Firefox as rest client - http://restclient.net/).
Mirko
The problem here is that the customer side of the chat is not a direct connection to the XMPP server. Because customers are joining the chat from a browser outside the firewall all customer chat traffic is proxied through the SocialMiner API.
The general flow starts with what you did, POSTing a social contact to the chat API. This creates the chat room where the agent can join directly. Unlike the other REST APIs where you are returned a specific refURL identifying the resource created, the customer chat is accessed through the base chatproxy/api/chat API. Because there is no identifier for which chat we are getting events for, API calls only work with a valid session cookie. The session cookie returned from the POST or GET should be provided on subsequent chat proxy API calls.
This is why the DELETE below failed. You should send the DELETE to chatproxy/api/chat directly with your session cookie and that will remove the chat room associated with that session.
The customer chat events are accessed by calling GET as you did, but again, with the session cookie. That's what identifies the customer to the API.
Also, you are absolutely right, there is an error in the docs. The "eventid" parameter does _not_ have a capital I. It must be "eventid" with the lower case I.
I think that answers all of the questions but I'll comment in line as well.
I want to replace the customer webchat UI with a customized one. So what I'm doing is generating a chat feed request via REST API (done and success) and after that accessing xmpp (with jabberwerx or xmpp client) and start chatting with the agent selected. The question is: which is the customer side xmpp user I can use to log in to xmpp(in my mind it should be a virtual user) to access the room.
On dev doc page 25 it's said that on feed info I could find user Jabber ID's. What is this about? I tried to access xmpp server with the "administrator" account and join the room after creating the feed and everything works properly. So I think I only miss a little piece.
You can absolutely create a new chat UI, but you can't go directly to the XMPP server for the customer side of the chat. The customer side of the chat is only accessible through the chatproxy/api/chat API with the sesion cookie you got when you POSTed to create the chat originally. You don't need to worry about jabber ids or anything on the customer side.
I also want to report a couple of strange behaviours. I tried to delete a running chat as reported on page 27 dev doc. So I tried with:
DELETE http://csm9.default/chatproxy/api/chat/DBE8F92310000138000002363F57FFC8
where DBE8F92310000138000002363F57FFC8 is a valid chat feed id. The request I get is:
<pre><ol class="linenums"><li>Status Code: 405 Method Not Allowed</li><li>Allow: POST,GET,OPTIONS,HEAD</li><li>Content-Length: 2266</li><li>Content-Type: text/html;charset=utf-8</li><li>Date: Tue, 31 Jul 2012 07:22:07 GMT</li></ol></pre>
This is what I mentioned above where you just DELETE directly to chatproxy/api/chat with the session cookie. This is not as pure REST as the rest of our APIs but as this is a public customer facing API, if we simply went by a full refURL than anyone else that knew that url could join the chat. So the customer side of the chat dependson sessions created and maintained by the browser (or other client, but it has to deal with session cookies).
Second one: when trying to get info on a chat feed, sending GET as on page 27:
GET http://csm9.default/chatproxy/api/chat?eventId=0&all=false
If I spell eventId with capital letter "I" I get:
<pre style="margin-left: 0px;"><?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<apiErrors>
<apiError>
<errorData>eventid</errorData>
<errorMessage>must be greater than zero. Eventid was -1: session: 2C8FC250E0422844AFF616557DB2A147</errorMessage>
<errorType>invalidInput</errorType>
</apiError>
</apiErrors></pre>
<pre style="margin-left: 0px;">
</pre>
<pre style="margin-left: 0px;">If I spell it with lower "i",</pre>
<pre style="margin-left: 0px;">GET http://csm9.default/chatproxy/api/chat?eventid=0&all=false</pre>
<pre style="margin-left: 0px;">I get: </pre>
<pre style="margin-left: 0px;"><pre style="margin-left: 0px;"><?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<apiErrors>
<apiError>
<errorMessage>no user found for the current session id: 2C8FC250E0422844AFF616557DB2A147</errorMessage>
<errorType>notFound</errorType>
</apiError>
</apiErrors>
</pre>
Can you explain why?
Typo in the docs. It should be "eventid". I'll get this fixed ASAP.
Thanks.