Prepare to use API

MirrorFly's Chat Platform API allows you to directly work with data resources related to your MirrorFly application’s chat activities. The Chat API uses standard HTTP protocols where JSON payloads are returned in response to the HTTP requests. It is internally implemented based on the RESTful principles. While the native SDKs handle many of the requests and responses at the client side, the Chat API allows for more flexibility and adds additional functionalities to your service from the server side and client side.

Creating Authentication Token#

To create an Authentication token you need to use the static username and password from the MirrorFly console.

info

{your-domain-name} can be obtained from the MirrorFly console.

HTTP request#

curl -X POST "https://{your-domain-name}/api/v1/login"
-H "accept: */*"
-H "Content-Type: application/json"
-d "{ \"username\": \"XXXXXXXXXX\", \"password\": \"XXXXXXXXXX\"}"

Request Params#

ParamDataTypeRequiredDescription
usernameStringYesUsername of the admin user obtained from the console.
passwordStringYesPassword of the admin user obtained from the console.

Responses#

If successful, this action returns a Authentication token in the response body.

{
"status": 200,
"data": {
"token": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
},
"message": "Data retrieved successfully"
}

Error#

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

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

Authentication token received in the response is valid upto 1 hour. You need to call the API once again to generate the new token. In simple words, when the secured API’s giving the response as 401 you need to call the Create Authentication Token API to generate the new auth token and then consume the further API’s using the new token.