NAV Navbar

CRM PLATFORM

javascript python shell

Introduction

Welcome to the CRM Platform API Documentation! You can use our APIs to access different modules, which can get information about states,districts, countries etc. in our database.

We have language bindings in Shell, Python, and JavaScript! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.

Authentication

To get an access token, use this code:

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/auth")
payload = "{\n\t\"identifier\":\"demo\",\n\t\"password\":\"demo123\"\n}"
headers = {
  'Content-Type': 'application/json'
}
conn.request("POST", "/local", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method POST \
  --timeout=0 \
  --header 'Content-Type: application/json' \
  --body-data '{
    "identifier":"demo",
    "password":"demo123"
}' \
   'http://localhost:1337/auth/local'
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({ identifier: "demo", password: "demo123" });

var requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/auth/local", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiaWF0IjoxNTkxMzQyNjA3LCJleHAiOjE1OTM5MzQ2MDd9.5a7Z0qUB7nI8y1CBzGesJcxH4q9mU00S6CbSz1cbwuI",
  "user": {
    "id": 1,
    "username": "demo",
    "email": "demo@test.com",
    "provider": "local",
    "confirmed": true,
    "blocked": false,
    "role": {
      "id": 1,
      "name": "Authenticated",
      "description": "Default role given to authenticated user.",
      "type": "authenticated"
    },
    "created_at": "2020-05-18T07:15:54.051Z",
    "updated_at": "2020-05-18T15:32:11.564Z"
  }
}

You can get your username and password from the CRM Platform UI. With it you can request an API access token.

CRM Platform expects for the access token to be included in all API requests to the server in a header that looks like the following:

Authorization: Bearer API_TOKEN

Users

User stores details such as user's name,email and other information.

Get All Users

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/users")
payload = ''
headers = {}
conn.request("GET", "", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/users'
var requestOptions = {
  method: "GET",
  redirect: "follow",
};

fetch("http://localhost:1337/users", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "username": "demoUser",
    "email": "demouser@example.com",
    "provider": "local",
    "confirmed": true,
    "blocked": false,
    "role": {
      "id": 1,
      "name": "Authenticated",
      "description": "Default role given to authenticated user.",
      "type": "authenticated"
    },
    "created_at": "2020-05-18T06:25:24.731Z",
    "updated_at": "2020-05-28T12:43:51.512Z"
  },
  [
    {
      "id": 2,
      "username": "demoUser2",
      "email": "demo@example.com",
      "provider": "local",
      "confirmed": true,
      "blocked": false,
      "role": {
        "id": 1,
        "name": "Authenticated",
        "description": "Default role given to authenticated user.",
        "type": "authenticated"
      },
      "created_at": "2020-05-18T06:25:24.731Z",
      "updated_at": "2020-06-09T05:35:32.118Z"
    },
    {...}
  ]
]

Description

This method returns all the user details by default or specific user details with certain conditions based on the filters passed to the method

HTTP Request

GET http://localhost:1337/users

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
Filters Column attributes in the table (Optional)

