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
}
}
}
{
“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.”
}
}
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”
}
}
}

Not finding what you need?

The CometChat team is here to help!