Mesibo Backend APIs (Server-side APIs)

Estimated reading time: 3 minutes

Mesibo backend API is a set of REST-like HTTPS APIs that allows you to create and manage users that can use mesibo real-time APIs. In addition to that, it also lets you administer your account, manage apps, manage groups, etc. You can access mesibo backend APIs using any language of your choice.

For most apps, you only need to use the backend APIs to create users and nothing else. Once the user is created, your apps can use real-time APIs for all other operations like sending messages, creating and managing groups, etc.

Security Note

For maintaining privacy and security, the backend API should only be accessed from your backend servers. Your apps/clients MUST NOT access backend APIs directly as it will expose your app token. For the privacy of your app data, mesibo will disable the app if the breach is detected or the backend APIs accessed from more than five IP addresses (TOKENBREACH).

Backend API Request and Response Structure

Mesibo backend APIs are primarily JSON-based APIs, all requests and responses are in JSON (application/json). Although it also supports form-encoded requests for backward compatibility, it is highly recommended that you use JSON requests for all new developments.

Mesibo Backend API URL

If you are not using mesibo on-premise, the following is the backend API URL:

https://api.mesibo.com/backend/

For on-premise, refer to Using Backend APIs with On-Premise to learn how to download and host backend APIs on your own server.

Request Structure

Content-Type: application/json

{ 
  "op":"useradd",
  "token": "ptlk9hdel1gqxf3p0s15f5f5gtusldej18tl794suzit",
  "user": {
	"address":"xyz@example.com",
  }
}

Every API request will have minimum two parameters:

  1. operation (op), identifies the operation requested.
  2. Application token (token), unique app token for your application which your MUST not share with anyone including your users. You can get and change the app token from the mesibo Console.
  3. [Optional] Request Identifier (id), any random integer value to identify request. It will be returned back in the response.

There can be more parameters depending on the operation.

Response Structure

The response is a JSON object with at least the following fields, and other fields depending on the operation as described below. Only use the documented fields below:

  • op, requested operation
  • result, true if successful, false otherwise
  • error, error code if the request failed

An example of a successful JSON response is as follows:

Content-Type: application/json

{ 
  "user": {
	"uid":123,
	"address":"xyz@example.com",
	"token":"79a818d76f45fb5a3ac395a0a98251c3db2eetb7b0d4aa0"
	  },
  "op":"useradd",
  "result":true
}

An example of a failed JSON response is as follows:

Content-Type: application/json

{
	"op":"someop",
	"result":false,
	"error":"BADOP"
}

Getting Familiar with Backend APIs

You may use Mesibo Backend API Playground to quickly familiarize yourself with syntax and parameters. The best way to use the playground is to use it when reading the reference section below.

You can also use curl to send API requests

curl -X POST https://api.mesibo.com/backend 
   -H 'Content-Type: application/json'
   -d '{"op":"useradd","token":"abc"}'

PHP Helper SDK

A PHP helper class for mesibo REST API is available on GitHub. Even if you are not using PHP, it should serve as a good reference for your implementation and parameters/payload.

Mesibo backend APIs Reference

Mesibo backend API is broadly categorized into three categories:

  1. User Management APIs

  2. Group Management APIs

  3. Messaging APIs

You can visit each section to learn more about it.

chat api backend, server-side api guide, chat app backend references, mesibo backend api, php, rest api