Calling REST API on client side - searching for samples


#1

Hi!

I am writing my own simple embedded web-chat client on Vue.JS around RocketChat server.
I am utilizing websocket API and all is perfect with WS.

Now I want to provide my user with a full list of channels. So that my user could search for a channel and finally join it. Here I have got some questions:

  1. is REST API the only option for getting all the chat’s channels?

  2. could you provide some examples on how to: 2.1) query the “third page” of 50 channels 2.2) query the channels which names start with “Cha”

  3. when I write my code (Vue.JS) I am facing a CORS problem while accessing the chat. My authorized GET queries are always accompanied by OPTION queries (it’s up to browser so I can not manage it), therefore, they fail. I ended up “proxying” my Vue.JS REST API queries to my dummy server, that does nothing but requests the provided addresses with the data provided.

So, the question is: could you allow OPTION queries on the chat’s server side (while CORS is enabled, of course) so as to make developing around your REST API a less painful process?

Sorry for me probably being out of the topic…