Create User

You should create a user in your MirrorFly application to initiate conversations. A user is identified by its unique user identifier, and additionally have a changeable nickname, profile image, and so on. Users are at the core of all conversations. MirrorFly applications are made up of users who can chat in directly to other users or Group. With the Create User API, it is possible to create a user.

info

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

HTTP request#

curl --location --request POST "https://{api-base-url}/api/v1/users/createUser"
--header "accept: */*"
--header "Content-Type: multipart/form-data"
--header "Authorization: AuthToken"
--form "deviceType=":deviceType""
--form "licenseKey=":licenseKey""
--form "userIdentifier=":userIdentifier""
--form "deviceOsVersion=":deviceOsVersion""
--form "deviceToken=":deviceToken""
--form "voipDeviceToken=":voipDeviceToke""
--form "mode=":mode""
--form "nickname=":nickName""
--form "mobileNumber=":mobileNumber""
--form "email=":emailId""
--form "profileUrl=":profileUrl""
--form "profileFile=@":profileFile""
--form "metadataKey1=":metadataKey1"" \
--form "metadataValue1=":metadataValue1"" \
--form "metadataKey2=":metadataKey2"" \
--form "metadataValue2=":metadataValue2"" \
--form "metadataKey3=":metadataKey3"" \
--form "metadataValue3=":metadataValue3""

Request Params#

ParamDataTypeRequiredDescription
deviceTypeStringYesDevice type where the user is creating. Accepted values (web/ios/android).
licenseKeyStringYesYour license key.
userIdentifierStringYesUnique user identifier. Max of 191 chars allowed.
deviceOsVersionStringNoDevice os version.
deviceTokenStringNoDevice token to receive the push notification for android/ios devices.
voipDeviceTokenStringNoVoip device token to receive the call related push notification for the ios devices.
modeIntNoMode to denote the ios sandbox/production mode to receive the push notifications. 0 - production, 1 - sandbox/debug
nicknameStringNoNickname of the user. Max of 30 chars allowed.
mobileNumberStringNoMobile number of the user. Max of 15 chars allowed.
emailStringNoEmail ID of the user, Which accepts special characters like !#$%&+
profileUrlStringNoIf you already having the profile image url, then you can use this param to store the data. Max of 2048 chars allowed.
profileFileFileNoIf you need to upload the image, then you can use this param to upload the image and retrieve the profile url which will be access via the Mirrorfly SDK’s and API’s only. Accepted files are png, jpeg and jpg.
metadataKey1StringNoMetadata key.
metadataValue1StringNoMetadata key1 value.
metadataKey2StringNoMetadata key.
metadataValue2StringNoMetadata key2 value.
metadataKey3StringNoMetadata key.
metadataValue3StringNoMetadata key3 value.

Responses#

If successful, this action returns a user resource in the response body.

{
"status": 200,
"data": {
"token": "",//Auth token for this user
"username": "99XXXXXX11",//Username of this user which should be used to generate the Auth token
"password": "XXXXXXX",//Password of this user which should be used to generate the Auth token
"isProfileUpdated": true,//To denote whether the user is newly registered or registered already.
"mobileNumber": "99XXXXXXX00",
"nickname": "User A",
"profileUrl": "",
"profileUrlThumb": "",
"email": "user@gmail.com",
"userId" : "99XXXXXX11"
},
"message": "User created successfully"
}

Error#

In the case of an error, an error object like below is returned. When the token passed in Headers is not given or expired

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

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

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