I'm attempting to create a group chat dialog in quickblox entirely through the REST API. How to create a user, a session, login, and then create a chat dialog all from the REST API? I can only successfully do the first two.
The tutorial has examples: http://quickblox.com/developers/Authentication_and_Authorization#API_User_Sign_In
I am able to create a session and create a user, after that I can't do more. When I try to login a user, as the example above, using this from the tutorial with my token and user:
curl -X POST \
-H "Content-Type: application/json"\
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: bee57951d76c03ffdecaad65bba039f4ad413ed7" \
-d '{"login": "Laralara", "password": "12345678"}' \
http://api.quickblox.com/login.json
I get Error:
curl: (6) Could not resolve host: QuickBlox-REST-API-Version
{"errors":{"login":["(or email) cannot be blank"],"password":["cannot be blank"]}}
No matter what I put in the data "-d" I get the same response.
If I try to create a chat dialog directly like in the example using this: http://quickblox.com/developers/Chat#Create_dialog
curl -X POST \
-H "Content-Type: application/json"\
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: ffed2e8da05b7a858ddee861ff31a09886aef540" \
-d '{"type": 2, "name": "Chat Bob, Sam, Garry", "id": "17435", "occupants_ids": "5712780"}' \
http://api.quickblox.com/chat/Dialog.json
I get Error:
curl: (6) Could not resolve host: QuickBlox-REST-API-Version
{"errors":{"base":["Forbidden. Need user."]}}
Thanks.
Your fields
login
andpassword
are wrong. You should useuser[login]
anduser[password]
.Take a look at this example in the Quickblox documentation: https://quickblox.com/developers/Generate_session_in_PHP
Please make sure that the user with this login and password exists. Please go to admin panel and check whether there is such user and check is username and password match.
There are 4 Steps need to maintain in quickblox.
Usually people created session and start working on one-to-one chat. If you followed till step 3, you won't get any problem.
Once you started creating public or private group, you will get an error
To resolve this error, you have to complete step 4. That is create AppSession or QBAuth session using a valid user (login and password).
After completing step 4, you can access all QuickBlox services like creating Group, joining room, sending and receiving messages in a group etc.
Try this.
It works for me on Android. :)
Cheers.