API Functions

The below table lists the different available APIs:

API Name Description Post Parameters Sample URL Success Response Faliure Response
createuser Creates a new user for your website. Username and password are mandatory, others fields can be kept blank {
username:”USER_NAME”,
password: “PASSWORD”,
link: “PROFILE_LINK”,
avatar:”AVATAR_LINK”,
displayname:”DISPLAY_NAME”
}
http://api.cometondemand.net/
api/createuser
{
“success”: {
“status”: “1000”,
“message”: “User created successfully!”,
“data”: {
“userid”: 1,
“uid”:”3c243dsfs”
}
}
}
{
“failed”: {
“status”: “1001”,
“message”: “Username already exists.”
}
}
removeuser Removes a user from your website by using ID or username of a user {
userid:USER_ID
}
OR
{
username:”USER_NAME”
}
http://api.cometondemand.net/
api/removeuser
{
“success”: {
“status”: “1000”,
“message”: “User deleted successfully!”,
“data”: {
“userid”: “1”
}
}
}
OR
{
“success”: {
“status”: “1000”,
“message”: “User deleted successfully!”,
“data”: {
“username”: “xyz”
}
}
}
{
“failed”: {
“status”: “1003”,
“message”: “User not found.”
}
}
updateuser Update your profile information. You can update your password, display name, status, status message, avatar and profile link. {
username:”USER_NAME”,
link: “PROFILE_LINK”, avatar:”AVATAR_LINK”,
displayname:”DISPLAY_NAME”,
password: “PASSWORD”,
newpassword:”NEW_PASSWORD”,
status:”STATUS’,
message:”STATUS_MESSAGE”,
}
http://api.cometondemand.net/
api/updateuser
{
“success”: {
“status”: “1000”,
“message”: “Details updated successfully!”
}
}
{
“failed”: {
“status”: “1003”,
“message”: “User not found.”
}
}
loginuser To Login your website, Username and password are mandatory {
username:”USER_NAME”,
password: “PASSWORD”
}
http://api.cometondemand.net/
api/loginuser
{
“success”:{
“status”:”1000″,
“message”:”Login successful”,
“user”:{
“userid”:”1″,
“username”:”xyz”,
“link”:””,
“avatar”:””,
“uid”:”sda1231″,
“friends”:””,
“grp”:””,
“displayname”:””
},
“basedata”:”asfdas23sa=”,
“cookiename”:”10108cc_data”
}
}
{
“failed”: {
“status”: “1001”,
“message”: “Invalid Username or Password.”
}
}
addfriend Make a user your friend. Pass json array containing the ID of user {
friends:2
}
OR
{
friends:1,2,3
}
OR
{
friends:jsonarray of ids
}
http://api.cometondemand.net/
api/addfriend
{
“success”: {
“status”: “1000”,
“message”: “Friend added successfully!”,
“data”: {
“userid”: “2,3”
}
}
}
{
“failed”: {
“status”: “1006”,
“message”: “Failed to add friends!”,
“data”: {
“userid”: “1,2,3”
}
}
}
removefriend Unfriend a user from your friend list. Pass json array containing the ID of user {
friends:2
}
OR
{
friends:1,2,3
}
OR
{
friends:jsonarray of ids
}
http://api.cometondemand.net/
api/removefriend
{
“success”: {
“status”: “1000”,
“message”: “Friends removed successfully!”,
“data”: {
“userid”: “2,3”
}
}
}
{
“failed”: {
“status”: “1002”,
“message”: “Failed to remove friends!”,
“data”: {
“userid”: “1,2,3”
}
}
}
creategroup Create new group. Pass group ID and group name {
action: “creategroup”,
api-key:”API_KEY”,
groupid:”GROUP_ID”,
groupname:”GROUP_NAME”,
grouptype:”GROUP_TYPE,
grouppassword:”GROUP_PASSWORD”
}
http://api.cometondemand.net/
api/creategroup
{“success”: {“status”:”1000″, “roomid”:17, “message”: “Group created”, “guid”:”8″ }} {“failed”: {“status”:”1007″, “message”: “guid is not unique” }}
deletegroup Delete the group. Pass group ID {
action: “deletegroup”,
api-key:”API_KEY”,
groupid:”GROUP_ID”
}
http://api.cometondemand.net/
api/deletegroup
{“success”: {“status”: “1000”, “message”: “Group deleted” }} {“failed”: {“status”: “1007”, “message”: “Group does not exist” }}
addgroupusers Add users to specific group. Pass json array containing the ID of users or username {
api-key:”API_KEY”,
groupid:”GROUP_ID”
users:2
}
OR
{
api-key:”API_KEY”,
groupid:”GROUP_ID”
users:1,2,3
}
OR
{
api-key:”API_KEY”,
groupid:”GROUP_ID”
users:jsonarray of ids
}
http://api.cometondemand.net/
api/addgroupusers
{“success”: {“status”: “1000”, “message”: “Users added successfully in group” }} {“failed”: {“status”: “1007”, “message”: “Invalid guid” }}
OR
{“failed”: {“status”: ”1005″, “message”: ”Invalid input” }}
OR
{“failed”: {“status”: ”1006″, “message”: ”Failed to add users.” }}
removegroupusers Remove users from specific group. Pass json array containing the ID of users or username {
api-key:”API_KEY”,
groupid:”GROUP_ID”
users:2
}
OR
{
api-key:”API_KEY”,
groupid:”GROUP_ID”
users:1,2,3
}
OR
{
api-key:”API_KEY”,
groupid:”GROUP_ID”
users:jsonarray of ids
}
http://api.cometondemand.net/
api/removegroupusers
{“success”: {“status”: “1000”, “message”: “Users removed successfully from the group” }} {“failed”: {“status”: “1007”, “message”: “Invalid guid” }}
OR
{“failed”: {“status”: ”1005″, “message”: ”Invalid input” }}
OR
{“failed”: {“status”: ”1006″, “message”: ”Failed to remove users.” }}

Not finding what you need?

The CometChat team is here to help!