Get a Specific User

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/users")
payload = ''
headers = {}
conn.request("GET", "/1", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/users/1'
var requestOptions = {
  method: "GET",
  redirect: "follow",
};

fetch("http://localhost:1337/users/1", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 1,
  "username": "demoUser",
  "email": "demouser@example.com",
  "provider": "local",
  "confirmed": true,
  "blocked": false,
  "role": {
    "id": 1,
    "name": "Authenticated",
    "description": "Default role given to authenticated user.",
    "type": "authenticated"
  },
  "created_at": "2020-05-18T06:25:24.731Z",
  "updated_at": "2020-05-28T12:43:51.512Z"
}

Description

This method returns specific user details by id.

HTTP Request

GET http://localhost:1337/users/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
ID The ID of the user to retrieve

Save a Specific User

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/users")
payload = "{\n\t \"username\": \"testuser\",\n        \"email\": \"testUser@example.com\",\n        \"provider\": \"local\",\n        \"confirmed\": true,\n        \"password\":\"password\",\n        \"blocked\": false\n}"
headers = {}
conn.request("POST", "", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method POST \
  --timeout=0 \
  --header '' \
  --body-data '{
     "username": "testUser",
        "email": "testuser@example.com",
        "provider": "local",
        "confirmed": true,
        "password":"password",
        "blocked": false
}' \
   'http://localhost:1337/users'
var raw =
  '{\n   "username": "testUser",\n        "email": "testuser@example.com",\n        "provider": "local",\n        "confirmed": true,\n        "password":"password",\n        "blocked": false\n}';

var requestOptions = {
  method: "POST",
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/users", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 3,
  "username": "testUser",
  "email": "testuser@example.com",
  "provider": "local",
  "password": "$2a$10$kkQwn0/fI0VOK3iYRkIo.eSYuOJuqGgL0TZFwOABOOZ5yKNLqwwnq",
  "resetPasswordToken": null,
  "confirmed": true,
  "blocked": false,
  "role": {
    "id": 1,
    "name": "Authenticated",
    "description": "Default role given to authenticated user.",
    "type": "authenticated"
  },
  "created_at": "2020-06-05T11:12:53.752Z",
  "updated_at": "2020-06-05T11:12:53.938Z"
}

Description

This method creates an user with the attribute parameters passed to this method by default. It returns details of created user

HTTP Request

POST http://localhost:1337/users

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

Request Parameters

Parameter Description
name The name of the user
password Password of the user
email Email of the user
Column attributes Column attributes in the table (Optional)

Update a Specific User

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/users")
payload = "{\n\t\"username\": \"testuser2\"\n}"
headers = {}
conn.request("PUT", "/3", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method PUT \
  --timeout=0 \
  --header '' \
  --body-data '{
    "username": "testuser2"
}' \
   'http://localhost:1337/users/3'
var raw = '{\n  "username": "testuser2"\n}';

var requestOptions = {
  method: "PUT",
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/users/3", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 3,
  "username": "testuser2",
  "email": "testuser@example.com",
  "provider": "local",
  "password": "$2a$10$kkQwn0/fI0VOK3iYRkIo.eSYuOJuqGgL0TZFwOABOOZ5yKNLqwwnq",
  "resetPasswordToken": null,
  "confirmed": true,
  "blocked": false,
  "role": {
    "id": 1,
    "name": "Authenticated",
    "description": "Default role given to authenticated user.",
    "type": "authenticated"
  },
  "created_at": "2020-06-05T11:12:53.752Z",
  "updated_at": "2020-06-05T11:14:36.566Z"
}

Description

This method updates the specific user by id with attribute parameters passed to it.It returns details of updated user

HTTP Request

UPDATE http://localhost:1337/users/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
ID The ID of the user to update

Request Parameters

Parameter Description
Column attributes Column attributes in the table

Delete a Specific User

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/users")
payload = ''
headers = {}
conn.request("DELETE", "/3", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method DELETE \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/users/3'
var raw = "";

var requestOptions = {
  method: "DELETE",
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/users/3", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 3,
  "username": "testuser2",
  "email": "testuser@example.com",
  "provider": "local",
  "password": "$2a$10$kkQwn0/fI0VOK3iYRkIo.eSYuOJuqGgL0TZFwOABOOZ5yKNLqwwnq",
  "resetPasswordToken": null,
  "confirmed": true,
  "blocked": false,
  "role": {
    "id": 1,
    "name": "Authenticated",
    "description": "Default role given to authenticated user.",
    "type": "authenticated"
  },
  "created_at": "2020-06-05T11:12:53.752Z",
  "updated_at": "2020-06-05T11:14:36.566Z"
}

Description

This method deletes specific user by id and returns details of deleted user.

HTTP Request

DELETE http://localhost:1337/users/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
ID The ID of the user to delete

Forgot Password/Reset Password/Validate Email Api

Below apis describe Forgot password, Reset password and Email validation flow

Forgot Password

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/auth")
payload = "{\n\t\"email\":\"demouser@example.com\"\n\t\n}"
headers = {}
conn.request("POST", "/forgot-password", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method POST \
  --timeout=0 \
  --header '' \
  --body-data '{
    "email":"demouser@example.com"

}' \
   'http://localhost:1337/auth/forgot-password'
var raw = '{\n  "email":"demouser@example.com"\n    \n}';

var requestOptions = {
  method: "POST",
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/auth/forgot-password", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

Description

This method sends message to the entered email address containing a link to reset password.

HTTP Request

POST http://localhost:1337/auth/forgot-password

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

Request Parameters

Parameter Description
email Email of the user

Reset Password

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/auth")
payload = "{\n\t\"code\": \"privateCode\",\n    \"password\": \"password\",\n    \"passwordConfirmation\": \"password\"\n}"
headers = {}
conn.request("POST", "/reset-password", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method POST \
  --timeout=0 \
  --header '' \
  --body-data '{
    "code": "privateCode",
    "password": "password",
    "passwordConfirmation": "password"
}' \
   'http://localhost:1337/auth/reset-password'
var raw =
  '{\n  "code": "privateCode",\n    "password": "password",\n    "passwordConfirmation": "password"\n}';

var requestOptions = {
  method: "POST",
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/auth/reset-password", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

Description

New password with verification code received by user is verified and user password is reset.

HTTP Request

GET http://localhost:1337/auth/reset-password

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
code Verification code
password New password
passwordConfirmation New password is confirmed

Email Validation

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/auth")
payload = "{\n\t \"email\": \"demouser@example.com\"\n}"
headers = {}
conn.request("POST", "/send-email-confirmation", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method POST \
  --timeout=0 \
  --header '' \
  --body-data '{
     "email": "demouser@example.com"
}' \
   'http://localhost:1337/auth/send-email-confirmation'
var raw = '{\n   "email": "demouser@example.com"\n}';

var requestOptions = {
  method: "POST",
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/auth/send-email-confirmation", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

Description

This method is used to validate user's email id by sending verification code to the email.

HTTP Request

GET http://localhost:1337/auth/send-email-confirmation

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
email Email of the user

Activity types

Activitytype stores details about basic types of activities that are stored in activity content type

Get All Activity types

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("GET", "/activitytypes", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/crm-plugin/activitytypes'
var requestOptions = {
  method: "GET",
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/activitytypes", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "name": "Horticulture",
    "is_active": true,
    "created_at": "2020-05-15T17:57:09.304Z",
    "updated_at": "2020-05-15T17:57:09.304Z",
    "activities": []
  },
  {
    "id": 2,
    "name": "Agriculture",
    "is_active": true,
    "created_at": "2020-05-15T18:00:09.304Z",
    "updated_at": "2020-05-15T18:00:09.304Z",
    "activities": []
  },
  {...}
]

Description

This method returns all the activitytype details by default or specific activitytype details with certain conditions based on the filters passed to the method

HTTP Request

GET http://localhost:1337/crm-plugin/activitytypes

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
Filters Column attributes in the table (Optional)

Get a Specific Activity type

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("GET", "/activitytypes/1", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/crm-plugin/activitytypes/1'
var requestOptions = {
  method: "GET",
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/activitytypes/1", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 1,
  "name": "Horticulture",
  "is_active": true,
  "created_at": "2020-05-15T17:57:09.304Z",
  "updated_at": "2020-05-15T17:57:09.304Z",
  "activities": []
}

Description

This method returns specific activitytype details by id.

HTTP Request

GET http://localhost:1337/crm-plugin/activitytypes/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
ID The ID of the activitytype to retrieve

Save a Specific Activity type

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = "{\n\t\"name\": \"Piggery\",\n    \"is_active\": \"true\"\n}"
headers = {}
conn.request("POST", "/activitytypes", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method POST \
  --timeout=0 \
  --header '' \
  --body-data '{
    "name": "Piggery",
    "is_active": "true"
}' \
   'http://localhost:1337/crm-plugin/activitytypes'
var raw = '{\n  "name": "Piggery",\n    "is_active": "true"\n}';

var requestOptions = {
  method: "POST",
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/activitytypes", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 3,
  "name": "Piggery",
  "is_active": true,
  "created_at": "2020-06-04T13:06:29.683Z",
  "updated_at": "2020-06-04T13:06:29.683Z",
  "activities": []
}

Description

This method creates an activitytype with the attribute parameters passed to this method by default. It returns details of created activitytype

HTTP Request

POST http://localhost:1337/crm-plugin/activitytypes

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

Request Parameters

Parameter Description
title The name of the activity
is_active Active status of activitytype (Boolean value : true or false)
Column attributes Column attributes in the table (Optional)

Update a Specific Activity type

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = "{\n\t\"name\": \"Fishery -- test\",\n    \"is_active\": \"true\"\n}"
headers = {}
conn.request("PUT", "/activitytypes/3", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method PUT \
  --timeout=0 \
  --header '' \
  --body-data '{
    "name": "Fishery -- test",
    "is_active": "true"
}' \
   'http://localhost:1337/crm-plugin/activitytypes/3'
var raw = '{\n  "name": "Fishery -- test",\n    "is_active": "true"\n}';

var requestOptions = {
  method: "PUT",
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/activitytypes/3", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 3,
  "name": "Fishery -- test",
  "is_active": true,
  "created_at": "2020-06-04T13:06:29.683Z",
  "updated_at": "2020-06-04T13:06:29.683Z",
  "activities": []
}

Description

This method updates the specific activitytype by id with attribute parameters passed to it.It returns details of updated activitytype

HTTP Request

UPDATE http://localhost:1337/crm-plugin/activitytypes/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
ID The ID of the activitytype to update

Request Parameters

Parameter Description
Column attributes Column attributes in the table

Delete a Specific Activity type

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("DELETE", "/activitytypes/1", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method DELETE \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/crm-plugin/activitytypes/1'
var raw = "";

var requestOptions = {
  method: "DELETE",
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/activitytypes/1", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 1,
  "name": "Horticulture",
  "is_active": true,
  "created_at": "2020-05-15T17:57:09.304Z",
  "updated_at": "2020-05-15T17:57:09.304Z",
  "activities": []
}

Description

This method deletes specific activitytype by id and returns details of deleted activitytype

HTTP Request

DELETE http://localhost:1337/crm-plugin/activitytypes/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
ID The ID of the activitytype to delete

Activities

Activity stores the details about the activity such as title, date and time and description.

Get All Activities

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("GET", "/activities", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/crm-plugin/activities'
var requestOptions = {
  method: "GET",
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/activities", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "title": "Fishery",
    "start_datetime": null,
    "end_datetime": null,
    "description": null,
    "activitytype": null,
    "created_at": "2020-05-28T23:52:16.303Z",
    "updated_at": "2020-05-28T23:52:43.459Z",
    "activityassignees": []
  },
    {
    "id": 2,
    "title": "Farming",
    "start_datetime": null,
    "end_datetime": null,
    "description": null,
    "activitytype": null,
    "created_at": "2020-05-28T22:08:20.303Z",
    "updated_at": "2020-05-28T22:08:20.459Z",
    "activityassignees": []
  },
  {...}
]

Description

This method returns all the activity details by default or specific activity details with certain conditions based on the filters passed to the method

HTTP Request

GET http://localhost:1337/crm-plugin/activities

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
Filters Column attributes in the table (Optional)

Get a Specific Activity

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("GET", "/activities/1", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/crm-plugin/activities/1'
var requestOptions = {
  method: "GET",
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/activities/1", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 1,
  "title": "Fishery",
  "start_datetime": null,
  "end_datetime": null,
  "description": null,
  "activitytype": null,
  "created_at": "2020-05-28T23:52:16.303Z",
  "updated_at": "2020-05-28T23:52:43.459Z",
  "activityassignees": []
}

Description

This method returns specific activity details by id.

HTTP Request

GET http://localhost:1337/crm-plugin/activities/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
ID The ID of the activity to retrieve

Save a Specific Activity

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = "{\n\t\"title\":\"Ponding\"\n}"
headers = {}
conn.request("POST", "/activities", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method POST \
  --timeout=0 \
  --header '' \
  --body-data '{
    "title":"Ponding"
}' \
   'http://localhost:1337/crm-plugin/activities'
var raw = '{\n  "title":"Ponding"\n}';

var requestOptions = {
  method: "POST",
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/activities", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 3,
  "title": "Ponding",
  "start_datetime": null,
  "end_datetime": null,
  "description": null,
  "activitytype": null,
  "created_at": "2020-06-04T12:47:38.398Z",
  "updated_at": "2020-06-04T12:47:38.398Z",
  "activityassignees": []
}

Description

This method creates an activity with the attribute parameters passed to this method by default. It returns details of created activity

HTTP Request

POST http://localhost:1337/crm-plugin/activities

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

Request Parameters

Parameter Description
title The name of the activity
contact Array of activity assignee (an organization or individual) ids (Optional)
Column attributes Column attributes in the table (Optional)

Update a Specific Activity

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = "{\n\t\"title\":\"Piggery --test\"\n}"
headers = {}
conn.request("PUT", "/activities/3", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method PUT \
  --timeout=0 \
  --header '' \
  --body-data '{
    "title":"Piggery --test"
}' \
   'http://localhost:1337/crm-plugin/activities/3'
var raw = '{\n  "title":"Piggery --test"\n}';

var requestOptions = {
  method: "PUT",
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/activities/3", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 3,
  "title": "Piggery --test",
  "start_datetime": null,
  "end_datetime": null,
  "description": null,
  "activitytype": null,
  "created_at": "2020-06-04T12:47:38.398Z",
  "updated_at": "2020-06-04T12:49:29.419Z",
  "activityassignees": []
}

Description

This method updates the specific activity by id with attribute parameters passed to it.It returns details of updated activity

HTTP Request

UPDATE http://localhost:1337/crm-plugin/activities/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
ID The ID of the activity to update

Request Parameters

Parameter Description
Column attributes Column attributes in the table

Delete a Specific Activity

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("DELETE", "/activities/1", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method DELETE \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/crm-plugin/activities/1'
var raw = "";

var requestOptions = {
  method: "DELETE",
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/activities/1", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 1,
  "title": "Fishery",
  "start_datetime": null,
  "end_datetime": null,
  "description": null,
  "activitytype": null,
  "created_at": "2020-05-28T23:52:16.303Z",
  "updated_at": "2020-05-28T23:52:43.459Z",
  "activityassignees": []
}

Description

This method deletes specific activity by id and returns details of deleted activity.

HTTP Request

DELETE http://localhost:1337/crm-plugin/activities/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
ID The ID of the activity to delete

Contacts

Contact stores contact details like address, email, phone, etc of an individual or an organization or a user in the system.

Get All Contacts

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("GET", "/contact", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/crm-plugin/contact'
var requestOptions = {
  method: "GET",
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/contact", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "name": "NewTech",
    "phone": null,
    "phone_other": null,
    "email": null,
    "email_other": null,
    "address_1": null,
    "address_2": null,
    "city": null,
    "pincode": null,
    "contact_type": "organization",
    "organization": {
      "id": 1,
      "name": "NewTech",
      "contact": 1,
      "created_at": "2020-06-04T11:15:32.751Z",
      "updated_at": "2020-06-04T11:15:33.054Z"
    },
    "country": null,
    "state": null,
    "district": null,
    "individual": null,
    "user": null,
    "created_at": "2020-06-04T11:15:32.945Z",
    "updated_at": "2020-06-04T11:15:33.077Z",
    "villages": [],
    "activityassignees": [],
    "contacttags": []
  },
  {
    "id": 2,
    "name": "National Horticultural Society",
    "phone": null,
    "phone_other": null,
    "email": null,
    "email_other": null,
    "address_1": null,
    "address_2": null,
    "city": null,
    "pincode": null,
    "contact_type": "organization",
    "organization": {
      "id": 2,
      "name": "National Horticultural Society",
      "contact": 2,
      "created_at": "2020-05-15T18:05:11.520Z",
      "updated_at": "2020-05-15T18:05:11.520Z"
    },
    "country": null,
    "state": null,
    "district": null,
    "individual": null,
    "user": null,
    "created_at": "2020-05-15T18:05:11.520Z",
    "updated_at": "2020-05-15T18:05:11.520Z",
    "villages": [],
    "activityassignees": [],
    "contacttags": []
  },
  {...}
]

Description

This method returns all the contact details by default or specific contact details with certain conditions based on the filters passed to the method

HTTP Request

GET http://localhost:1337/crm-plugin/contacts

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
Filters Column attributes in the table (Optional)

Get a Specific Contact

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("GET", "/contact/1", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/crm-plugin/contact/1'
var requestOptions = {
  method: "GET",
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/contact/1", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 1,
  "name": "NewTech",
  "phone": null,
  "phone_other": null,
  "email": null,
  "email_other": null,
  "address_1": null,
  "address_2": null,
  "city": null,
  "pincode": null,
  "contact_type": "organization",
  "organization": {
    "id": 1,
    "name": "NewTech",
    "contact": 1,
    "created_at": "2020-06-04T11:15:32.751Z",
    "updated_at": "2020-06-04T11:15:33.054Z"
  },
  "country": null,
  "state": null,
  "district": null,
  "individual": null,
  "user": null,
  "created_at": "2020-06-04T11:15:32.945Z",
  "updated_at": "2020-06-04T11:15:33.077Z",
  "villages": [],
  "activityassignees": [],
  "contacttags": []
}

Description

This method returns specific contact details by id.

HTTP Request

GET http://localhost:1337/crm-plugin/contact/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
ID The ID of the contact to retrieve

Save a Specific Contact

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = " { \"name\": \"Tech Providers\",\r\n  \"contact_type\": \"organization\"\r\n \t\r\n }"
headers = {}
conn.request("POST", "/contact/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method POST \
  --timeout=0 \
  --header '' \
  --body-data ' { "name": "Tech Providers",
  "contact_type": "organization"

 }' \
   'http://localhost:1337/crm-plugin/contact/'
var raw = " { \"name\": \"Tech Providers\",
\n  \"contact_type\": \"organization\"
\n
\n }";

var requestOptions = {
  method: 'POST',
  body: raw,
  redirect: 'follow'
};

fetch("http://localhost:1337/crm-plugin/contact/", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
  "id": 3,
  "name": "Tech Providers",
  "phone": null,
  "phone_other": null,
  "email": null,
  "email_other": null,
  "address_1": null,
  "address_2": null,
  "city": null,
  "pincode": null,
  "contact_type": "organization",
  "organization": {
    "id": 3,
    "name": "Tech Providers",
    "contact": 2,
    "created_at": "2020-06-04T11:21:35.951Z",
    "updated_at": "2020-06-04T11:21:36.205Z"
  },
  "country": null,
  "state": null,
  "district": null,
  "individual": null,
  "user": null,
  "created_at": "2020-06-04T11:21:36.122Z",
  "updated_at": "2020-06-04T11:21:36.223Z",
  "villages": [],
  "activityassignees": [],
  "contacttags": []
}

Description

This method creates a contact with the attribute parameters passed to this method by default. It returns details of created contact

HTTP Request

POST http://localhost:1337/crm-plugin/contact/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

Request Parameters

Parameters Description
name The name of the individual or organization or user in the system
contact_type Type of contact (values : organization/individual)
Column attributes Column attributes in the table (Optional)

Update a Specific Contact

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = " { \r\n\t\"name\": \"Tech Providers --test\",\r\n\t\"contact_type\": \"organization\"\r\n }"
headers = {}
conn.request("PUT", "/contact/3", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method PUT \
  --timeout=0 \
  --header '' \
  --body-data ' {
    "name": "Tech Providers --test",
    "contact_type": "organization"
 }' \
   'http://localhost:1337/crm-plugin/contact/3'
var raw = " {
\n  \"name\": \"Tech Providers --test\",
\n  \"contact_type\": \"organization\"
\n }";

var requestOptions = {
  method: 'PUT',
  body: raw,
  redirect: 'follow'
};

fetch("http://localhost:1337/crm-plugin/contact/3", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
  "id": 3,
  "name": "Tech Providers --test",
  "phone": null,
  "phone_other": null,
  "email": null,
  "email_other": null,
  "address_1": null,
  "address_2": null,
  "city": null,
  "pincode": null,
  "contact_type": "organization",
  "organization": {
    "id": 3,
    "name": "Tech Providers --test",
    "contact": 3,
    "created_at": "2020-06-04T11:21:35.951Z",
    "updated_at": "2020-06-04T11:24:49.450Z"
  },
  "country": null,
  "state": null,
  "district": null,
  "individual": null,
  "user": null,
  "created_at": "2020-06-04T11:21:36.122Z",
  "updated_at": "2020-06-04T11:24:49.653Z",
  "villages": [],
  "activityassignees": [],
  "contacttags": []
}

Description

This method updates the specific contact by id with attribute parameters passed to it.It returns details of updated contact

HTTP Request

UPDATE http://localhost:1337/crm-plugin/contact/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
ID The ID of the contact to update

Request Parameters

Parameter Description
Column attributes Column attributes in the table

Delete a Specific Contact

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("DELETE", "/contact/1", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method DELETE \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/crm-plugin/contact/1'
var raw = "";

var requestOptions = {
  method: "DELETE",
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/contact/1", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 1,
  "name": "NewTech",
  "phone": null,
  "phone_other": null,
  "email": null,
  "email_other": null,
  "address_1": null,
  "address_2": null,
  "city": null,
  "pincode": null,
  "contact_type": "organization",
  "organization": {
    "id": 1,
    "name": "NewTech",
    "contact": 1,
    "created_at": "2020-06-04T11:15:32.751Z",
    "updated_at": "2020-06-04T11:15:33.054Z"
  },
  "country": null,
  "state": null,
  "district": null,
  "individual": null,
  "user": null,
  "created_at": "2020-06-04T11:15:32.945Z",
  "updated_at": "2020-06-04T11:15:33.077Z",
  "villages": [],
  "activityassignees": [],
  "contacttags": []
}

Description

This method deletes specific contact by id and returns details of deleted contact.

HTTP Request

DELETE http://localhost:1337/crm-plugin/contact/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
ID The ID of the contact to delete

Tags

Tag allows you to categorize the contacts.

Get All Tags

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("GET", "/tags", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \

   'http://localhost:1337/crm-plugin/tags'
var myHeaders = new Headers();

var requestOptions = {
  method: "GET",
  headers: myHeaders,
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/tags", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "name": "Tag 1",
    "description": null,
    "is_active": true,
    "created_at": "2020-06-10T10:36:15.485Z",
    "updated_at": "2020-06-10T10:36:15.485Z",
    "contacttags": []
  },
  {
    "id": 2,
    "name": "Tag 2",
    "description": null,
    "is_active": true,
    "created_at": "2020-06-10T10:36:15.485Z",
    "updated_at": "2020-06-10T10:36:15.485Z",
    "contacttags": []
  },
  {...}
]

Description

This method returns all the tag details by default or specific tag details with certain conditions based on the filters passed to the method

HTTP Request

GET http://localhost:1337/crm-plugin/tags

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
Filters Column attributes in the table (Optional)

Get a Specific Tag

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("GET", "/tags/1", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/crm-plugin/tags/1'
var requestOptions = {
  method: "GET",
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/tags/1", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 1,
  "name": "Tag 1",
  "description": null,
  "is_active": true,
  "created_at": "2020-06-10T10:36:15.485Z",
  "updated_at": "2020-06-10T10:36:15.485Z",
  "contacttags": []
}

Description

This method returns specific tag details by id

HTTP Request

GET http://localhost:1337/crm-plugin/tags/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
ID The ID of the tag to retrieve

Save a Specific Tag

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = "{\n\t\"name\":\"Tag 4\"\n\t\n}"
conn.request("POST", "/tags", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method POST \
  --timeout=0 \
  --header '' \
  --body-data '{
    "name":"Tag 4"

}' \
   'http://localhost:1337/crm-plugin/tags'
var raw = "{
\n  \"name\": \"Tag 4\"
\n}"

var requestOptions = {
  method: "POST",
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/tags", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 4,
  "name": "Tag 4",
  "description": null,
  "is_active": true,
  "created_at": "2020-06-10T10:36:15.485Z",
  "updated_at": "2020-06-10T10:36:15.485Z",
  "contacttags": []
},

Description

This method creates a tag with the attribute parameters passed to this method by default. It returns details of created tag

HTTP Request

POST http://localhost:1337/crm-plugin/tags

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

Request Parameters

Parameter Description
name The name of the tag
is_active Active status of tag (Boolean value : true or false)
contact Array of contact tag (an organization or individual) ids (Optional)
Column attributes Column attributes in the table (Optional)

Update a Specific Tag

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = "{\n    \"is_active\": false,\n    \"contacts\": [\n        1\n    ]\n}"
headers = {}
conn.request("PUT", "/tags/4", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method PUT \
  --timeout=0 \
  --header '' \
  --body-data '{
    "is_active": false,
    "contacts": [
        1
    ]
}' \
   'http://localhost:1337/crm-plugin/tags/4'
var raw = '{\n  "is_active": "false", \n    "contacts": [\n        1\n    ]\n}';

var requestOptions = {
  method: "PUT",
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/tags/", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 4,
  "name": "Tag 4",
  "description": null,
  "is_active": false,
  "created_at": "2020-06-10T10:36:15.485Z",
  "updated_at": "2020-06-10T10:36:15.485Z",
  "contacttags": [
    {
      "id": 1,
      "contact": 1,
      "tag": 4,
      "created_at": "2020-06-04T13:26:17.453Z",
      "updated_at": "2020-06-04T13:26:17.477Z"
    }
  ],
  "contacts": [
    {
      "id": 1,
      "name": "NewTech",
      "phone": null,
      "phone_other": null,
      "email": null,
      "email_other": null,
      "address_1": null,
      "address_2": null,
      "city": null,
      "pincode": null,
      "contact_type": "organization",
      "organization": {
        "id": 155,
        "name": "NewTech",
        "contact": 158,
        "created_at": "2020-06-04T13:25:03.188Z",
        "updated_at": "2020-06-04T13:25:03.354Z"
      },
      "country": null,
      "state": null,
      "district": null,
      "individual": null,
      "user": null,
      "created_at": "2020-06-04T13:25:03.298Z",
      "updated_at": "2020-06-04T13:25:03.375Z",
      "villages": [],
      "activityassignees": [],
      "contacttags": [
        {
          "id": 1,
          "contact": 1,
          "tag": 4,
          "created_at": "2020-06-04T13:26:17.453Z",
          "updated_at": "2020-06-04T13:26:17.477Z"
        }
      ]
    }
  ]
}

Description

This method updates the specific tag by id with attribute parameters passed to it.It returns details of updated tag

HTTP Request

UPDATE http://localhost:1337/crm-plugin/tags/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
ID The ID of the tag to update

Request Parameters

Parameter Description
Column attributes Column attributes in the table

Delete a Specific Tag

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("DELETE", "/tags/4", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method DELETE \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/crm-plugin/tags/4'
var raw = "";

var requestOptions = {
  method: "DELETE",
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/tags/4", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 4,
  "name": "Tag 4",
  "description": null,
  "is_active": false,
  "created_at": "2020-06-10T10:36:15.485Z",
  "updated_at": "2020-06-10T10:36:15.485Z",
  "contacttags": [
    {
      "id": 1,
      "contact": 1,
      "tag": 4,
      "created_at": "2020-06-04T13:26:17.453Z",
      "updated_at": "2020-06-04T13:26:17.477Z"
    }
  ],
  "contacts": [
    {
      "id": 1,
      "name": "NewTech",
      "phone": null,
      "phone_other": null,
      "email": null,
      "email_other": null,
      "address_1": null,
      "address_2": null,
      "city": null,
      "pincode": null,
      "contact_type": "organization",
      "organization": {
        "id": 155,
        "name": "NewTech",
        "contact": 158,
        "created_at": "2020-06-04T13:25:03.188Z",
        "updated_at": "2020-06-04T13:25:03.354Z"
      },
      "country": null,
      "state": null,
      "district": null,
      "individual": null,
      "user": null,
      "created_at": "2020-06-04T13:25:03.298Z",
      "updated_at": "2020-06-04T13:25:03.375Z",
      "villages": [],
      "activityassignees": [],
      "contacttags": [
        {
          "id": 1,
          "contact": 1,
          "tag": 4,
          "created_at": "2020-06-04T13:26:17.453Z",
          "updated_at": "2020-06-04T13:26:17.477Z"
        }
      ]
    }
  ]
}

Description

This method deletes specific tag by id and returns details of deleted tag

HTTP Request

DELETE http://localhost:1337/crm-plugin/tags/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
ID The ID of the tag to delete

Countries

Country stores details of a country having some states.

Get All Countries

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("GET", "/countries", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/crm-plugin/countries'
var requestOptions = {
  method: "GET",
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/countries", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "name": "India",
    "is_active": true,
    "abbreviation": "IN",
    "identifier": "IN",
    "created_at": "2020-06-08T15:34:11.390Z",
    "updated_at": "2020-06-08T15:34:11.390Z",
    "states": [{
      "id": 1,
      "name": "Goa",
      "is_active": true,
      "abbreviation": "GA",
      "identifier": "GA",
      "country": 1,
      "created_at": "2020-06-08T17:00:27.897Z",
      "updated_at": "2020-06-08T17:00:27.897Z"
    },
    {
      "id": 2,
      "name": "Gujarat",
      "is_active": true,
      "abbreviation": "GJ",
      "identifier": "GJ",
      "country": 1,
      "created_at": "2020-06-09T14:31:52.037Z",
      "updated_at": "2020-06-09T14:31:52.037Z"
    },
    {...}]
  },
  {...}
]

Description

This method returns all the country details by default or specific country details with certain conditions based on the filters passed to the method.

HTTP Request

GET http://localhost:1337/crm-plugin/countries

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
Filters Column attributes in the table (Optional)

Get a Specific Country

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("GET", "/countries/1", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/crm-plugin/countries/1'
var requestOptions = {
  method: "GET",
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/countries/1", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 1,
  "name": "India",
  "is_active": true,
  "abbreviation": "IN",
  "identifier": "IN",
  "created_at": "2020-06-08T15:34:11.390Z",
  "updated_at": "2020-06-08T15:34:11.390Z",
  "states": [{
    "id": 1,
    "name": "Goa",
    "is_active": true,
    "abbreviation": "GA",
    "identifier": "GA",
    "country": 1,
    "created_at": "2020-06-08T17:00:27.897Z",
    "updated_at": "2020-06-08T17:00:27.897Z"
  },
  {
    "id": 2,
    "name": "Gujarat",
    "is_active": true,
    "abbreviation": "GJ",
    "identifier": "GJ",
    "country": 1,
    "created_at": "2020-06-09T14:31:52.037Z",
    "updated_at": "2020-06-09T14:31:52.037Z"
  },
  {...}]
}

Description

This method returns specific country details by id.

HTTP Request

GET http://localhost:1337/crm-plugin/countries/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
ID The ID of the country to retrieve

Count All/Specific Countries

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("GET", "/countries/count", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/crm-plugin/countries/count'
var requestOptions = {
  method: "GET",
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/countries/count", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

1

Description

This method returns total number of data items present in a country.

HTTP Request

GET http://localhost:1337/crm-plugin/countries/count

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Optional

Save a Specific Country

import http.client
import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = "{\n\t \"name\": \"United States\",\n     \"is_active\": true,\n     \"abbreviation\": \"US\"\n}"
headers = {}
conn.request("POST", "/countries", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method POST \
  --timeout=0 \
  --header '' \
  --body-data '{
      "name": "United States",
    "is_active": true,
    "abbreviation": "US"
}' \
   'http://localhost:1337/crm-plugin/countries'
var raw =
  '{\n   "name": "United States",\n     "is_active": true,\n     "abbreviation": "US"\n}';

var requestOptions = {
  method: "POST",
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/countries", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 2,
  "name": "United States",
  "is_active": true,
  "abbreviation": "US",
  "identifier": "US",
  "created_at": "2020-06-08T15:34:11.390Z",
  "updated_at": "2020-06-08T15:34:11.390Z",
  "states": []
}

Description

This method creates a country with the attribute parameters passed to this method by default. It returns details of created country.

HTTP Request

POST http://localhost:1337/crm-plugin/countries/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

Request Parameters

Parameters Description
name The name of the country to create
is_active Active status of country (Boolean value : true or false)
abbreviation Abbreviation for the country (Unique value)
Column attributes Column attributes in the table (Optional)

Update a Specific Country

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = "{\n\t \"name\": \"United States --test\",\n     \"is_active\": true,\n     \"abbreviation\": \"US\"\n}"
headers = {}
conn.request("PUT", "/countries/2", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method PUT \
  --timeout=0 \
  --header '' \
  --body-data '{
     "name": "United States --test",
     "is_active": true,
     "abbreviation": "US"
}' \
   'http://localhost:1337/crm-plugin/countries/2'
var raw =
  '{\n   "name": "United States --test",\n     "is_active": true,\n     "abbreviation": "US"\n}';

var requestOptions = {
  method: "PUT",
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/countries/2", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 2,
  "name": "United States --test",
  "is_active": true,
  "abbreviation": "US",
  "identifier": "US",
  "created_at": "2020-06-08T15:34:11.390Z",
  "updated_at": "2020-06-08T15:34:11.390Z",
  "states": []
}

Description

This method updates the specific country by id with attribute parameters passed to it.It returns details of updated country

HTTP Request

UPDATE http://localhost:1337/crm-plugin/states/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
ID The ID of the country to update

Request Parameters

Parameter Description
Column attributes Column attributes in the table

Delete a Specific Country

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("DELETE", "/countries/2", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method DELETE \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/crm-plugin/countries/2'
var raw = "";

var requestOptions = {
  method: "DELETE",
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/countries/2", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 2,
  "name": "United States --test",
  "is_active": true,
  "abbreviation": "US",
  "identifier": "US",
  "created_at": "2020-06-08T15:34:11.390Z",
  "updated_at": "2020-06-08T15:34:11.390Z",
  "states": []
}

Description

This method deletes specific country by id and returns details of deleted country.

HTTP Request

DELETE http://localhost:1337/crm-plugin/countries/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
ID The ID of the country to delete

States

State stores information about the state belonging to a specific country.

Get All States

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("GET", "/states", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/crm-plugin/states'
var requestOptions = {
  method: "GET",
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/states", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "name": "Goa",
    "is_active": true,
    "abbreviation": "GA",
    "identifier": "GA",
    "country": {
      "id": 1,
      "name": "India",
      "is_active": true,
      "abbreviation": "IN",
      "identifier": "IN",
      "created_at": "2020-06-08T15:34:11.390Z",
      "updated_at": "2020-06-08T15:34:11.390Z"
    },
    "created_at": "2020-06-08T17:00:27.897Z",
    "updated_at": "2020-06-08T17:00:27.897Z",
    "districts": [{
      "id": 1,
      "name": "North Goa",
      "is_active": true,
      "abbreviation": "NG",
      "identifier": "NG",
      "state": 1,
      "created_at": "2020-06-08T17:38:17.853Z",
      "updated_at": "2020-06-08T17:38:17.853Z"
    }, {
      "id": 2,
      "name": "South Goa",
      "is_active": true,
      "abbreviation": "SG",
      "identifier": "SG",
      "state": 1,
      "created_at": "2020-06-08T17:38:17.860Z",
      "updated_at": "2020-06-08T17:38:17.860Z"
    }],
    "villages": []
  },
  {
    "id": 2,
    "name": "Gujarat",
    "is_active": true,
    "abbreviation": "GJ",
    "identifier": "GJ",
    "country": {
      "id": 1,
      "name": "India",
      "is_active": true,
      "abbreviation": "IN",
      "identifier": "IN",
      "created_at": "2020-06-08T15:34:11.390Z",
      "updated_at": "2020-06-08T15:34:11.390Z"
    },
    "created_at": "2020-06-09T14:31:52.037Z",
    "updated_at": "2020-06-09T14:31:52.037Z",
    "districts": [
      {
        "id": 3,
        "name": "Ahmedabad",
        "is_active": true,
        "abbreviation": "AH",
        "identifier": "AH",
        "state": 2,
        "created_at": "2020-06-09T14:31:52.718Z",
        "updated_at": "2020-06-09T14:31:52.718Z"
      },
      {
        "id": 4,
        "name": "Bhavnagar",
        "is_active": true,
        "abbreviation": "BV",
        "identifier": "BV",
        "state": 2,
        "created_at": "2020-06-09T14:31:52.721Z",
        "updated_at": "2020-06-09T14:31:52.721Z"
      },
      {...}
    ],
    "villages": []
  },
  {...}
]

Description

This method returns all the state details by default or specific state details with certain conditions based on the filters passed to the method.

HTTP Request

GET http://localhost:1337/crm-plugin/states

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
Filters Column attributes in the table (Optional)

Get a Specific State

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("GET", "/states/1", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/crm-plugin/states/1'
var requestOptions = {
  method: "GET",
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/states/1", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 1,
  "name": "Goa",
  "is_active": true,
  "abbreviation": "GA",
  "identifier": "GA",
  "country": {
    "id": 1,
    "name": "India",
    "is_active": true,
    "abbreviation": "IN",
    "identifier": "IN",
    "created_at": "2020-06-08T15:34:11.390Z",
    "updated_at": "2020-06-08T15:34:11.390Z"
  },
  "created_at": "2020-06-08T17:00:27.897Z",
  "updated_at": "2020-06-08T17:00:27.897Z",
  "districts": [
    {
      "id": 1,
      "name": "North Goa",
      "is_active": true,
      "abbreviation": "NG",
      "identifier": "NG",
      "state": 1,
      "created_at": "2020-06-08T17:38:17.853Z",
      "updated_at": "2020-06-08T17:38:17.853Z"
    },
    {
      "id": 2,
      "name": "South Goa",
      "is_active": true,
      "abbreviation": "SG",
      "identifier": "SG",
      "state": 1,
      "created_at": "2020-06-08T17:38:17.860Z",
      "updated_at": "2020-06-08T17:38:17.860Z"
    }
  ],
  "villages": []
}

Description

This method returns specific state details by id.

HTTP Request

GET http://localhost:1337/crm-plugin/states/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
ID The ID of the state to retrieve

Count All/Specific States

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("GET", "/states/count", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/crm-plugin/states/count'
var requestOptions = {
  method: "GET",
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/states/count", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

2

Description

This method returns total number of data items present in state table by default or number of states matching criteria based on the filters passed to the method.

HTTP Request

GET http://localhost:1337/crm-plugin/states/count

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
Filters Column attributes in the table (Optional)

Save a Specific State

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = "{\r\n\t\"name\": \"Maharashtra\",\r\n    \"is_active\": \"true\"\r\n}"
headers = {}
conn.request("POST", "/states", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method POST \
  --timeout=0 \
  --header '' \
  --body-data '{
    "name": "Maharashtra",
    "is_active": "true"
}' \
   'http://localhost:1337/crm-plugin/states'
var raw = "{
\n  \"name\": \"Maharashtra\",
\n    \"is_active\": \"true\"
\n}";

var requestOptions = {
  method: 'POST',
  body: raw,
  redirect: 'follow'
};

fetch("http://localhost:1337/crm-plugin/states", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "id": 3,
    "name": "Maharashtra",
    "is_active": true,
    "abbreviation": "MH",
    "identifier": "MH",
    "country": {
        "id": 1,
        "name": "India",
        "is_active": true,
        "abbreviation": "IN",
        "identifier": "IN",
        "created_at": "2020-06-08T15:34:11.390Z",
        "updated_at": "2020-06-08T15:34:11.390Z"
    },
    "created_at": "2020-06-08T17:00:27.916Z",
    "updated_at": "2020-06-08T17:00:27.916Z",
    "districts": [{
        "id": 10,
        "name": "Solapur",
        "is_active": true,
        "abbreviation": "SO",
        "identifier": "SO",
        "state": 3,
        "created_at": "2020-06-09T14:29:23.112Z",
        "updated_at": "2020-06-09T14:29:23.112Z"
    }, {
        "id": 11,
        "name": "Amravati",
        "is_active": true,
        "abbreviation": "AM",
        "identifier": "AM",
        "state": 3,
        "created_at": "2020-06-09T14:29:23.060Z",
        "updated_at": "2020-06-09T14:29:23.060Z"
    },
  {...}],
    "villages": []
}

Description

This method creates a state with the attribute parameters passed to this method by default. It returns details of the created state.

HTTP Request

POST http://localhost:1337/crm-plugin/states

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

Request Parameters

Parameter Description
name Name of the state
is_active Active status of state (Boolean value : true or false)
Column attributes Column attributes in the table (Optional)

Update a State

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = "{\r\n\t\"name\": \"Maharashtra --test\",\r\n    \"is_active\": \"true\"\r\n}"
headers = {}
conn.request("PUT", "/states/3", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method PUT \
  --timeout=0 \
  --header '' \
  --body-data '{
    "name": "Maharashtra --test",
    "is_active": "true"
}' \
   'http://localhost:1337/crm-plugin/states/3'
var raw = "{
\n  \"name\": \"Maharashtra --test\",
\n    \"is_active\": \"true\"
\n}";

var requestOptions = {
  method: 'PUT',
  body: raw,
  redirect: 'follow'
};

fetch("http://localhost:1337/crm-plugin/states/3", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "id": 3,
    "name": "Maharashtra --test",
    "is_active": true,
    "abbreviation": "MH",
    "identifier": "MH",
    "country": {
        "id": 1,
        "name": "India",
        "is_active": true,
        "abbreviation": "IN",
        "identifier": "IN",
        "created_at": "2020-06-08T15:34:11.390Z",
        "updated_at": "2020-06-08T15:34:11.390Z"
    },
    "created_at": "2020-06-08T17:00:27.916Z",
    "updated_at": "2020-06-08T17:00:27.916Z",
    "districts": [{
        "id": 10,
        "name": "Solapur",
        "is_active": true,
        "abbreviation": "SO",
        "identifier": "SO",
        "state": 3,
        "created_at": "2020-06-09T14:29:23.112Z",
        "updated_at": "2020-06-09T14:29:23.112Z"
    }, {
        "id": 11,
        "name": "Amravati",
        "is_active": true,
        "abbreviation": "AM",
        "identifier": "AM",
        "state": 3,
        "created_at": "2020-06-09T14:29:23.060Z",
        "updated_at": "2020-06-09T14:29:23.060Z"
    },
  {...}],
    "villages": []
}

Description

This method updates the specific state by id with attribute parameters passed to it.It returns details of updated state.

HTTP Request

POST http://localhost:1337/crm-plugin/states/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
ID The ID of the state to update

Request Parameters

Parameter Description
Column attributes Column attributes in the table

Delete a Specific State

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("DELETE", "/states/3", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method DELETE \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/crm-plugin/states/3'
var raw = "";

var requestOptions = {
  method: "DELETE",
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/states/3", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
    "id": 3,
    "name": "Maharashtra --test",
    "is_active": true,
    "abbreviation": "MH",
    "identifier": "MH",
    "country": {
        "id": 1,
        "name": "India",
        "is_active": true,
        "abbreviation": "IN",
        "identifier": "IN",
        "created_at": "2020-06-08T15:34:11.390Z",
        "updated_at": "2020-06-08T15:34:11.390Z"
    },
    "created_at": "2020-06-08T17:00:27.916Z",
    "updated_at": "2020-06-08T17:00:27.916Z",
    "districts": [{
        "id": 10,
        "name": "Solapur",
        "is_active": true,
        "abbreviation": "SO",
        "identifier": "SO",
        "state": 3,
        "created_at": "2020-06-09T14:29:23.112Z",
        "updated_at": "2020-06-09T14:29:23.112Z"
    }, {
        "id": 11,
        "name": "Amravati",
        "is_active": true,
        "abbreviation": "AM",
        "identifier": "AM",
        "state": 3,
        "created_at": "2020-06-09T14:29:23.060Z",
        "updated_at": "2020-06-09T14:29:23.060Z"
    },
  {...}],
    "villages": []
}

Description

This method deletes specific state by id and returns details of deleted state.

HTTP Request

DELETE http://localhost:1337/crm-plugin/states/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
ID The ID of the state to delete

Districts

District stores district information belonging to a specific state.

Get All Districts

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("GET", "/districts", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/crm-plugin/districts'
var requestOptions = {
  method: "GET",
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/districts", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "name": "North Goa",
    "is_active": true,
    "abbreviation": "NG",
    "identifier": "NG",
    "state": {
        "id": 1,
        "name": "Goa",
        "is_active": true,
        "abbreviation": "GA",
        "identifier": "GA",
        "country": 1,
        "created_at": "2020-06-08T17:00:27.897Z",
        "updated_at": "2020-06-08T17:00:27.897Z"
    },
    "created_at": "2020-06-08T17:38:17.853Z",
    "updated_at": "2020-06-08T17:38:17.853Z",
    "villages": []
},
{
    "id": 2,
    "name": "South Goa",
    "is_active": true,
    "abbreviation": "SG",
    "identifier": "SG",
    "state": {
        "id": 1,
        "name": "Goa",
        "is_active": true,
        "abbreviation": "GA",
        "identifier": "GA",
        "country": 1,
        "created_at": "2020-06-08T17:00:27.897Z",
        "updated_at": "2020-06-08T17:00:27.897Z"
    },
    "created_at": "2020-06-08T17:38:17.853Z",
    "updated_at": "2020-06-08T17:38:17.853Z",
    "villages": []
},
{...}
]

Description

This method returns all the district details by default or specific district details with certain conditions based on the filters passed to the method

HTTP Request

GET http://localhost:1337/crm-plugin/districts

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
Filters Column attributes in the table (Optional)

Get a Specific District

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("GET", "/districts/1", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/crm-plugin/districts/1'
var requestOptions = {
  method: "GET",
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/districts/1", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

  {
    "id": 1,
    "name": "North Goa",
    "is_active": true,
    "abbreviation": "NG",
    "identifier": "NG",
    "state": {
      "id": 1,
      "name": "Goa",
      "is_active": true,
      "abbreviation": "GA",
      "identifier": "GA",
      "country": 1,
      "created_at": "2020-06-08T17:00:27.897Z",
      "updated_at": "2020-06-08T17:00:27.897Z"
    },
    "created_at": "2020-06-08T17:38:17.853Z",
    "updated_at": "2020-06-08T17:38:17.853Z",
    "villages": []
},

Description

This method returns specific district details by id.

HTTP Request

GET http://localhost:1337/crm-plugin/districts/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
ID The ID of the district to retrieve

Count All/Specific Districts

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("GET", "/districts/count", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/crm-plugin/districts/count'
var requestOptions = {
  method: "GET",
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/districts/count", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

2

Description

This method returns total number of data items present in the district.

HTTP Request

GET http://localhost:1337/crm-plugin/districts/count

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Optional

Save a Specific District

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = "{\n\t\"name\": \"Ahmedabad\",\n    \"is_active\": \"true\"\n}"
headers = {}
conn.request("POST", "/districts", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method POST \
  --timeout=0 \
  --header '' \
  --body-data '{
    "name": "Ahmedabad",
  "is_active": "true"
}' \
   'http://localhost:1337/crm-plugin/districts'
var raw = '{\n  "name": "Ahmedabad",\n    "is_active": "true"\n}';

var requestOptions = {
  method: "POST",
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/districts", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 3,
  "name": "Ahmedabad",
  "is_active": true,
  "abbreviation": "AH",
  "identifier": "AH",
  "state": {
    "id": 2,
    "name": "Gujarat",
    "is_active": true,
    "abbreviation": "GJ",
    "identifier": "GJ",
    "country": 1,
    "created_at": "2020-06-08T17:00:27.897Z",
    "updated_at": "2020-06-08T17:00:27.897Z"
  },
  "created_at": "2020-06-08T17:38:17.853Z",
  "updated_at": "2020-06-08T17:38:17.853Z",
  "villages": []
}

Description

This method creates a district with the attribute parameters passed to this method by default. It returns details of created district

HTTP Request

POST http://localhost:1337/crm-plugin/districts

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

Request Parameters

Parameter Description
name The name of the district
is_active Active status of district (Boolean value : true or false)
Column attributes Column attributes in the table (Optional)

Update a Specific District

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = "{\n\t\"name\": \"Ahmedabad --test\",\n    \"is_active\": \"true\"\n}"
headers = {}
conn.request("PUT", "/districts/3", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method PUT \
  --timeout=0 \
  --header '' \
  --body-data '{
    "name": "Ahmedabad --test",
  "is_active": "true"
}' \
   'http://localhost:1337/crm-plugin/districts/3'
var raw = '{\n  "name": "Ahmedabad --test",\n    "is_active": "true"\n}';

var requestOptions = {
  method: "PUT",
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/districts/3", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 3,
  "name": "Ahmedabad --test",
  "is_active": true,
  "abbreviation": "AH",
  "identifier": "AH",
  "state": {
    "id": 2,
    "name": "Gujarat",
    "is_active": true,
    "abbreviation": "GJ",
    "identifier": "GJ",
    "country": 1,
    "created_at": "2020-06-08T17:00:27.897Z",
    "updated_at": "2020-06-08T17:00:27.897Z"
  },
  "created_at": "2020-06-08T17:38:17.853Z",
  "updated_at": "2020-06-08T17:38:17.853Z",
  "villages": []
}

Description

This method updates the specific district by id with attribute parameters passed to it.It returns details of updated district

HTTP Request

UPDATE http://localhost:1337/crm-plugin/districts/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
ID The ID of the district to update

Request Parameters

Parameter Description
Column attributes Column attributes in the table

Delete a Specific District

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("DELETE", "/districts/2", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method DELETE \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/crm-plugin/districts/2'
var raw = "";

var requestOptions = {
  method: "DELETE",
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/districts/2", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

[
  {
    "id": 2,
    "name": "South Goa",
    "is_active": true,
    "abbreviation": "SG",
    "identifier": "SG",
    "state": {
      "id": 1,
      "name": "Goa",
      "is_active": true,
      "abbreviation": "GA",
      "identifier": "GA",
      "country": 1,
      "created_at": "2020-06-08T17:00:27.897Z",
      "updated_at": "2020-06-08T17:00:27.897Z"
    },
    "created_at": "2020-06-08T17:38:17.853Z",
    "updated_at": "2020-06-08T17:38:17.853Z",
    "villages": []
  },
  {
    "id": 3,
    "name": "Ahmedabad --test",
    "is_active": true,
    "abbreviation": "AH",
    "identifier": "AH",
    "state": {
      "id": 2,
      "name": "Gujarat",
      "is_active": true,
      "abbreviation": "GJ",
      "identifier": "GJ",
      "country": 1,
      "created_at": "2020-06-08T17:00:27.897Z",
      "updated_at": "2020-06-08T17:00:27.897Z"
    },
    "created_at": "2020-06-08T17:38:17.853Z",
    "updated_at": "2020-06-08T17:38:17.853Z",
    "villages": []
  },
  {...}
]

Description

This method deletes specific district by id and returns details of deleted district

HTTP Request

DELETE http://localhost:1337/crm-plugin/districts/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
ID The ID of the country to delete

Villages

Village stores village information belonging to a specific district.

Get All Villages

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("GET", "/villages", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/crm-plugin/villages'
var raw = "";

var requestOptions = {
  method: "GET",
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/villages", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "name": "Hivre",
    "abbreviation": null,
    "identifier": null,
    "is_active": true,
    "state": null,
    "district": null,
    "created_at": "2020-05-22T06:25:50.650Z",
    "updated_at": "2020-05-22T06:25:50.650Z",
    "contacts": []
  },
    {
    "id": 2,
    "name": "Junnar",
    "abbreviation": null,
    "identifier": null,
    "is_active": true,
    "state": null,
    "district": null,
    "created_at": "2020-05-22T07:30:20.650Z",
    "updated_at": "2020-05-22T07:30:20.650Z",
    "contacts": []
  },
  {...}
]

Description

This method returns all the village details by default or specific village details with certain conditions based on the filters passed to the method

HTTP Request

GET http://localhost:1337/crm-plugin/villages

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
Filters Column attributes in the table (Optional)

Get a Specific Village

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("GET", "/villages/1", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/crm-plugin/villages/1'
var requestOptions = {
  method: "GET",
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/villages/1", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 1,
  "name": "Hivre",
  "abbreviation": null,
  "identifier": null,
  "is_active": true,
  "state": null,
  "district": null,
  "created_at": "2020-05-22T06:25:50.650Z",
  "updated_at": "2020-05-22T06:25:50.650Z",
  "contacts": []
}

Description

This method returns specific village details by id.

HTTP Request

GET http://localhost:1337/crm-plugin/villages/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
ID The ID of the village to retrieve

Count All/Specific Villages

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("GET", "/villages/count", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/crm-plugin/villages/count'
var requestOptions = {
  method: "GET",
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/villages/count", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

2

Description

This method returns total number of data items present in the village.

HTTP Request

GET http://localhost:1337/crm-plugin/villages/count

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Optional

Save a Specific Village

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = "{\n\t\"name\": \"Narodi\"\n}"
headers = {}
conn.request("POST", "/villages", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method POST \
  --timeout=0 \
  --header '' \
  --body-data '{
    "name": "Narodi"
}' \
   'http://localhost:1337/crm-plugin/villages'
var raw = '{\n  "name": "Narodi"\n}';

var requestOptions = {
  method: "POST",
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/villages", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 3,
  "name": "Narodi",
  "abbreviation": null,
  "identifier": null,
  "is_active": true,
  "state": null,
  "district": null,
  "created_at": "2020-06-04T12:56:38.181Z",
  "updated_at": "2020-06-04T12:56:38.181Z",
  "contacts": []
}

Description

This method creates a village with the attribute parameters passed to this method by default. It returns details of created village

HTTP Request

POST http://localhost:1337/crm-plugin/villages

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

Request Parameters

Parameter Description
name The name of the village
Column attributes Column attributes in the table (Optional)

Update a Specific Village

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = "{\n\t\"name\": \"Narodi --test\"\n}"
headers = {}
conn.request("PUT", "/villages/3", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method PUT \
  --timeout=0 \
  --header '' \
  --body-data '{
    "name": "Narodi --test"
}' \
   'http://localhost:1337/crm-plugin/villages/3'
var raw = '{\n  "name": "Narodi --test"\n}';

var requestOptions = {
  method: "PUT",
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/villages/3", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 3,
  "name": "Narodi --test",
  "abbreviation": null,
  "identifier": null,
  "is_active": true,
  "state": null,
  "district": null,
  "created_at": "2020-06-04T12:56:38.181Z",
  "updated_at": "2020-06-04T12:56:38.181Z",
  "contacts": []
}

Description

This method updates the specific village by id with attribute parameters passed to it.It returns details of updated village

HTTP Request

UPDATE http://localhost:1337/crm-plugin/villages/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
ID The ID of the village to update

Request Parameters

Parameter Description
Column attributes Column attributes in the table

Delete a Specific Village

import http.client
import mimetypes
conn = http.client.HTTPSConnection("http://localhost:1337/crm-plugin")
payload = ''
headers = {}
conn.request("DELETE", "/villages/1", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
wget --no-check-certificate --quiet \
  --method DELETE \
  --timeout=0 \
  --header '' \
   'http://localhost:1337/crm-plugin/villages/1'
var raw = "";

var requestOptions = {
  method: "DELETE",
  body: raw,
  redirect: "follow",
};

fetch("http://localhost:1337/crm-plugin/villages/1", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

The above command returns JSON structured like this:

{
  "id": 1,
  "name": "Hivre",
  "abbreviation": null,
  "identifier": null,
  "is_active": true,
  "state": null,
  "district": null,
  "created_at": "2020-05-22T06:25:50.650Z",
  "updated_at": "2020-05-22T06:25:50.650Z",
  "contacts": []
}

Description

This method deletes specific village by id and returns details of deleted village

HTTP Request

DELETE http://localhost:1337/crm-plugin/villages/<ID>

Headers

Key Value
Content-Type application/json
Authorization Bearer API_TOKEN

URL Parameters

Parameter Description
ID The ID of the village to delete

Errors

The CRM Platform API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong.
403 Forbidden -- The kitten requested is hidden for administrators only.
404 Not Found -- The specified kitten could not be found.
405 Method Not Allowed -- You tried to access a kitten with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
410 Gone -- The kitten requested has been removed from our servers.
418 I'm a teapot.
429 Too Many Requests -- You're requesting too many kittens! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.