Create a group

Create a group with required members to start a group conversation using below API.

info

{api-base-url} can be obtained from the MirrorFly console.

HTTP request#

curl -X POST "https://{api-base-url}/api/v1/group/group" \
-H "accept: */*" \
-H "Authorization: xxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"licenseKey":"samplelicenseKey","groupName":"samplegroupname","groupImageUrl":"sampleurl","groupMembers":[{"isAdmin":true,"userId":"77xxxxxx22"}],"metaData":{"key1":"value1","key2":"value2","key3":"value3"}}'

Request Params#

ParamDataTypeRequiredDescription
groupNameStringYesA name for this group
groupImageUrlStringNoGroup profile picture url
groupMembersArray of objectsYesList of members to be added to this group
groupMembers.isAdminbooleanNoWhether to add this member as admin default value is false
groupMembers.userIdStringYesUserId of the member to be added
licenseKeyStringYesLicensekey for this group
metaDataStringNoJSON-formatted string to which you would like to add metadata.
Can add three key-value pairs, where the values can be either numbers or strings.
"metaData":{"key1":"value1","key2":"value2","key3":"value3"}

Responses#

If successful, this action creates a group and adds provided members to it.

{
"status": 200,
"data": {
"groupId": "xxxxxxxxxx", // String - group id - autogenerated
"groupName": "samplegroupname"// String - group name
},
"message": "Group created successfully"
}

Error#

In the case of an error, an error object like below is returned.

When the token passed in Headers is expired

{
"status": 401,
"message": "Token Expired"
}

In the case of a Bad Request, an error message is returned

{
"status": 400,
"message": "Error Message"
}