NAV
shell ruby python javascript

NextX Open Platform documentation Introduction

Welcome to the NextX API documentation! This documentation provides detailed information on how to interact with the NextX API. Contact us immediately if you need support or want to register for services.

NextX API Endpoint

Below is the fundamental API of NextX that you may integrate into your system.

Token (Authentication)

To get the access token, use this code:

require 'net/http'
require 'uri'
require 'json'

uri = URI.parse("https://open-api.nextx.vn/api/auth/token")
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = JSON.dump({
  "grant_type" => "client_credentials",
  "client_id" => "your_client_id",
  "client_secret" => "your_client_secret",
  "scope" => "public.api"
})

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
  http.request(request)
end

puts response.body
import requests

url = "https://open-api.nextx.vn/api/auth/token"
payload = {
  "grant_type": "client_credentials",
  "client_id": "your_client_id",
  "client_secret": "your_client_secret",
  "scope": "public.api"
}
headers = {'Content-Type': 'application/json'}

response = requests.post(url, json=payload, headers=headers)
print(response.json())
curl -X POST "https://open-api.nextx.vn/api/auth/token" \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
        "grant_type": "client_credentials",
        "client_id": "your_client_id",
        "client_secret": "your_client_secret",
        "scope": "public.api"
      }'
const fetch = require('node-fetch');

const url = "https://open-api.nextx.vn/api/auth/token";
const body = {
  "grant_type": "client_credentials",
  "client_id": "your_client_id",
  "client_secret": "your_client_secret",
  "scope": "public.api"
};

fetch(url, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(body)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));

Make sure to replace your_client_id and your_client_secret with your actual client credentials.

NextX API uses API keys to allow access to the API. You can register a new NextX API key at our developer portal.

NextX expects the API key to be included in all API requests to the server in a header that looks like the following:

Authorization: Bearer your_api_key_here

This command return a JSON code structured like this:

[
  "meta": {
    "message": "Incorrect credentials",
    "status_code": 1
  },
  "data": []
]

This endpoint retrieves an access token for authenticating API requests.

HTTP Request

GET https://open-api.nextx.vn/api/auth/token

Query Parameters

Parameter Type Description
grant_type string The type of grant being requested. For client credentials flow, use "client_credentials".
client_id string Your client ID.
client_secret string Your client secret.
scope string The scope of the access request. For example, "public.api".

Example Request Body

Here is an example of request body.

[
  {"grant_type": "client_credentials",
  "client_id": "8abe635c7de9896dca3a586309adfe8968e1",
  "client_secret": "D69D0112C0CC5B1EE185A43D04F3DBD",
  "scope": "public.api"
}
]

Response

The response will contain the access token and other relevant information.

If the request is successful, the server will return a JSON response with the access token.

If the credentials are incorrect, the server will return a JSON response with an error message.

This command return a JSON code structured like this:

[
 "meta": {
    "message": "Incorrect credentials",
    "status_code": 1
  },
  "data": []
}
]

User

Get All Users

Use this API to get all the users.

import requests

url = "https://api-nextcrm.nextcrm.vn/api/user/users"
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
  'https://api-nextcrm.nextcrm.vn/api/user/users' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url = 'https://api-nextcrm.nextcrm.vn/api/user/users';
const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This command return a list of JSON codes structured like this:

[
  {
    "id": 292,
            "email": "",
            "username": "nvtt1",
            "firstname": "",
            "lastname": "NVTT1",
            "joined": "03\/09\/2019",
            "designation": "",
            "picture": null,
            "tel": "0",
            "crm_extension_id": null,
            "employee_id": 37423,
            "employee": {
                "id": 37423,
                "code": "NV1011202242",
                "first_name": "",
                "last_name": "NVTT1",
                "enroll_number": "46828",
                "sex": true,
                "birthdate": null,
                "address": "",
                "tel": "",
                "email": "",
                "avatar": "",
                "id_card": "",
                "begin_date": null,
                "end_date": null,
                "is_off_work": null,
                "isPt": false,
                "isSale": false,
                "description": null,
                "branch_id": null,
                "full_name": " NVTT1",
                "model_name": "App\\Models\\Employee\\Employee",
                "position_id": null,
                "department_id": null,
                "position": null,
                "department": null,
                "id_card_place": null,
                "id_card_date": null,
                "branch_name": null,
                "pt_rating": null,
                "categories": [],
                "device_id": null,
                "card_enroll": "",
                "report_to_id": null
            },
            "isLock": 0,
            "is_access_crm": 1,
            "is_validated": 1
  }
]

This endpoint retrieves all the users.

HTTP Request

GET https://api-nextcrm.nextcrm.vn/api/user/users

Response

If the request is successful, the server will return a JSON response with the list of users.

Errors Responses If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

[
  {
    "meta": {
    "message": "Token expried",
    "status_code": 401
     },
    "data": []
  }
]

Add New User

Creates a new user.

To create a new user, use this code:

import requests
import json

url = "https://api-nextcrm.nextcrm.vn/api/user/users"
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

data = {
  "id": 292,
            "email": "",
            "username": "nvtt1",
            "firstname": "",
            "lastname": "NVTT1",
            "joined": "03\/09\/2019",
            "designation": "",
            "picture": null,
            "tel": "0",
            "crm_extension_id": null,
            "employee_id": 37423,
            "employee": {
                "id": 37423,
                "code": "NV1011202242",
                "first_name": "",
                "last_name": "NVTT1",
                "enroll_number": "46828",
                "sex": true,
                "birthdate": null,
                "address": "",
                "tel": "",
                "email": "",
                "avatar": "",
                "id_card": "",
                "begin_date": null,
                "end_date": null,
                "is_off_work": null,
                "isPt": false,
                "isSale": false,
                "description": null,
                "branch_id": null,
                "full_name": " NVTT1",
                "model_name": "App\\Models\\Employee\\Employee",
                "position_id": null,
                "department_id": null,
                "position": null,
                "department": null,
                "id_card_place": null,
                "id_card_date": null,
                "branch_name": null,
                "pt_rating": null,
                "categories": [],
                "device_id": null,
                "card_enroll": "",
                "report_to_id": null
            },
            "isLock": 0,
            "is_access_crm": 1,
            "is_validated": 1
}

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
curl -X 'POST' \
  'https://api-nextcrm.nextcrm.vn/api/user/users' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer your_access_token' \
  -d '{
  "id": 292,
            "email": "",
            "username": "nvtt1",
            "firstname": "",
            "lastname": "NVTT1",
            "joined": "03\/09\/2019",
            "designation": "",
            "picture": null,
            "tel": "0",
            "crm_extension_id": null,
            "employee_id": 37423,
            "employee": {
                "id": 37423,
                "code": "NV1011202242",
                "first_name": "",
                "last_name": "NVTT1",
                "enroll_number": "46828",
                "sex": true,
                "birthdate": null,
                "address": "",
                "tel": "",
                "email": "",
                "avatar": "",
                "id_card": "",
                "begin_date": null,
                "end_date": null,
                "is_off_work": null,
                "isPt": false,
                "isSale": false,
                "description": null,
                "branch_id": null,
                "full_name": " NVTT1",
                "model_name": "App\\Models\\Employee\\Employee",
                "position_id": null,
                "department_id": null,
                "position": null,
                "department": null,
                "id_card_place": null,
                "id_card_date": null,
                "branch_name": null,
                "pt_rating": null,
                "categories": [],
                "device_id": null,
                "card_enroll": "",
                "report_to_id": null
            },
            "isLock": 0,
            "is_access_crm": 1,
            "is_validated": 1
}'
const fetch = require('node-fetch');

const url = 'https://api-nextcrm.nextcrm.vn/api/user/users';
const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  },
  body: JSON.stringify({
   "id": 292,
            "email": "",
            "username": "nvtt1",
            "firstname": "",
            "lastname": "NVTT1",
            "joined": "03\/09\/2019",
            "designation": "",
            "picture": null,
            "tel": "0",
            "crm_extension_id": null,
            "employee_id": 37423,
            "employee": {
                "id": 37423,
                "code": "NV1011202242",
                "first_name": "",
                "last_name": "NVTT1",
                "enroll_number": "46828",
                "sex": true,
                "birthdate": null,
                "address": "",
                "tel": "",
                "email": "",
                "avatar": "",
                "id_card": "",
                "begin_date": null,
                "end_date": null,
                "is_off_work": null,
                "isPt": false,
                "isSale": false,
                "description": null,
                "branch_id": null,
                "full_name": " NVTT1",
                "model_name": "App\\Models\\Employee\\Employee",
                "position_id": null,
                "department_id": null,
                "position": null,
                "department": null,
                "id_card_place": null,
                "id_card_date": null,
                "branch_name": null,
                "pt_rating": null,
                "categories": [],
                "device_id": null,
                "card_enroll": "",
                "report_to_id": null
            },
            "isLock": 0,
            "is_access_crm": 1,
            "is_validated": 1
  })
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint creates a new user.

HTTP Request

POST https://api-nextcrm.nextcrm.vn/api/user/users

Parameters

Variable Name Data Type Detailed Description
id int The ID of the user
email string The user's email address
username string The username for logging in
firstname string The user's first name (can be empty)
lastname string The user's last name
joined string The date the user joined
designation string The user's job title or role (can be empty)
picture string The URL to the user's picture (can be null)
tel string The user's telephone number (can be null)
crm_extension_id int The CRM extension ID (can be null)
employee_id int The ID of the employee
employee object Detailed information about the employee
isLock int Whether the account is locked (0: No, 1: Yes)
is_access_crm int Whether the user has access to CRM (0: No, 1: Yes)
is_validated int Whether the user's account is validated (0: No, 1: Yes)

Response

If the request is successful, the server will return a JSON response confirming the update.

This command return a JSON code structured like this:

[
 {
   "id": 292,
            "email": "",
            "username": "nvtt1",
            "firstname": "",
            "lastname": "NVTT1",
            "joined": "03\/09\/2019",
            "designation": "",
            "picture": null,
            "tel": "0",
            "crm_extension_id": null,
            "employee_id": 37423,
            "employee": {
                "id": 37423,
                "code": "NV1011202242",
                "first_name": "",
                "last_name": "NVTT1",
                "enroll_number": "46828",
                "sex": true,
                "birthdate": null,
                "address": "",
                "tel": "",
                "email": "",
                "avatar": "",
                "id_card": "",
                "begin_date": null,
                "end_date": null,
                "is_off_work": null,
                "isPt": false,
                "isSale": false,
                "description": null,
                "branch_id": null,
                "full_name": " NVTT1",
                "model_name": "App\\Models\\Employee\\Employee",
                "position_id": null,
                "department_id": null,
                "position": null,
                "department": null,
                "id_card_place": null,
                "id_card_date": null,
                "branch_name": null,
                "pt_rating": null,
                "categories": [],
                "device_id": null,
                "card_enroll": "",
                "report_to_id": null
            },
            "isLock": 0,
            "is_access_crm": 1,
            "is_validated": 1
    }
  ]
 }
]

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

[
  {
  "meta": {
    "message": "Token expried",
    "status_code": 401
  },
  "data": []
  }
]

Update an User

To update information of an user, use this code: shell curl -X 'PUT' \ ' https://api-nextcrm.nextcrm.vn/api/user/users/{id}' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer your_access_token' \ -d '{ "name": "string", "parent_id": 0, "description": "string" }'

import requests

url = " https://api-nextcrm.nextcrm.vn/api/user/users/{id}"
payload = {
  "name": "string",
  "parent_id": 0,
  "description": "string"
}
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

response = requests.put(url, json=payload, headers=headers)
print(response.json())
const fetch = require('node-fetch');

const url = ' https://api-nextcrm.nextcrm.vn/api/user/users/{id}';
const payload = {
  name: "string",
  parent_id: 0,
  description: "string"
};
const options = {
  method: 'PUT',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(payload)
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This command return a JSON code structured like this:

[
 {
  "status_code": 0,
  "message": "string"
 }
]

This endpoint updates the details of a specific user.

HTTP Request

PUT https://api-nextcrm.nextcrm.vn/api/user/users/{id}

Parameters

Path Parameter

Parameter Type Description
id integer ID of the user

Body Parameters

Parameter Type Description
email string The user's email address
username string The username for logging in
firstname string The user's first name (can be empty)
lastname string The user's last name
joined string The date the user joined
designation string The user's job title or role (can be empty)
picture string The URL to the user's picture (can be null)
tel string The user's telephone number (can be null)
crm_extension_id int The CRM extension ID (can be null)
employee_id int The ID of the employee
employee object Detailed information about the employee
isLock int Whether the account is locked (0: No, 1: Yes)
is_access_crm int Whether the user has access to CRM (0: No, 1: Yes)
is_validated int Whether the user's account is validated (0: No, 1: Yes)

Response

If the request is successful, the server will return a JSON response confirming the update.

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

Returns JSON structured like this:

 [
  {
  "meta": {
    "message": "Token expried",
    "status_code": 401
  },
  "data": []
  }
]

Delete User

to delete an user, use this code:

import requests

url = "https://api-nextcrm.nextcrm.vn/api/user/users/{id}"
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.delete(url, headers=headers)
print(response.json())
curl -X 'DELETE' \
  'https://api-nextcrm.nextcrm.vn/api/user/users/{id}' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url = 'https://api-nextcrm.nextcrm.vn/api/user/users/{id}';
const options = {
  method: 'DELETE',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This command return a list of JSON codes structured like this:

[
  {
  "status_code": 0,
  "message": "string"
}
]

This endpoint retrieves all the users.

HTTP Request

DELETE https://api-nextcrm.nextcrm.vn/api/user/users/{id}

Response

If the request is successful, the server will return a JSON response with the list of users.

Errors Responses If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

[
  {
    "meta": {
    "message": "Token expried",
    "status_code": 401
     },
    "data": []
  }
]

Category

Get All Branches

Use this API to get all the branches.

import requests

url = "https://open-api.nextx.vn/api/branch/branch"
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
  'https://open-api.nextx.vn/api/branch/branch' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/branch/branch';
const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This command return a JSON code structured like this:

[
  {
    "id": 0,
    "name": "string",
    "code": "string",
    "tel": "string",
    "fax": "string",
    "avatar": "string",
    "address": "string",
    "description": "string"
  }
]

This endpoint retrieves all branches.

HTTP Request

GET https://open-api.nextx.vn/api/branch/branch

Response

If the request is successful, the server will return a JSON response with the list of branches.

Errors Responses If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

[
  {
    "meta": {
    "message": "Token expried",
    "status_code": 401
     },
    "data": []
  }
]

Get All Stores

To get the get all the stores, use this code:

import requests

url = "https://open-api.nextx.vn/api/branch/store"
params = {
  'branch_id': 'your_branch_id'
}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers, params=params)
print(response.json())
curl -X 'GET' \
  'https://open-api.nextx.vn/api/branch/store' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token' \
  -G --data-urlencode 'branch_id=your_branch_id'
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/branch/store';
const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This command return a JSON code structured like this:

[
  {
    "id": 0,
    "name": "string",
    "code": "string",
    "tel": "string",
    "fax": "string",
    "avatar": "string",
    "address": "string",
    "description": "string"
  }
]

This endpoint retrieves all stores for a specific branch.

HTTP Request

GET https://open-api.nextx.vn/api/branch/store

Query Parameters

Parameter Description
branch_id The ID of the branch

Response

If the request is successful, the server will return a JSON response with the list of stores.

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

[
  {
  "meta": {
    "message": "Token expried",
    "status_code": 401
  },
  "data": []
  }
]

Get All Product Category

To get all the product categories, use this code:

import requests

url = "https://open-api.nextx.vn/api/cate/category-list/product_category"
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

params = {
  'search[parent_id]': 0  # Optional: Replace with desired parent ID or remove if not needed
}

response = requests.get(url, headers=headers, params=params)
print(response.json())
curl -X 'GET' \
  'https://open-api.nextx.vn/api/cate/category-list/product_category' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/cate/category-list/product_category';
const params = new URLSearchParams({
  'search[parent_id]': 0  // Optional: Replace with desired parent ID or remove if not needed
});
const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(`${url}?${params}`, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint retrieves a list of product categories. It can optionally filter categories by their parent ID. The response includes details such as category ID, name, parent ID, picture URL, description, and child categories if applicable.

HTTP Request

GET https://open-api.nextx.vn/api/cate/category-list/product_category

Query Parameters

Parameter Type Description
parent_id integer ID of the parent category (optional)

Response

If the request is successful, the server will return a JSON response with the list of stores.

Example Response

[
  {
    "id": 0,
    "name": "string",
    "parent_id": 0,
    "picture": "string",
    "description": "string",
    "child": [
      {
        "id": 0,
        "name": "string",
        "parent_id": 0,
        "picture": "string",
        "description": "string"
      }
    ]
  }
]

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

[
  {
  "meta": {
    "message": "Token expried",
    "status_code": 401
  },
  "data": []
  }
]

Get Detail Product Category

To get the detail category, use this code:

curl -X 'GET' \
  'https://open-api.nextx.vn/api/cate/category/{id}' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
import requests

url = "https://open-api.nextx.vn/api/cate/category/{id}"
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers)
print(response.json())
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/cate/category/{id}';
const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint retrieves the details of a specific category.

This command return a JSON code structured like this:

[
  {
     "id": 0,
  "name": "string",
  "parent_id": 0,
  "picture": "string",
  "description": "string",
  "childs": [
    {
      "id": 0,
      "name": "string",
      "parent_id": 0,
      "picture": "string",
      "description": "string"
  }
]

HTTP Request

GET https://open-api.nextx.vn/api/cate/category/{id}

Parameters

Parameter Type Description
id integer ID of the category

Response

If the request is successful, the server will return a JSON response with the category details. If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

[
  {
  "meta": {
    "message": "Token expried",
    "status_code": 401
  },
  "data": []
  }
]

Update Category

To put the product category, use this code:

curl -X 'PUT' \
  'https://open-api.nextx.vn/api/cate/category/{id}' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer your_access_token' \
  -d '{
    "name": "string",
    "parent_id": 0,
    "description": "string"
  }'
import requests

url = "https://open-api.nextx.vn/api/cate/category/{id}"
payload = {
  "name": "string",
  "parent_id": 0,
  "description": "string"
}
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

response = requests.put(url, json=payload, headers=headers)
print(response.json())
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/cate/category/{id}';
const payload = {
  name: "string",
  parent_id: 0,
  description: "string"
};
const options = {
  method: 'PUT',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(payload)
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This command return a JSON code structured like this:

[
 {
  "status_code": 0,
  "message": "string"
 }
]

This endpoint updates the details of a specific category.

HTTP Request

PUT https://open-api.nextx.vn/api/cate/category/{id}

Parameters

Path Parameter

Parameter Type Description
id integer ID of the category

Body Parameters

Parameter Type Description
name string name of the category
parent_id integer Parent ID
description string description of the category

Response

If the request is successful, the server will return a JSON response confirming the update.

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

Returns JSON structured like this:

 [
  {
  "meta": {
    "message": "Token expried",
    "status_code": 401
  },
  "data": []
  }
]

If the request is not authenticated, the server will return a 401 status code with a message indicating "Unauthenticated."

Returns JSON structured like this:

[
 {
  "message": "Unauthenticated."
 }
]

Add New Product Category

Creates a new product category.

To create a new category, use this code:

import requests
import json

url = "https://open-api.nextx.vn/api/cate/category"
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

data = {
  "name": "New Category",
  "parent_id": 0,
  "category_type": "product_category",
  "description": "This is a new category"
}

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
curl -X 'POST' \
  'https://open-api.nextx.vn/api/cate/category' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer your_access_token' \
  -d '{
  "name": "New Category",
  "parent_id": 0,
  "category_type": "product_category",
  "description": "This is a new category"
}'
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/cate/category';
const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  },
  body: JSON.stringify({
    name: "New Category",
    parent_id: 0,
    category_type : "product_category",
    description: "This is a new category"
  })
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint creates a new product category. The response includes the details of the newly created category, including any child categories if applicable.

HTTP Request

POST https://open-api.nextx.vn/api/cate/category

Request Body

Example Request Body:

{
  "name": "string",
  "parent_id": 0,
  "picture": "string",
  "description": "string"
}

Parameters

Parameter Type Description
name string name of the category
parent_id integer Parent ID
category_type string Product category
description string description of the category

Response

If the request is successful, the server will return a JSON response confirming the update.

This command return a JSON code structured like this:

[
 {
  "id": 0,
  "name": "string",
  "parent_id": 0,
  "picture": "string",
  "description": "string",
  "childs": [
    {
      "id": 0,
      "name": "string",
      "parent_id": 0,
      "picture": "string",
      "description": "string"
    }
  ]
 }
]

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

[
  {
  "meta": {
    "message": "Token expried",
    "status_code": 401
  },
  "data": []
  }
]

Get All Employees

To get all the employees of a branch, use this code:

import requests

url = "https://open-api.nextx.vn/api/cate/employee"
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

params = {
  'branch_id': 1  # Optional: Replace with desired branch ID or remove if not needed
}

response = requests.get(url, headers=headers, params=params)
print(response.json())
curl -X 'GET' \
  'https://open-api.nextx.vn/api/cate/employee?branch_id=1' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/cate/employee';
const params = new URLSearchParams({
  'branch_id': 1  // Optional: Replace with desired branch ID or remove if not needed
});
const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(`${url}?${params}`, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint fetches a list of employees for a specified branch.

HTTP Request

GET https://open-api.nextx.vn/api/cate/employee

Parameters

Parameter Type Description
branch_id integer ID of the branch

Response

If the request is successful, the server will return a JSON response with the employee details.

This command return a JSON code structured like this:

[
  {
    "id": 0,
    "code": "string",
    "first_name": "string",
    "last_name": "string",
    "avatar": "string"
  }
]

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

[
  {
  "meta": {
    "message": "Token expired",
    "status_code": 401
  },
  "data": []
  }
]

Get Sales Users List

Fetches a list of sales users.

To fetch the sales users list, use this code:

import requests

url = "https://open-api.nextx.vn/api/cate/users"
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers)
print(response.json())
curl -X 'POST' \
  'https://open-api.nextx.vn/api/cate/users' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer your_access_token' \

}'
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/cate/users';
const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  },

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));

This endpoint fetches a list of sales users.

HTTP Request

POST https://open-api.nextx.vn/api/cate/users

Parameters

No parameters

Response

If the request is successful, the server will return a JSON response with the sales user details.

This command return a JSON code structured like this:

[
  {
    "id": 0,
    "name": "string",
    "firstname": "string",
    "lastname": "string"
  }
]

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

[
  {
  "meta": {
    "message": "Token expired",
    "status_code": 401
  },
  "data": []
  }
]

Get Customer Resources List

To get all the employees of a branch, use this code:

import requests

url = "https://open-api.nextx.vn/api/cate/resources"
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
  'https://open-api.nextx.vn/api/cate/resources' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/cate/resources';
const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint retrieves a list of customer resources. Each resource includes an ID and a name.

HTTP Request

GET https://open-api.nextx.vn/api/cate/resources

Query Parameters

No parameters required.

Response

If the request is successful, the server will return a JSON response with the customer resources.

This command return a JSON code structured like this:

[
  {
    "id": 0,
    "name": "string"
  }
]

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

[
  {
  "meta": {
    "message": "Token expired",
    "status_code": 401
  },
  "data": []
  }
]

Product

Get Product List

To get the products list, use this code:

import requests

url = "https://open-api.nextx.vn/api/product/product"
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

params = {
  'page': 0,
  'pageLimit': 15,
  'branch_id': 1,  # Required
  'store_id': 1,
  'type[]': ['single', 'variable'],
  'strSearch': 'product_name'
}

response = requests.get(url, headers=headers, params=params)
print(response.json())
curl -X 'GET' \
  'https://open-api.nextx.vn/api/product/product?page=0&pageLimit=15&branch_id=1&store_id=1&type[]=single&type[]=variable&strSearch=product_name' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/product/product';
const params = new URLSearchParams({
  page: 0,
  pageLimit: 15,
  branch_id: 1,  // Required
  store_id: 1,
  'type[]': ['single', 'variable'],
  strSearch: 'product_name'
});
const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(`${url}?${params}`, options)
  .then(response => response.json())
  .then(data => console.log(data));

Retrieves a list of products based on specified criteria.

HTTP Request

GET https://open-api.nextx.vn/api/product/product?page=0&pageLimit=15&branch_id=1

Query Parameters

Parameter Type Description
page integer Page number for pagination, starts from 0. Default: 0
pageLimit integer Number of items per page. Default: 15, max: 100
branch_id integer ID of the branch (required)
store_id integer ID of the store
type[] array[string] Product types: single (regular product), variable (product with variants), modifier (add-on product), combo (combination product)
strSearch string Search keyword for product name, code, or SKU

Response

If the request is successful, the server will return a JSON response with the product list.

Example Response:

[
  {
    "id": 0,
    "product_id": 0,
    "variations_id": 0,
    "product_fullname": "string",
    "product_code": "string",
    "barcode": "string",
    "product_image": "string",
    "qty_available": 0,
    "unit": "string",
    "selling_price": 0,
    "brand_name": "string",
    "category_name": "string",
    "specification": "string",
    "product_type": "string",
    "weight": 0,
    "length": "string",
    "width": "string",
    "height": "string",
    "product_variation": {
      "product_id": 0,
      "variations_id": 0,
      "unit_id": 0,
      "price": 0
    }
  }
]

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

[
  {
  "meta": {
    "message": "Token expired",
    "status_code": 401
  },
  "data": []
  }
]

Add New Product

Creates a new product.

To get the products list, use this code:

import requests
import json

url = "https://open-api.nextx.vn/api/product/product"
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

data = {
   "name": "string",
  "code": "",
  "sku": "",
  "brand_id": null,
  "branch_id": 0,
  "category_id": 0,
  "media": [
    {
      "url": "string"
    }
  ],
  "purchase_price": 0,
  "sell_price": 0,
  "weight": 0,
  "height": 0,
  "width": 0,
  "length": 0,
  "qty_begin_stock": 0,
  "begin_purchase_price": 0,
  "specification": "",
  "unit": {
    "unit_base": {
      "name": "string",
      "is_direct_sell": "true"
    },
    "sub_unit": [
      {
        "name": "string",
        "f_Convert": 1,
        "price": 0,
        "is_direct_sell": "true"
      }
    ]
  },
  "description": "",
  "product_custom_field1": "",
  "product_custom_field2": "",
  "composition_variation": [
    {
      "product_id": 0,
      "variations_id": 0,
      "quantity": 0,
      "unit_id": 0,
      "price": 0
    }
  ]
}

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
curl -X 'POST' \
  'https://open-api.nextx.vn/api/product/product' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "code": "",
  "sku": "",
  "brand_id": null,
  "branch_id": 0,
  "category_id": 0,
  "media": [
    {
      "url": "string"
    }
  ],
  "purchase_price": 0,
  "sell_price": 0,
  "weight": 0,
  "height": 0,
  "width": 0,
  "length": 0,
  "qty_begin_stock": 0,
  "begin_purchase_price": 0,
  "specification": "",
  "unit": {
    "unit_base": {
      "name": "string",
      "is_direct_sell": "true"
    },
    "sub_unit": [
      {
        "name": "string",
        "f_Convert": 1,
        "price": 0,
        "is_direct_sell": "true"
      }
    ]
  },
  "description": "",
  "product_custom_field1": "",
  "product_custom_field2": "",
  "composition_variation": [
    {
      "product_id": 0,
      "variations_id": 0,
      "quantity": 0,
      "unit_id": 0,
      "price": 0
    }
  ]
}'
const fetch = require('node-fetch');

const url = 'https://api-docs.nextx.vn/api/product/product';
const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  },
  body: JSON.stringify({
     name: "string",
  code: "",
  sku: "",
  brand_id: null,
  branch_id: 0,
  category_id: 0,
  media: [
    {
      url: "string"
    }
  ],
  purchase_price: 0,
  sell_price: 0,
  weight: 0,
  height: 0,
  width: 0,
  length: 0,
  qty_begin_stock: 0,
  begin_purchase_price: 0,
  specification: "",
  unit: {
    unit_base: {
      name: "string",
      is_direct_sell: "true"
    },
    sub_unit: [
      {
        name: "string",
        f_Convert: 1,
        price: 0,
        is_direct_sell: "true"
      }
    ]
  },
  description: "",
  product_custom_field1: "",
  product_custom_field2: "",
  composition_variation: [
    {
      product_id: 0,
      variations_id: 0,
      quantity: 0,
      unit_id: 0,
      price: 0
    }
  ]
  })
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint creates a new product. The response includes the details of the newly created product.

HTTP Request

POST https://api-docs.nextx.vn/api/product/product

Parameters

Parameter Type Description
name string Full name of the product
code string Product code. The system automatically generates a code if this field is left blank
sku string Stock Keeping Unit. The system automatically generates a code if this field is left blank
brand_id integer Brand ID (optional)
category_id integer Primary category ID
category_ids array Additional category IDs
unit_id integer Primary unit ID
units array Additional units
type string Product type
purchase_price number Purchase price
sell_price number Selling price
weight number Product weight
height number Product height
width number Product width
length number Product length
qty_begin_stock number Initial stock quantity
qty_warning_stock number Stock warning threshold
specification string Product Specification
description string Product description
product_custom_field1 string Note template (invoice, order)
product_custom_field2 string Input note (input settings, goods input)
composition_variation array Variations of product_

Response

If the request is successful, the server will return a JSON response with adding a new product.

This command return a JSON code structured like this:

{
  "name": "string",
  "code": "string",
  "sku": "string",
  "brand_id": null,
  "category_id": 0,
  "category_ids": [],
  "unit_id": 0,
  "units": [
    {
      "id": "string"
    }
  ],
  "type": "string",
  "purchase_price": 0,
  "sell_price": 0,
  "weight": 0,
  "height": 0,
  "width": 0,
  "length": 0,
  "qty_begin_stock": 0,
  "qty_warning_stock": 0
}

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

[
  {
  "meta": {
    "message": "Token expired",
    "status_code": 401
  },
  "data": []
  }
]

Get Product Detail

To get the details of a specific product by its ID, use this code:

import requests

url = "https://open-api.nextx.vn/api/product/product-detail"
params = {
  'variation_id': 1,
  'branch_id': 1,
  'store_id': 1
}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers, params=params)
print(response.json())
curl -X 'GET' \
  'https://open-api.nextx.vn/api/product/product-detail?variation_id=1&branch_id=1&store_id=1' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url = 'https:/open-api.nextx.vn/api/product/product-detail?variation_id=1&branch_id=1&store_id=1';
const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint retrieves the details of a specific product by its ID.

HTTP Request

GET https://open-api.nextx.vn/api/product/product-detail?variation_id={}&branch_id={}&store_id={}

Parameters

Parameter Type Description
variation_id integer ID of variation
branch_id integer ID of branch
store_id integer ID of store

Response

If the request is successful, the server will return a JSON response with the product details.

This command return a JSON code structured like this:

{
  "id": 0,
  "product_id": 0,
  "variations.id": 0,
  "product_name": "string",
  "product_actual_name": "string",
  "product_code": "string",
  "product_sku": "string",
  "product_image": "string",
  "qty_available": 0,
  "default_purchase_price": 0,
  "default_sell_price": 0,
  "product_type": "string",
  "specification": "string",
  "height": "string",
  "width": "string",
  "length": "string",
  "weight": "string",
  "computations": {
    "product_id": 0,
    "variations.id": 0,
    "unit_id": 0,
    "price": 0
  }
  ],
  "unit_id": "string",
  "unit": "string",
  "units": [
    {
      "id": 0,
      "name": 0,
      "is_base_unit": 0,
      "multiplier": 0,
      "price": 0
    }
  ]
}

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

{
  "meta": {
    "message": "Token expired",
    "status_code": 401
  },
  "data": []
}

Update Product Detail

To update the details of a specific product, use this code:

import requests

url = "https://open-api.nextx.vn/api/product/product/1"
data = {
  "name": "string",
  "code": "",
  "sku": "",
  "brand_id": null,
  "branch_id": 0,
  "category_id": 0,
  "media": [
    {
      "url": "string"
    }
  ],
  "purchase_price": 0,
  "sell_price": 0,
  "weight": 0,
  "height": 0,
  "width": 0,
  "length": 0,
  "qty_begin_stock": 0,
  "begin_purchase_price": 0,
  "specification": "",
  "description": "",
  "product_custom_field1": "",
  "product_custom_field2": "",
  "composition_variation": [
    {
      "product_id": 0,
      "variations_id": 0,
      "quantity": 0,
      "unit_id": 0,
      "price": 0
    }
  ]
}
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.put(url, headers=headers, json=data)
print(response.json())
curl -X 'PUT' \
  'https://open-api.nextx.vn/api/product/product/1' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "code": "",
  "sku": "",
  "brand_id": null,
  "branch_id": 0,
  "category_id": 0,
  "media": [
    {
      "url": "string"
    }
  ],
  "purchase_price": 0,
  "sell_price": 0,
  "weight": 0,
  "height": 0,
  "width": 0,
  "length": 0,
  "qty_begin_stock": 0,
  "begin_purchase_price": 0,
  "specification": "",
  "description": "",
  "product_custom_field1": "",
  "product_custom_field2": "",
  "composition_variation": [
    {
      "product_id": 0,
      "variations_id": 0,
      "quantity": 0,
      "unit_id": 0,
      "price": 0
    }
  ]
}'
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/product/product/1';
const options = {
  method: 'PUT',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Authorization': 'Bearer your_access_token'
  },
  body: JSON.stringify({
     name: "string",
  code: "",
  sku: "",
  brand_id: null,
  branch_id: 0,
  category_id: 0,
  media: [
    {
      url: "string"
    }
  ],
  purchase_price: 0,
  sell_price: 0,
  weight: 0,
  height: 0,
  width: 0,
  length: 0,
  qty_begin_stock: 0,
  begin_purchase_price: 0,
  specification: "",
  description: "",
  product_custom_field1: "",
  product_custom_field2: "",
  composition_variation: [
    {
      product_id: 0,
      variations_id: 0,
      quantity: 0,
      unit_id: 0,
      price: 0
    }
  ]
  })
};
fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint updates the details of a specific product. Make sure to replace all the information of the product need updating with yours.

HTTP Request

PUT https://open-api.nextx.vn/api/product/product/{id}

Paramaters

Path Parameters

Parameter Type Description
id integer ID of the product

Request Body Parameters

Parameter Type Description
name string Full name of the product
code string Product code. The system automatically generates a code if this field is left blank
sku string Stock Keeping Unit. The system automatically generates a code if this field is left blank
brand_id integer Brand ID (optional)
category_id integer Primary category ID
category_ids array Additional category IDs
unit_id integer Primary unit ID
units array Additional units
type string Product type
purchase_price number Purchase price
sell_price number Selling price
weight number Product weight
height number Product height
width number Product width
length number Product length
qty_begin_stock number Initial stock quantity
qty_warning_stock number Stock warning threshold
specification string Product Specification
description string Product description
product_custom_field1 string Note template (invoice, order)
product_custom_field2 string Input note (input settings, goods input)
composition_variation array Variations of product_

Response

If the request is successful, the server will return a JSON response with the status code and message.

This command return a JSON code structured like this:

{
  "status_code": 0,
  "message": "string"
}

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

 {
  "name": "string",
  "code": "",
  "sku": "",
  "brand_id": null,
  "branch_id": 0,
  "category_id": 0,
  "media": [
    {
      "url": "string"
    }
  ],
  "purchase_price": 0,
  "sell_price": 0,
  "weight": 0,
  "height": 0,
  "width": "",
  "length": "",
  "qty_begin_stock": 0,
  "begin_purchase_price": 0,
  "specification": "",
  "description": "",
  "product_custom_field1": "",
  "product_custom_field2": "",
  "composition_variation": [
    {
      "product_id": 0,
      "variations_id": 0,
      "quantity": 0,
      "unit_id": 0,
      "price": 0
    }
  ]
}

Contact (LEAD)

Get Lead List

To get the list of all leads, use this code:

import requests

url = "https://open-api.nextx.vn/api/contact/contact"
params = {
  "page": 0,
  "pageLimit": 0,
  "branch_id": 0,
  "category_id": 0,
  "sttsearch": " ",
  "from_date": " ",
  "to_date": " "
}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers, params=params)
print(response.json())
curl -X 'GET' \
  'https://open-api.nextx.vn/api/contact/contact?page=0&pageLimit=15&branch_id=1&category_id=2&sttsearch=search_term&from_date=2022-01-01&to_date=2022-12-31' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/contact/contact';
const params = new URLSearchParams({
  page: 0,
  pageLimit: 0,
  branch_id: 0,
  category_id: 0,
  sttsearch: ' ',
  from_date: ' ',
  to_date: ' '
});

const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(`${url}?${params}`, options)a

This endpoint retrieves a list of leads. Make sure to replace all the information of the leads list with yours.

HTTP Request

GET https://open-api.nextx.vn/api/contact/contact

Parameters

Parameter Type Description
page integer Index of the list (Start from 0)
pageLimit integer Number of items per page, default 15 items, max 100 items (default: 15)
branch_id integer ID of the branch
category_id integer Primary category ID
sttsearch string Search term for name, code, or phone number of the lead
from_date string Filter from the starting date of receiving leads, format Y-m-d
units string Filter to the ending date of receiving leads, format Y-m-d

Response

If the request is successful, the server will return a JSON response with the lead list.

This command return a JSON code structured like this:

[
  {
    "id": 0,
    "categories": [
      {
        "id": 0,
        "name": "string",
        "parent_id": 0,
        "picture": "string",
        "description": "string",
        "childs": [
          {
            "id": 0,
            "name": "string",
            "parent_id": 0,
            "picture": "string",
            "description": "string"
          }
        ]
      }
    ],
    "employee": {
      "id": 0,
      "code": "string",
      "first_name": "string",
      "last_name": "string",
      "avatar": "string"
    },
    "branch": {
      "id": 0,
      "name": "string",
      "code": "string",
      "tel": "string",
      "fax": "string",
      "avatar": "string",
      "address": "string",
      "description": "string"
    },
    "resources": [
      {
        "id": 0,
        "name": "string"
      }
    ],
    "name": "",
    "mobile": "",
    "email": "",
    "website": "",
    "address": "",
    "status": "",
    "date_assigned": "2024-08-03",
    "code": "",
    "birthday": "2024-08-03",
    "sex": "male",
    "description": "",
    "avatar": "",
    "account_name": "",
    "account_address": "",
    "account_no": ""
  }
]

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

{
  "meta": {
    "message": "Token expired",
    "status_code": 401
  },
  "data": []
}

Add New Lead

Creates a new lead contact.

To use this API, use this code:

import requests
import json

url = "https://open-api.nextx.vn/api/contact/contact"
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

data = {
  "employee_id": null,
  "branch_id": null,
  "resources": [
    {
      "id": 0,
      "name": "string"
    }
  ],
  "name": "",
  "mobile": "",
  "email": "",
  "website": "",
  "address": "",
  "status": "",
  "date_assigned": "2024-08-03",
  "code": "",
  "birthday": "2024-08-03",
  "sex": "male",
  "description": "",
  "avatar": "",
  "account_name": "",
  "account_address": "",
  "account_no": ""
}

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
curl -X 'POST' \
  'https://open-api.nextx.vn/api/contact/contact' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "employee_id": null,
  "branch_id": null,
  "resources": [
    {
      "id": 0,
      "name": "string"
    }
  ],
  "name": "",
  "mobile": "",
  "email": "",
  "website": "",
  "address": "",
  "status": "",
  "date_assigned": "2024-08-13",
  "code": "",
  "birthday": "2024-08-13",
  "sex": "male",
  "description": "",
  "avatar": "",
  "account_name": "",
  "account_address": "",
  "account_no": ""
}'
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/contact/contact';
const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  },
  body: JSON.stringify({
    employee_id: null,
  branch_id: null,
  resources: [
    {
      id: 0,
      name: " "
    }
  ],
  name: "",
  mobile: "",
  email: "",
  website: "",
  address: "",
  status: "",
  date_assigned: "2024-08-03",
  code: "",
  birthday: "2024-08-03",
  sex: "male",
  description: "",
  avatar: "",
  account_name: "",
  account_address: "",
  account_no: ""
  })
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint creates a new lead contact. The response includes a status code and message indicating success or failure.

HTTP Request

POST https://open-api.nextx.vn/api/contact/contact

Parameters

Body Request Parameters

Parameter Type Description
employee_id integer ID of the employee
branch_id integer ID of the branch
resources array Lead resources
name string name of the Lead
mobile number Mobile phone number
email string email
website string website
address string address of lead
status string status
date_assigned string assigned date of lead
code integer lead code
birthday string lead's birthday
sex string Lead's gender
description string Lead's note and description
avatar string URL or path to the lead's avatar image
account_name string Name of the account
account_address string Account's address
account_no integer Account number

Response

If the request is successful, the server will return a JSON response with the list of leads.

This command return a JSON code structured like this:

 {
  "employee_id": null,
  "branch_id": null,
  "resources": [
    {
      "id": 0,
      "name": "string"
    }
  ],
  "name": "",
  "mobile": "",
  "email": "",
  "website": "",
  "address": "",
  "status": "",
  "date_assigned": "2024-08-03",
  "code": "",
  "birthday": "2024-08-03",
  "sex": "male",
  "description": "",
  "avatar": "",
  "account_name": "",
  "account_address": "",
  "account_no": ""
}

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

{
  "meta": {
    "message": "Token expired",
    "status_code": 401
  },
  "data": []
}

Get Lead Details

import requests

url = "https://open-api.nextx.vn/api/contact/contact/1"  # Replace 1 with the actual lead ID
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}


response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
  'https://open-api.nextx.vn/api/contact/contact/1' \  # Replace 1 with the actual lead ID
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/contact/contact/1';  // Replace 1 with the actual lead ID
const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint retrieves detailed information about a specific lead, including associated contacts and assigned employee.

HTTP Request

GET https://open-api.nextx.vn/api/contact/contact/{id}

Path Parameters

Parameter Type Description
id integer ID of the lead (required)

Response

If the request is successful, the server will return a JSON response with the list of leads.

Example Response:

{
  "id": 0,
  "contact_id": [
    {
      "id": 0,
      "name": "string",
      "parent_id": 0,
      "description": "string",
      "childs": [
        {
          "id": 0,
          "name": "string",
          "parent_id": 0,
          "picture": "string",
          "description": "string"
        }
      ]
    }
  ],
  "employee": {
    "id": 0,
    "code": "string",
    "first_name": "string",
    "last_name": "string",
    "email": "string",
    "phone": "string"
  }
}

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

{
  "meta": {
    "message": "Token expired",
    "status_code": 401
  },
  "data": []
}

Update Lead Information

To update the lead information, use this code:

import requests
import json

url = "https://api-docs.nextx.vn/api/contact/contact/1"  # Replace 1 with the actual lead ID
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

data = {
"employee_id": null,
  "branch_id": null,
  "resources": [
    {
      "id": 0,
      "name": "string"
    }
  ],
  "name": "",
  "mobile": "",
  "email": "",
  "website": "",
  "address": "",
  "status": "",
  "date_assigned": "2024-08-13",
  "code": "",
  "birthday": "2024-08-13",
  "sex": "male",
  "description": "",
  "avatar": "",
  "account_name": "",
  "account_address": "",
  "account_no": ""
  }

response = requests.put(url, headers=headers, data=json.dumps(data))
print(response.json())
curl -X 'PUT' \
  'https://open-api.nextx.vn/api/contact/contact/1' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "employee_id": null,
  "branch_id": null,
  "resources": [
    {
      "id": 0,
      "name": "string"
    }
  ],
  "name": "",
  "mobile": "",
  "email": "",
  "website": "",
  "address": "",
  "status": "",
  "date_assigned": "2024-08-13",
  "code": "",
  "birthday": "2024-08-13",
  "sex": "male",
  "description": "",
  "avatar": "",
  "account_name": "",
  "account_address": "",
  "account_no": ""
}'
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/contact/contact/1';  // Replace 1 with the actual lead ID
const options = {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
    },
  body: JSON.stringify({
   employee_id: null,
  branch_id: null,
  resources: [
    {
      id: 0,
      name: "string"
    }
  ],
  name: '',
  mobile: '',
  email: '',
  website: '',
  address: '',
  status: '',
  date_assigned: '2024-08-13',
  code: '',
  birthday: '2024-08-13',
  sex: 'male',
  description: '',
  avatar: '',
  account_name: '',
  account_address: '',
  account_no: ''
   })
};



fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

Updates the information of an existing lead.

HTTP Request

PUT https://open-api.nextx.vn/api/contact/contact/{id}

Path Parameters

Parameter Type Description
id integer ID of the lead to update (required)

Request Body

Example Request Body:

{
  "employee_id": null,
  "branch_id": null,
  "name": {
    "full": "string",
    "first": "string",
    "last": "string"
  },
  "code": "string",
  "email": "string",
  "mobile": "string",
  "phone": "string",
  "status": "string",
  "date_assigned": "2024-08-03",
  "date_next": "2024-08-03",
  "birthday": "2024-08-03",
  "sex": "string",
  "description": "string",
  "avatar": "string",
  "account_type": "string",
  "account_name": "string",
  "account_no": "string"
}

Response

If the request is successful, the server will return a JSON response with the list of leads. If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

{
  "meta": {
    "message": "Token expired",
    "status_code": 401
  },
  "data": []
}

Customer (Customer or Provider)

Get Customer List

To get the list of all customer, use this code:

import requests

url = "https://open-api.nextx.vn/api/customer/customer"
params = {
  "page": 0,
  "pageLimit": 0,
  "branch_id": 0,
  "category_id": 0,
  "sttsearch": " ",
  "from_date": " ",
  "to_date": " "
}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers, params=params)
print(response.json())
curl -X 'GET' \
  'https://open-api.nextx.vn/api/customer/customer"
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/customer/customer";
const params = new URLSearchParams({
  page: 0,
  pageLimit: 0,
  branch_id: 0,
  category_id: 0,
  sttsearch: ' ',
  from_date: ' ',
  to_date: ' '
});

const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(`${url}?${params}`, options)a

This endpoint retrieves a list of leads. Make sure to replace all the information of the leads list with yours.

HTTP Request

GET https://open-api.nextx.vn/api/customer/customer

Parameters

Parameter Type Description
page integer Index of the list (Start from 0)
pageLimit integer Number of items per page, default 15 items, max 100 items (default: 15)
branch_id integer ID of the branch
category_id integer Primary category ID
sttsearch string Search term for name, code, or phone number of the lead
from_date string Filter from the starting date of receiving leads, format Y-m-d
units string Filter to the ending date of receiving leads, format Y-m-d

Response

If the request is successful, the server will return a JSON response with the customer list.

This command return a JSON code structured like this:

[
[
  {
    "id": 0,
    "name": "string",
    "code": "string",
    "mobile": "string",
    "gender": "string",
    "birthday": "2024-08-03",
    "address": "string",
    "description": "string",
    "day_over_due": 0,
    "opening_balance": 0,
    "credit_limit": 0,
    "resources": [
      {
        "id": 0,
        "name": "string"
      }
    ],
    "account_name": "",
    "account_address": "",
    "account_no": ""
  }
]

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

{
  "meta": {
    "message": "Token expired",
    "status_code": 401
  },
  "data": []
}

Add New Customer

To add a new customer or supplier, use this code:

import requests

url = "https://open-api.nextx.vn/api/customer/customer"
payload = {
  "avatar": "",
  "contact_id": "",
  "name": "string",
  "mobile": "",
  "email": "",
  "address": "",
  "tax_number": "",
  "type": "customer",
  "customer_group_id": None,
  "birthday": "2024-08-06",
  "gender": 0,
  "opening_balance": 0,
  "credit_limit": 0,
  "per_turn_debt": None,
  "branch_id": None,
  "resources": [
    {
      "id": 0,
      "name": "string"
    }
  ],
  "account_name": "",
  "account_address": "",
  "account_no": ""
}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token',
  'Content-Type': 'application/json'
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())
curl -X 'POST' \
  'https://open-api.nextx.vn/api/customer/customer' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token' \
  -H 'Content-Type: application/json' \
  -d '{
  "avatar": "",
  "contact_id": "",
  "name": "string",
  "mobile": "",
  "email": "",
  "address": "",
  "tax_number": "",
  "type": "customer",
  "customer_group_id": null,
  "birthday": "2024-08-06",
  "gender": 0,
  "opening_balance": 0,
  "credit_limit": 0,
  "per_turn_debt": null,
  "branch_id": null,
  "resources": [
    {
      "id": 0,
      "name": "string"
    }
  ],
  "account_name": "",
  "account_address": "",
  "account_no": ""
}'
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/customer/customer';
const payload = {
  avatar: "",
  contact_id: "",
  name: "string",
  mobile: "",
  email: "",
  address: "",
  tax_number: "",
  type: "customer",
  customer_group_id: null,
  birthday: "2024-08-06",
  gender: 0,
  opening_balance: 0,
  credit_limit: 0,
  per_turn_debt: null,
  branch_id: null,
  resources: [
    {
      id: 0,
      name: "string"
    }
  ],
  account_name: "",
  account_address: "",
  account_no: ""
};

const options = {
  method: 'POST',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(payload)
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint is used to add a new customer or supplier.

HTTP Request

POST https://open-api.nextx.vn/api/customer/customer

Parameters

Request Body Parameters

Parameter Type Description
avatar string Avatar URL of the customer
contact_id string Contact ID of the customer
name string Name of the customer
mobile string Mobile number of the customer
email string Email address of the customer
address string Address of the customer
tax_number string Tax number of the customer
type string Type, either "customer" or "supplier"
customer_group_id integer ID of the customer group (optional)
birthday string Birthday of the customer, format Y-m-d
gender integer Gender of the customer
opening_balance integer Opening balance of the customer
credit_limit integer Credit limit of the customer
per_turn_debt integer Per turn debt of the customer (optional)
branch_id integer Branch ID associated with the customer
resources array List of resources associated with customer
account_name string Account name of the customer
account_address string Account address of the customer
account_no string Account number of the customer

Response

If the request is successful, the server will return a JSON response with the status and message.

The above command returns JSON structured like this:

{
  "status_code": 0,
  "message": "string"
}

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

{
  "meta": {
    "message": "Token expired",
    "status_code": 401
  },
  "data": []
}

Get Customer Details

To get detailed information about a specific customer or supplier, use this code:

import requests

url = "https://open-api.nextx.vn/api/customer/customer/{id}"
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
  'https://open-apinextx.vn/api/customer/customer/{id}' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/customer/customer/{id}';
const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint retrieves detailed information about a specific customer or supplier.

HTTP Request

GET https://open-api.nextx.vn/api/customer/customer/{id}

Parameters

Path Parameters

Parameter Type Description
id integer The ID of the customer or supplier.

Response

If the request is successful, the server will return a JSON response with the status and message.

The above command returns JSON structured like this:

{
  "id": 0,
  "employers": {
    "id": 0,
    "code": "string",
    "first_name": "string",
    "last_name": "string",
    "avatar": "string"
  },
  "avatar": "",
  "contact_id": 0,
  "name": "string",
  "code": "string",
  "first_name": "string",
  "last_name": "string",
  "mobile": "string",
  "address": "string",
  "description": "",
  "fax_number": "",
  "type": "customer",
  "customer_group_id": null,
  "birthday": "2024-08-06",
  "gender": 0,
  "opening_balance": 0,
  "credit_limit": 0,
  "pay_term_number": null,
  "pay_term": "",
  "branch_id": null,
  "resources": [
    {
      "id": 0,
      "name": "string"
    }
  ]
}

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

{
  "meta": {
    "message": "Token expired",
    "status_code": 401
  },
  "data": []
}

Update New Customer

To update customer or supplier information, use this code:

import requests
import json

url = "https:/open-api.nextx.vn/api/customer/customer/1"  # Replace 1 with the actual customer ID
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

data = {
 "avatar": "",
  "contact_id": "",
  "name": "string",
  "mobile": "",
  "email": "",
  "address": "",
  "tax_number": "",
  "type": "customer",
  "customer_group_id": None,
  "birthday": "2024-08-06",
  "gender": 0,
  "opening_balance": 0,
  "credit_limit": 0,
  "per_turn_debt": None,
  "branch_id": None,
  "resources": [
    {
      "id": 0,
      "name": "string"
    }
  ],
  "account_name": "",
  "account_address": "",
  "account_no": ""
}

response = requests.put(url, headers=headers, data=json.dumps(data))
print(response.json())
curl -X 'PUT' \
  'https://open-api.nextx.vn/api/customer/customer/1' \  # Replace 1 with the actual customer ID
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer your_access_token' \
  -d '{
"avatar": "",
  "contact_id": "",
  "name": "string",
  "mobile": "",
  "email": "",
  "address": "",
  "tax_number": "",
  "type": "customer",
  "customer_group_id": null,
  "birthday": "2024-08-06",
  "gender": 0,
  "opening_balance": 0,
  "credit_limit": 0,
  "per_turn_debt": null,
  "branch_id": null,
  "resources": [
    {
      "id": 0,
      "name": "string"
    }
  ],
  "account_name": "",
  "account_address": "",
  "account_no": ""
}'
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/customer/customer/1';  // Replace 1 with the actual customer ID
const options = {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  },
  body: JSON.stringify({
    avatar: "",
  contact_id: "",
  name: "string",
  mobile: "",
  email: "",
  address: "",
  tax_number: "",
  type: "customer",
  customer_group_id: null,
  birthday: "2024-08-06",
  gender: 0,
  opening_balance: 0,
  credit_limit: 0,
  per_turn_debt: null,
  branch_id: null,
  resources: [
    {
      id: 0,
      name: "string"
    }
  ],
  account_name: "",
  account_address: "",
  account_no: ""
  })
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

Updates the information of an existing customer.

HTTP Request

PUT https://open-api.nextx.vn/api/customer/customer/{id}

Path Parameters

Parameter Type Description
id integer ID of the customer to update (required)

Response

If the request is successful, the server will return a JSON response with the status and message.

The above command returns JSON structured like this:

{
  "avatar": "",
  "contact_id": "",
  "name": "string",
  "mobile": "",
  "email": "",
  "address": "",
  "description": "",
  "tax_number": "",
  "type": "customer",
  "customer_group_id": null,
  "employee_id": null,
  "birthday": "2024-08-06",
  "gender": "1",
  "opening_balance": 0,
  "credit_limit": 0,
  "pay_term_number": null,
  "branch_id": null,
  "resources": [
    {
      "id": 0,
      "name": "string"
    }
  ],
  "account_name": "",
  "account_address": "",
  "account_no": ""
}

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

{
  "meta": {
    "message": "Token expired",
    "status_code": 401
  },
  "data": []
}

Purchase Order

Get Order List

To get orders list, use this code:

import requests

url = "https://open-api.nextx.vn/api/purchase/purchase"
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

params = {
  'page': 0,
  'pageLimit': 15,
  'branch_id': 1,  # Required
  'store_id': 1,
  'type[]': ['single', 'variable'],
  'strSearch': 'product_name'
}

response = requests.get(url, headers=headers, params=params)
print(response.json())
curl -X 'GET' \
  'https://https://open-api.nextx.vn/api/purchase/purchase'
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/purchase/purchase';
const params = new URLSearchParams({
  page: 0,
  pageLimit: 15,
  branch_id: 1,  // Required
  store_id: 1,
  'type[]': ['single', 'variable'],
  strSearch: 'product_name'
});
const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(`${url}?${params}`, options)
  .then(response => response.json())
  .then(data => console.log(data));

Retrieves a list of orders.

HTTP Request

GET /https://open-api.nextx.vn/api/purchase/purchase

Query Parameters

Parameter Type Description
page integer Page number for pagination, starts from 0. Default: 0
pageLimit integer Number of items per page. Default: 15, max: 100
branch_id integer ID of the branch (required)
store_id integer ID of the store
type[] array[string] Product types: single (regular product), variable (product with variants), modifier (add-on product), combo (combination product)
strSearch string Search keyword for product name, code, or SKU

Response

If the request is successful, the server will return a JSON response with the order list.

Example Response:

[
  {
    "id": 0,
    "transaction_date": "2024-08-06",
    "invoice_no": "string",
    "customer_id": 0,
    "customer_name": "string",
    "customer_mobile": "string",
    "customer_address": "string",
    "customer_description": "string",
    "payment_status": "string",
    "final_total": "string",
    "tax_amount": "string",
    "discount_amount": "string",
    "discount_type": "string",
    "total_before_tax": "string",
    "shipping_status": "ordered",
    "additional_notes": "string",
    "staff_note": "string",
    "added_by": {
      "id": 0,
      "name": "string",
      "firstname": "string",
      "lastname": "string"
    },
    "total_paid": "string",
    "branch_name": "string",
    "total_items": 0,
    "approved_status": "string"
  }
]

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

{
  "meta": {
    "message": "Token expired",
    "status_code": 401
  },
  "data": []
}

Add New Order

To adđ an new order, use this code:

import requests  

url = "https://open-api.nextx.vn/api/purchase/purchase"  
headers = {  
    "Authorization": "Bearer YOUR_TOKEN",  
    "Content-Type": "application/json"  
}  
data = {  
    "invoice_no": "",
  "transaction_date": "2024-08-13",
  "customer_id": 0,
  "branch_id": 0,
  "store_id": 0,
  "discount_type": "fixed",
  "discount_amount": 0,
  "total_before_tax": 0,
  "tax_amount": 0,
  "final_total": 0,
  "shipping_status": "ordered",
  "approved_status": false,
  "additional_notes": "",
  "staff_note": "",
  "products": [
    {
      "id_sort": 0,
      "product_id": 0,
      "variation_id": 0,
      "unit_price": 0,
      "unit_id": 0,
      "f_convert": 1,
      "f_convert1": 1,
      "f_convert2": 1,
      "f_convert3": 1,
      "tax_id": null,
      "item_tax": 0,
      "quantity": 0,
      "sell_line_note": "",
      "line_discount_type": "fixed",
      "line_discount_amount": 0
    }
  ],
  "payment": [
    {
      "note": "",
      "payment_type": "in_come",
      "method": "cash",
      "amount": 0,
      "account_id": null
    }
  ]
}  

response = requests.post(url, headers=headers, json=data)  

curl -X 'POST' \
  'https://open-api.nextx.vn/api/purchase/purchase' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "invoice_no": "",
  "transaction_date": "2024-08-13",
  "customer_id": 0,
  "branch_id": 0,
  "store_id": 0,
  "discount_type": "fixed",
  "discount_amount": 0,
  "total_before_tax": 0,
  "tax_amount": 0,
  "final_total": 0,
  "shipping_status": "ordered",
  "approved_status": false,
  "additional_notes": "",
  "staff_note": "",
  "products": [
    {
      "id_sort": 0,
      "product_id": 0,
      "variation_id": 0,
      "unit_price": 0,
      "unit_id": 0,
      "f_convert": 1,
      "f_convert1": 1,
      "f_convert2": 1,
      "f_convert3": 1,
      "tax_id": null,
      "item_tax": 0,
      "quantity": 0,
      "sell_line_note": "",
      "line_discount_type": "fixed",
      "line_discount_amount": 0
    }
  ],
  "payment": [
    {
      "note": "",
      "payment_type": "in_come",
      "method": "cash",
      "amount": 0,
      "account_id": null
    }
  ]
}'
const axios = require('axios');  

const url = 'https://open-api.nextx.vn/api/purchase/purchase';  
const headers = {  
  'Authorization': 'Bearer YOUR_TOKEN',  
  'Content-Type': 'application/json'  
};  
const data = {  
  invoice_no: "",
  transaction_date: "2024-08-13",
  customer_id: 0,
  branch_id: 0,
  store_id: 0,
  discount_type: "fixed",
  discount_amount: 0,
  total_before_tax: 0,
  tax_amount: 0,
  final_total: 0,
  shipping_status: "ordered",
  approved_status: false,
  additional_notes: "",
  staff_note: "",
  products: [
    {
      id_sort: 0,
      product_id: 0,
      variation_id: 0,
      unit_price: 0,
      unit_id: 0,
      f_convert: 1,
      f_convert1: 1,
      f_convert2: 1,
      f_convert3: 1,
      tax_id": null,
      item_tax: 0,
      quantity: 0,
      sell_line_note: "",
      line_discount_type: "fixed",
      line_discount_amount: 0
    }
  ],
  payment: [
    {
      note: "",
      payment_type: "in_come",
      method: "cash",
      amount: 0,
      account_id: null
    }
  ]
};  

axios.post(url, data, { headers })  
  .then(response => {  
    console.log('Purchase order created successfully!');  
  })  
  .catch(error => {  
    console.error('Error:', error.response.data);  
  });

Retrieves create a new order.

HTTP Request

POST https://open-api.nextx.vn/api/purchase/purchase

Parameters

Parameter Type Description
transaction_date string Transaction date (YYYY-MM-DD)
customer_id integer ID of client
store_id integer ID of store
payment_method string Payment-method
discount_amount number Discount amount
final_total number Total of the order
is_paid boolean Payment status (true/false)
products array List of product in order
products[].id integer ID of the products
products[].sort integer Sort of the products
products[].unit_price number Product price
products[].qty number Quanity of products
products[].total_price number Total price of products
products[].discount number Discount of products
products[].comment string Comment of products

### Response If the request is successful, the server will return a success message.

The response will be in JSON format as follows:

{  
  "message": "Purchase order created successfully",  
  "data": {
  "invoice_no": "",
  "transaction_date": "2024-08-07",
  "customer_id": 0,
  "branch_id": 0,
  "store_id": 0,
  "discount_type": "fixed",
  "discount_amount": 0,
  "total_before_tax": 0,
  "tax_amount": 0,
  "final_total": 0,
  "shipping_status": "ordered",
  "approved_status": false,
  "additional_notes": "",
  "staff_note": "",
  "products": [
    {
      "id_sort": 0,
      "product_id": 0,
      "variation_id": 0,
      "unit_price": 0,
      "unit_id": 0,
      "f_convert": 1,
      "f_convert1": 1,
      "f_convert2": 1,
      "f_convert3": 1,
      "tax_id": null,
      "item_tax": 0,
      "quantity": 0,
      "sell_line_note": "",
      "line_discount_type": "fixed",
      "line_discount_amount": 0
    }
  ],
  "payment": [
    {
      "note": "",
      "payment_type": "in_come",
      "method": "cash",
      "amount": 0,
      "account_id": null
    }
  ]
}  
    ]  
  }  
} 

If the token is expired or invalid, the server will return a 401 error with a message indicating that the token has expired.

The response will be in JSON format as follows:

{  
  "meta": {  
    "message": "Token has expired",  
    "status_code": 401  
  },  
  "data": []  
}  

Get Detail Purchase Order

To get the details of a purchase order, use this code:


curl -X 'GET' \
  'https://open-api.nextx.vn/api/purchase/purchase-by-code/{code}' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
import requests

url = "https://open-api.nextx.vn/api/purchase/purchase-by-code/{code}"
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers)
print(response.json())
javascript
Copy code
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/purchase/purchase-by-code/{code}';
const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint retrieves the details of a specific purchase order.

HTTP Request

GET https://open-api.nextx.vn/api/purchase/purchase-by-code/{code}

Parameters

Parameter Type Description
code string Code of the order

Response

If the request is successful, the server will return a success message. The above command returns JSON structured like this:

{
  "id": 0,
  "transaction_date": "2024-08-07",
  "invoice_no": "string",
  "discount_type": "string",
  "discount_amount": "string",
  "total_before_tax": "string",
  "tax_amount": "string",
  "final_total": "string",
  "shipping_status": "ordered",
  "approved_status": "string",
  "additional_notes": "string",
  "customer": {
    "id": 0,
    "name": "string",
    "code": "string",
    "mobile": "string",
    "gender": "string",
    "birthday": "2024-08-07",
    "address": "string",
    "account_address": "",
    "account_no": ""
  },
  "created_by": {
    "id": 0,
    "name": "string",
    "firstname": "string",
    "lastname": "string"
  },
  "branch": {
    "id": 0,
    "name": "string",
    "code": "string",
    "tel": "string",
    "fax": "string",
    "avatar": "string",
    "address": "string",
    "description": "string"
  },
  "products": [
    {
      "id": 0,
      "product_id": 0,
      "variation_id": 0,
      "product_name": "string",
      "product_code": "string",
      "sub_sku": "string",
      "product_image": "string",
      "product_purchase_price": 0,
      "product_sell_price": 0,
      "unit_id": 0,
      "unit": "string",
      "quantity": 0,
      "sell_line_note": "string",
      "line_discount_type": "string",
      "line_discount_amount": "string",
      "units": [
        {
          "id": 0,
          "name": 0,
          "is_base_unit": 0,
          "multiplier": 0,
          "price": 0
        }
      ],
      "item_tax": 0,
      "unit_price": 0
    }
  ]
}

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

{
  "meta": {
    "message": "Token expired",
    "status_code": 401
  },
  "data": []
}

Update Order Status

To use this API, use this code:

import requests
import json

url = "https://open-api.nextx.vn/api/purchase/update-shipping/{id}"
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token',
  'Content-Type': 'application/json'
}
payload = {
  "comment": "string",
  "shipping_status": "ordered"
}

response = requests.put(url, headers=headers, data=json.dumps(payload))
print(response.json())
curl -X 'PUT' \
  'https://open-api.nextx.vn/api/purchase/update-shipping/{id}' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token' \
  -H 'Content-Type: application/json' \
  -d '{
  "comment": "string",
  "shipping_status": "ordered"
}'
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/purchase/update-shipping/{id}';
const options = {
  method: 'PUT',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "comment": "string",
    "shipping_status": "ordered"
  })
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

Retrieves update the status of shipping.

HTTP Request

PUT https://open-api.nextx.vn/api/purchase/update-shipping/{id}

Parameters

Parameter Type Description
id integer ID of the order
body object Request body containing the shipping status and comment
comment string Comment about the update
shipping_status string New shipping status of the order

Response

If the request is successful, the server will return a JSON response with a status code and message.

This command return a JSON code structured like this:


Example Value
Model
{
  "comment": "string",
  "shipping_status": "ordered"
}

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

{
  "meta": {
    "message": "Token expired",
    "status_code": 401
  },
  "data": []
}

SellOrder

Get Sell Orders

import requests

url = "https://open-api.nextx.vn/api/sell/sell"
params = {
  "page": 0,
  "pageLimit": 0,
  "branch_id": 0,
  "category_id": 0,
  "sttsearch": " ",
  "from_date": " ",
  "to_date": " "
}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers, params=params)
print(response.json())
curl -X 'GET' \
  'https://open-api.nextx.vn/api/sell/sell'
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/sell/sell';
const params = new URLSearchParams({
  page: 0,
  pageLimit: 0,
  branch_id: 0,
  category_id: 0,
  sttsearch: ' ',
  from_date: ' ',
  to_date: ' '
});

const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(`${url}?${params}`, options)a

Retrieves list of sell orders.

HTTP Request

GET https://open-api.nextx.vn/api/sell/sell

Query Parameters

Parameter Type Description
page integer Page number for pagination, starts from 0. Default: 0
pageLimit integer Number of items per page. Default: 15, max: 100
branch_id integer ID of the branch (required)
customer_id integer ID of the customer
strSearch string Search keyword for product name, code, or SKU
from_date string Filter from transaction start date, format Y-m-d
to_date string Filter from transaction end date, format Y-m-d

Response

If the request is successful, the server will return a JSON response with the order list.

Example Response:

[
  {
    "id": 0,
    "transaction_date": "2024-08-07",
    "invoice_no": "string",
    "customer_id": 0,
    "customer_code": "string",
    "customer_name": "string",
    "customer_mobile": "string",
    "customer_address": "string",
    "customer_description": "string",
    "payment_status": "due",
    "final_total": "string",
    "tax_amount": "string",
    "total_before_tax": "string",
    "total_discount": "string",
    "total_surcharge": "string",
    "shipping_status": "ordered",
    "additional_notes": "string",
    "staff_note": "string",
    "added_by": "string",
    "total_paid": 0,
    "branch_name": "string",
    "status": "final",
    "purchase_invoice_no": "string"
  }
]

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

{
  "meta": {
    "message": "Token expired",
    "status_code": 401
  },
  "data": []
}

Add New Sell Order

To add a new sell order, use this code:

import requests

url = "https://open-api.nextx.vn/api/sell/sell"
payload = { 
  "transaction_date": "2024-08-08",
  "store_id": null,
  "customer_id": null,
  "price_book_id": null,
  "discount_type": "fixed",
  "discount_amount": 0,
  "total_before_tax": 0,
  "tax_amount": 0,
  "final_total": 0,
  "additional_notes": "",
  "staff_note": "",
  "user_id": 0,
  "products": [
    {
      "id_sort": 0,
      "product_id": 0,
      "variation_id": 0,
      "unit_price": 0,
      "unit_id": 0,
      "f_convert": 1,
      "f_convert1": 1,
      "f_convert2": 1,
      "f_convert3": 1,
      "tax_id": null,
      "item_tax": 0,
      "quantity": 0,
      "sell_line_note": "",
      "line_discount_type": "fixed",
      "line_discount_amount": 0
    }
  ],
  "payment": [
    {
      "note": "",
      "payment_type": "in_come",
      "method": "cash",
      "amount": 0,
      "account_id": null
    }
  ],
  "surcharges": 0,
  "invoice_no": "",
  "branch_id": null
  }
headers = {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token',
    'Content-Type': 'application/json'
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())

curl -X 'POST' \
  'https://open-api.nextx.vn/api/sell/sell' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "transaction_date": "2024-08-13",
  "store_id": null,
  "customer_id": null,
  "price_book_id": null,
  "discount_type": "fixed",
  "discount_amount": 0,
  "total_before_tax": 0,
  "tax_amount": 0,
  "final_total": 0,
  "additional_notes": "",
  "staff_note": "",
  "user_id": 0,
  "products": [
    {
      "id_sort": 0,
      "product_id": 0,
      "variation_id": 0,
      "unit_price": 0,
      "unit_id": 0,
      "f_convert": 1,
      "f_convert1": 1,
      "f_convert2": 1,
      "f_convert3": 1,
      "tax_id": null,
      "item_tax": 0,
      "quantity": 0,
      "sell_line_note": "",
      "line_discount_type": "fixed",
      "line_discount_amount": 0
    }
  ],
  "payment": [
    {
      "note": "",
      "payment_type": "in_come",
      "method": "cash",
      "amount": 0,
      "account_id": null
    }
  ],
  "surcharges": 0,
  "invoice_no": "",
  "branch_id": null
}'
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/sell/sell';
const options = {
  method: 'POST',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    transaction_date: "2024-08-08",
    store_id: null,
    customer_id: null,
    price_book_id: null,
    discount_type: "fixed",
    discount_amount: 0,
    total_before_tax: 0,
    tax_amount: 0,
    final_total: 0,
    additional_notes: "",
    staff_note: "",
    user_id: 0,
    products: [
      {
        id_sort: 0,
        product_id: 0,
        variation_id: 0,
        unit_price: 0,
        unit_id: 0,
        f_convert: 1,
        f_convert1: 1,
        f_convert2: 1,
        f_convert3: 1,
        tax_id: null,
        item_tax: 0,
        quantity: 0,
        sell_line_note: "",
        line_discount_type: "fixed",
        line_discount_amount: 0
      }
    ],
    payment: [
      {
        note: "",
        payment_type: "in_come",
        method: "cash",
        amount: 0,
        account_id: null
      }
    ],
    surcharges: 0,
    invoice_no: "",
    branch_id: null
  })
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint allows you to create a new sale order with detailed parameters, including information on products, payments, and other specifics.

HTTP Request

POST https://open-api.nextx.vn/api/sell/sell

Parameters

Parameter Type Description
transaction_date string Transaction date (YYYY-MM-DD)
customer_id integer ID of client
store_id integer ID of store
price_book_id integer ID of the price book.
discount_type string Type of discount (e.g., fixed).
discount_amount integer Amount of the discount.
total_before_tax integer Total amount before tax.
tax_amount integer Amount of tax.
final_total integer Final total after tax.
additional_notes string Any additional notes.
staff_note string Notes from staff.
user_id integer ID of the user.
products array List of products in the sale order.
payment array Payment details for the sale order.
surcharges integer Any additional surcharges.
invoice_no string Invoice number.
branch_id integer ID of the branch.

Response

If the request is successful, the server will return a JSON response with a status code indicating success or failure.

{
  "status_code": 200,
  "message": "Sale order created successfully"
}

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The above command returns JSON structured like this:

{
  "status_code": 401,
  "message": "Token expired"
}

Get Detail Sale Order

To get the detail of a sale order, use this code:

import requests

url = "https://open-api.nextx.vn/api/sell/sell/{id}"
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
  'https://open-api.nextx.vn/api/sell/sell/{id}' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/sell/sell/{id}';
const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint retrieves the details of a specific sale order.

This command return a JSON code structured like this:


{
  "id": 0,
  "transaction_date": "2024-08-08",
  "invoice_no": "string",
  "discount_type": "string",
  "discount_amount": "string",
  "total_before_tax": "string",
  "tax_amount": "string",
  "final_total": "string",
  "staff_note": "string",
  "additional_notes": "string",
  "store_id": 0,
  "price_book_id": 0,
  "branch_id": 0,
  "shipping_charges": "string",
  "shipping_status": "string",
  "customer_id": 0,
  "payment": [
    {
      "note": "string",
      "payment_type": "in_come",
      "method": "cash",
      "amount": 0,
      "account_id": null
    }
  ],
  "products": [
    {
      "id_sort": 0,
      "product_id": 0,
      "variation_id": 0,
      "unit_price": 0,
      "unit_id": 0,
      "f_convert": 1,
      "f_convert1": 1,
      "f_convert2": 1,
      "f_convert3": 1,
      "tax_id": null,
      "item_tax": 0,
      "quantity": 0,
      "sell_line_note": "",
      "line_discount_type": "fixed",
      "line_discount_amount": 0
    }
  ],
  "invoice_no": "",
  "branch_id": null,
  "tax": {
    "id": 0,
    "name": "string",
    "rate": "string",
    "address": "string",
    "description": "string"
  }
}

HTTP Request

GET https://open-api.nextx.vn/api/sell/sell/{id}

Parameters

Parameter Type Description
id integer ID of the sale order

Response

If the request is successful, the server will return a JSON response with the sale order details. If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

Copy code
{
  "meta": {
    "message": "Token expired",
    "status_code": 401
  },
  "data": []
}

Sell Return

Get Sell Returns

import requests

url = "https://open-api.nextx.vn/api/sell-return/sell-return"
params = {
  "page": 0,
  "pageLimit": 0,
  "customer_id": 0,
  "category_id": 0,
  "sttsearch": " ",
  "from_date": " ",
  "to_date": " "
}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers, params=params)
print(response.json())
curl -X 'GET' \
  'https://open-api.nextx.vn/api/sell-return/sell-return"
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/sell-return/sell-return";
const params = new URLSearchParams({
  page: 0,
  pageLimit: 0,
  customer_id: 0,
  category_id: 0,
  sttsearch: ' ',
  from_date: ' ',
  to_date: ' '
});

const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(`${url}?${params}`, options)a

Retrieves list of sell returns.

HTTP Request

GET /https://open-api.nextx.vn/api/sell-return/sell-return

Query Parameters

Parameter Type Description
page integer Page number for pagination, starts from 0. Default: 0
pageLimit integer Number of items per page. Default: 15, max: 100
customer_id integer ID of the customer
strSearch string Search keyword for product name, code, or SKU
from_date string Filter from transaction start date, format Y-m-d
to_date string Filter from transaction end date, format Y-m-d

Response

If the request is successful, the server will return a JSON response with the order list.

Example Response:

[
   {
    "id": 0,
    "transaction_date": "2024-08-08",
    "invoice_no": "string",
    "customer_id": 0,
    "customer_code": "string",
    "customer_name": "string",
    "customer_mobile": "string",
    "payment_status": "due",
    "final_total": "string",
    "amount_paid": "string",
    "additional_notes": "string",
    "staff_note": "string",
    "added_by": "string",
    "branch_name": "string",
    "sell_invoice_no": "string",
    "sell_id": 0
  }
]

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

{
  "meta": {
    "message": "Token expired",
    "status_code": 401
  },
  "data": []
}

Add New Sell Return

To create a new sales return, use this code:

curl -X 'POST' \
  'https://open-api.nextx.vn/api/sell-return/sell-return' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token' \
  -H 'Content-Type: application/json' \
  -d '{
    "transaction_date": "2024-08-08",
    "store_id": null,
    "customer_id": null,
    "discount_type": "fixed",
    "discount_amount": 0,
    "total_before_tax": 0,
    "tax_amount": 0,
    "final_total": 0,
    "additional_notes": "",
    "staff_note": "",
    "user_id": 0,
    "products": [
      {
        "id_sort": 0,
        "product_id": 0,
        "variation_id": 0,
        "unit_price": 0,
        "unit_id": 0,
        "f_convert": 1,
        "tax_id": null,
        "item_tax": 0,
        "quantity": 0,
        "sell_line_note": "",
        "line_discount_type": "fixed",
        "line_discount_amount": 0
      }
    ],
    "payment": [
      {
        "note": "",
        "payment_type": "in_come",
        "method": "cash",
        "amount": 0,
        "account_id": null
      }
    ],
    "return_charges": 0
  }'
import requests
import json

url = "https://open-api.nextx.vn/api/sell-return/sell-return"
payload = {
  "transaction_date": "2024-08-08",
  "store_id": None,
  "customer_id": None,
  "discount_type": "fixed",
  "discount_amount": 0,
  "total_before_tax": 0,
  "tax_amount": 0,
  "final_total": 0,
  "additional_notes": "",
  "staff_note": "",
  "user_id": 0,
  "products": [
    {
      "id_sort": 0,
      "product_id": 0,
      "variation_id": 0,
      "unit_price": 0,
      "unit_id": 0,
      "f_convert": 1,
      "tax_id": None,
      "item_tax": 0,
      "quantity": 0,
      "sell_line_note": "",
      "line_discount_type": "fixed",
      "line_discount_amount": 0
    }
  ],
  "payment": [
    {
      "note": "",
      "payment_type": "in_come",
      "method": "cash",
      "amount": 0,
      "account_id": None
    }
  ],
  "return_charges": 0
}
headers = {
  'accept': 'application/json',
  'Authorization': 'Bearer your_access_token',
  'Content-Type': 'application/json'
}

response = requests.post(url, headers=headers, data=json.dumps(payload))
print(response.json())
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/sell-return/sell-return';
const data = {
  transaction_date: "2024-08-08",
  store_id: null,
  customer_id: null,
  discount_type: "fixed",
  discount_amount: 0,
  total_before_tax: 0,
  tax_amount: 0,
  final_total: 0,
  additional_notes: "",
  staff_note: "",
  user_id: 0,
  products: [
    {
      id_sort: 0,
      product_id: 0,
      variation_id: 0,
      unit_price: 0,
      unit_id: 0,
      f_convert: 1,
      tax_id: null,
      item_tax: 0,
      quantity: 0,
      sell_line_note: "",
      line_discount_type: "fixed",
      line_discount_amount: 0
    }
  ],
  payment: [
    {
      note: "",
      payment_type: "in_come",
      method: "cash",
      amount: 0,
      account_id: null
    }
  ],
  return_charges: 0
};

const options = {
  method: 'POST',
  headers: {
    'accept': 'application/json',
    'Authorization': 'Bearer your_access_token',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(data)
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint creates a new sales return.

This command return a JSON code structured like this:

{
  "transaction_id": null,
  "transaction_date": "2024-08-08",
  "store_id": null,
  "customer_id": null,
  "discount_type": "fixed",
  "discount_amount": 0,
  "total_before_tax": 0,
  "tax_amount": 0,
  "final_total": 0,
  "additional_notes": "",
  "staff_note": "",
  "user_id": 0,
  "return_charges": 0,
  "products": [
    {
      "id_sort": 0,
      "product_id": 0,
      "variation_id": 0,
      "unit_price": 0,
      "unit_id": 0,
      "f_convert": 1,
      "tax_id": null,
      "item_tax": 0,
      "quantity": 0,
      "sell_line_note": "",
      "line_discount_type": "fixed",
      "line_discount_amount": 0,
      "sell_line_id": 0
    }
  ],
  "payment": [
    {
      "note": "",
      "payment_type": "in_come",
      "method": "cash",
      "amount": 0,
      "account_id": null
    }
  ],
  "invoice_no": "",
  "branch_id": null
}

HTTP Request

POST https://open-api.nextx.vn/api/sell-return/sell-return

Parameters

Parameter Type Description
transaction_date string Date of the transaction
store_id integer ID of the store
customer_id integer ID of the customer
discount_type string Type of discount
discount_amount integer Amount of discount
total_before_tax integer Total amount before tax
tax_amount integer Amount of tax
final_total integer Final total amount
additional_notes string Additional notes
staff_note string Notes from staff
user_id integer ID of the user
products array List of products in the return
payment array Payment details
return_charges integer Charges for return

Response

If the request is successful, the server will return a JSON response indicating success or failure. If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The above command returns JSON structured like this:

{
  "status_code": 401,
  "message": "Token expired"
}

Get Detail Sell Return

To get a Sale Return detail, use this code:

import requests

url = "https://open-api.nextx.vn/api/ell-return/ell-return/1"  # Replace 1 with the actual return order ID
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
  'hhttps://open-api.nextx.vn/api/ell-return/ell-return/1' \  # Replace 1 with the actual return order ID
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/ell-return/ell-return/1';  // Replace 1 with the actual return order ID
const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

Retrieves the details of a specific return order. This endpoint retrieves the details of a specific return order, including the customer information, order totals, and line items.

HTTP Request

GET https://open-api.nextx.vn/api/ell-return/ell-return/{id}

Path Parameters

Parameter Type Description
id string ID of the return order (required)

Response

Example Response:

{
  "id": 0,
  "return_parent_id": 0,
  "transaction_date": "2024-08-08",
  "invoice_no": "string",
  "discount_type": "string",
  "discount_amount": "string",
  "total_before_tax": "string",
  "tax_amount": "string",
  "final_total": "string",
  "staff_note": "string",
  "payment_status": "string",
  "customer_id": 0,
  "price_book_id": 0,
  "branch_id": 0,
  "store_id": 0,
  "return_charges": "string",
  "additional_notes": "string",
  "total_paid": "string",
  "location": {
    "id": 0,
    "name": "string",
    "code": "string",
    "tel": "string",
    "fax": "string",
    "avatar": "string",
    "address": "string",
    "description": "string"
  },
  "customer": {
    "id": 0,
    "name": "string",
    "code": "string",
    "mobile": "string",
    "gender": "string",
    "birthday": "2024-08-08",
    "address": "string",
    "account_address": "",
    "account_no": ""
  },
  "created_by": {
    "id": 0,
    "name": "string",
    "firstname": "string",
    "lastname": "string"
  },
  "payment_lines": [
    {
      "id": 0,
      "amount": 0,
      "method": "string",
      "transaction_no": "string",
      "paid_on": "2024-08-08",
      "note": "string"
    }
  ],
  "store": {
    "id": 0,
    "name": "string",
    "code": "string",
    "tel": "string",
    "fax": "string",
    "avatar": "string",
    "address": "string",
    "description": "string"
  },
  "sell_lines": [
    {
      "id": 0,
      "product_id": 0,
      "variation_id": 0,
      "product_name": "string",
      "product_code": "string",
      "sub_sku": "string",
      "product_image": "string",
      "product_purchase_price": 0,
      "product_sell_price": 0,
      "unit_id": 0,
      "unit": "string",
      "quantity": 0,
      "sell_line_note": "string",
      "line_discount_type": "string",
      "line_discount_amount": "string",
      "units": [
        {
          "id": 0,
          "name": 0,
          "is_base_unit": 0,
          "multiplier": 0,
          "price": 0
        }
      ],
      "item_tax": 0,
      "unit_price": 0
    }
  ]
}

If the request is successful, the server will return a JSON response indicating success or failure. If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The above command returns JSON structured like this:


{
  "status_code": 401,
  "message": "Token expired"
}

Update Return Order

Updates the details of an existing return order.

To use this api, use this code:

import requests
import json

url = "https:.../sell-return/1"  # Replace 1 with the actual return order ID
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

data = {
   "transaction_date": "2024-08-13",
  "customer_id": null,
  "discount_type": "fixed",
  "discount_amount": 0,
  "total_before_tax": 0,
  "tax_amount": 0,
  "final_total": 0,
  "additional_notes": "",
  "staff_note": "",
  "user_id": 0,
  "return_charges": 0,
  "products": [
    {
      "id_sort": 0,
      "product_id": 0,
      "variation_id": 0,
      "unit_price": 0,
      "unit_id": 0,
      "f_convert": 1,
      "tax_id": null,
      "item_tax": 0,
      "quantity": 0,
      "sell_line_note": "",
      "line_discount_type": "fixed",
      "line_discount_amount": 0,
      "sell_line_id": 0
    }
  ],
  "payment": [
    {
      "note": "",
      "payment_type": "in_come",
      "method": "cash",
      "amount": 0,
      "account_id": null
    }
  ]
}
response = requests.put(url, headers=headers, data=json.dumps(data))
print(response.json())
curl -X 'PUT' \
  'https://open-api.nextx.vn/api/sell-return/sell-return/1' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "transaction_date": "2024-08-13",
  "customer_id": null,
  "discount_type": "fixed",
  "discount_amount": 0,
  "total_before_tax": 0,
  "tax_amount": 0,
  "final_total": 0,
  "additional_notes": "",
  "staff_note": "",
  "user_id": 0,
  "return_charges": 0,
  "products": [
    {
      "id_sort": 0,
      "product_id": 0,
      "variation_id": 0,
      "unit_price": 0,
      "unit_id": 0,
      "f_convert": 1,
      "tax_id": null,
      "item_tax": 0,
      "quantity": 0,
      "sell_line_note": "",
      "line_discount_type": "fixed",
      "line_discount_amount": 0,
      "sell_line_id": 0
    }
  ],
  "payment": [
    {
      "note": "",
      "payment_type": "in_come",
      "method": "cash",
      "amount": 0,
      "account_id": null
    }
  ]
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/sell-return/sell-return/1';  // Replace 1 with the actual return order ID
const options = {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  },
  body: JSON.stringify({
    transaction_date: "2024-08-13",
  customer_id: null,
  discount_type: "fixed",
  discount_amount: 0,
  total_before_tax: 0,
  tax_amount: 0,
  final_total: 0,
  additional_notes: "",
  staff_note: "",
  user_id: 0,
  return_charges: 0,
  products: [
    {
      id_sort: 0,
      product_id: 0,
      variation_id: 0,
      unit_price: 0,
      unit_id: 0,
      f_convert: 1,
      tax_id: null,
      item_tax: 0,
      quantity: 0,
      sell_line_note: "",
      line_discount_type: "fixed",
      line_discount_amount: 0,
      sell_line_id: 0
    }
  ],
  payment: [
    {
      note: "",
      payment_type: "in_come",
      method: "cash",
      amount: 0,
      account_id: null
    }
  ]
  })
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

HTTP Request

PUT 'https://open-api.nextx.vn/api/sell-return/sell-return/{id}

Path Parameters

Parameter Type Description
id string ID of the return order to update (required)

Response

Example Request Body:

{
 "transaction_date": "2024-08-08",
  "customer_id": null,
  "discount_type": "fixed",
  "discount_amount": 0,
  "total_before_tax": 0,
  "tax_amount": 0,
  "final_total": 0,
  "additional_notes": "",
  "staff_note": "",
  "user_id": 0,
  "return_charges": 0,
  "products": [
    {
      "id_sort": 0,
      "product_id": 0,
      "variation_id": 0,
      "unit_price": 0,
      "unit_id": 0,
      "f_convert": 1,
      "tax_id": null,
      "item_tax": 0,
      "quantity": 0,
      "sell_line_note": "",
      "line_discount_type": "fixed",
      "line_discount_amount": 0,
      "sell_line_id": 0
    }
  ],
  "payment": [
    {
      "note": "",
      "payment_type": "in_come",
      "method": "cash",
      "amount": 0,
      "account_id": null
    }
  ]
}

If the request is successful, the server will return a JSON response indicating success or failure. If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The above command returns JSON structured like this:

{
  "status_code": 401,
  "message": "Token expired"
}

Common

Send Zalo ZNS Message

To send Zalo ZNS, use this code:

import requests

url = "https://open-api.nextx.vn/api/common/send-zns-message"
payload = {
    "phone": "string",
    "template_id": "string",
    "tracking_id": "string",
    "template_data": {}
}
headers = {
    'Accept': 'application/json',
    'Content-Type': 'application/json'
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())
curl -X 'POST' \
  'https://open-api.nextx.vn/api/common/send-zns-message' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
        "phone": "string",
        "template_id": "string",
        "tracking_id": "string",
        "template_data": {}
      }'
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/common/send-zns-message';
const payload = {
  "phone": "string",
  "template_id":

This API sends a Zalo ZNS (Zalo Notification Service) message to a specified phone number.

HTTP Request

POST https://open-api.nextx.vn/api/common/send-zns-message

Parameters

Parameter Type Description
phone string The recipient's phone number.
template_id string The ID of the ZNS template to be used.
tracking_id string A unique ID for tracking the message delivery status.
template_data object Data to populate the ZNS template fields.

Response

If the request is successful, the server will return a JSON response indicating success or failure.

The above command returns JSON structured like this:


(body)
Example Value
Model
{
  "phone": "string",
  "template_id": "string",
  "tracking_id": "string",
  "template_data": {}
}

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

{
  "status_code": 401,
  "message": "Token expired"
}

Send Webform Data

To send webform data, use this code:

import requests

url = "https://open-api.nextx.vn/api/common/send-webform-v2"
payload = {
    "name": "string",
    "sex": "string",
    "mobile": "string",
    "email": "string",
    "website": "string",
    "address": "string",
    "description": "string",
    "body": "string",
    "url": "string"
}
headers = {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'X-Client-Key': 'your_client_key'
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())
curl -X 'POST' \
  'https://open-api.nextx.vn/api/common/send-webform-v2' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'X-Client-Key: your_client_key' \
  -d '{
        "name": "string",
        "sex": "string",
        "mobile": "string",
        "email": "string",
        "website": "string",
        "address": "string",
        "description": "string",
        "body": "string",
        "url": "string"
      }'
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/common/send-webform-v2';
const payload = {
  "name": "string",
  "sex": "string",
  "mobile": "string",
  "email": "string",
  "website": "string",
  "address": "string",
  "description": "string",
  "body": "string",
  "url": "string"
};
const headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json',
  'X-Client-Key': 'your_client_key'
};

fetch(url, {
  method: 'POST',
  headers: headers,
  body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data));

This endpoint allows you to send webform data to the server.

HTTP Request

POST https://open-api.nextx.vn/api/common/send-webform-v2

Parameters

Header parameter

Parameter Type Description
X_Client_Key string The unique key of the webform.

Body parameter

Parameter Type Description
name string name of user.
sex string gender of user.
mobile string mobile number of user.
website string website URL of the user.
email string Email address of the user.
address string Address of the user.
description string Description or notes.
body string Main content of the message.
url string URL associated with the webform data.

Response

If the request is successful, the server will return a JSON response with the status code and message.

This command return a JSON code structured like this:

{
  "status_code": 0,
  "message": "string"
}

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

This command return a JSON code structured like this:

{
  "status_code": 401,
  "message": "Token expired"
}

Get Webform Fields List

To retrieve a list of fields from a webform, use this code:

import requests

url = "https://open-api.nextx.vn/api/common/webform-fields"
headers = {
    'X-Client-Key': 'your_client_key',
    'Accept': 'application/json'
}

response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
  'https://open-api.nextx.vn/api/common/webform-fields' \
  -H 'X-Client-Key: your_client_key' \
  -H 'accept: application/json'
const fetch = require('node-fetch');

const url = 'https://open-api.nextx.vn/api/common/webform-fields';
const options = {
  method: 'GET',
  headers: {
    'X-Client-Key': 'your_client_key',
    'Accept': 'application/json'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint retrieves a list of fields from a webform. The fields include the field name and associated details.

HTTP Request

GET https://open-api.nextx.vn/api/common/webform-fields

Parameters

Header parameter

Parameter Type Description
X_Client_Key string The unique key of the webform.

Response

If the request is successful, the server will return a JSON response with the webform fields.

The above command returns JSON structured like this:

{
  "status_code": 0,
  "message": "string"
}

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The above command returns JSON structured like this:

{
  "status_code": 401,
  "message": "Token expired"
}

Marketing

Marketing in NextX can manage marketing tools including To get the list of, automated marketing through automation, SMS To get the list of, SMS marketing management, Facebook, Webform, etc. Below are some specific APIs used for these functions.

Automation (Automated Marketing)

View Automation List

To view the list of automated marketing strategies (Automation), use the following code:

import requests
url = "https://api-nextcrm.nextcrm.vn/api/automation/automation?page=1&pageLimit=15&strSearch="
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
  'https://api-nextcrm.nextcrm.vn/api/automation/automation?page=1&pageLimit=15&strSearch=' \  # replace with the desired page number and number of items per page
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url = 'https://api-nextcrm.nextcrm.vn/api/automation/automation?page=1&pageLimit=15&strSearch='  // replace with the desired page number and number of items per page
const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint allows fetching a list of automations.

HTTPS Request

GET 'https://api-nextcrm.nextcrm.vn/api/automation/automation?page=1&pageLimit=15&strSearch='

Parameters (Variables)

Parameter Data Type Description
page integer Page number
pageLimit integer Number of items per page
strSearch string Search filter

Response

If the request is successful, the server will return a JSON response with the automation list.

The command returns JSON structured as follows:

{
   {
            "id": 310,
            "title": "update zalo oa",
            "type": "in",
            "frequency": "daily",
            "is_active": 1,
            "scheduler": {
                "run_at": null,
                "run_before_day": null
            },
            "category": "action",
            "filter": [],
            "description": "",
            "component_id": 18,
            "component": {
                "id": 18,
                "name": "Customer Sharing",
                "description": "",
                "order": 0,
                "type": "in",
                "filters": [],
                "details": null,
                "table": "transactions",
                "action": null,
                "category": "action",
                "scheduler": {
                    "frequency_type": "F",
                    "frequency_interval": "0",
                    "run_at": "",
                    "run_before_day": 0
                },
                "queue_name": "",
                "code": "Auto_013",
                "enable": 1
            },
            "tasks": [
                {
                    "id": 1530,
                    "filter": null,
                    "details": {
                        "recipient_type": "employee",
                        "recipient_id": 33575,
                        "subject": null,
                        "message": "<p>we have just updated zalo oa, please contact us via zalo oa, we will send the link through your zalo message<\/p> {{cus_name}}",
                        "send_type": 0,
                        "template_id": null,
                        "url_zns_template": null,
                        "params": {
                            "param_01": "",
                            "param_02": "",
                            "param_03": "",
                            "param_04": "",
                            "param_05": "",
                            "param_06": "",
                            "param_07": "",
                            "param_08": "",
                            "param_09": "",
                            "param_10": ""
                        }
                    },
                    "order": 0,
                    "parent_id": null,
                    "component_id": 18,
                    "automation_id": 310,
                    "type": "send_zalo",
                    "scheduler": {
                        "frequency_type": "O",
                        "frequency_interval": null,
                        "run_at": "2023-12-12 16:28:41",
                        "run_before_day": 1,
                        "limited_day": 1,
                        "is_frequency": 1,
                        "run_after_type": "M"
                    },
                    "config": null
                }
            ]
        }
}

If the token is expired or invalid, the server will return a 401 status code along with a message indicating that the token has expired.

The command returns JSON structured as follows:

{
  "status_code": 401,
  "message": "Token expired"
}

View Automation Details

To view the details of a specific automation strategy, use the following code:

import requests
url = "https://api-nextcrm.nextcrm.vn/api/automation/automation/310"
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
  'https://api-nextcrm.nextcrm.vn/api/automation/automation/{id}' \  # replace {id} with the automation ID you want to view
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url = 'https://api-nextcrm.nextcrm.vn/api/automation/automation/{id}';  // replace {id} with the automation ID you want to view
const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

Use this endpoint to retrieves the details of a specific automation.

HTTP Request

GET https://api-nextcrm.nextcrm.vn/api/automation/automation/{id}

Parameters

Parameter Data Type Description
id integer The ID of the automation to view

Response

If the request is successful, the server will return a JSON response with the automation detail informaiton.

The command returns JSON structured as follows:

{
  "id": 310,
  "title": "Automation Title",
  "type": "in",
  "frequency": "daily",
  "is_active": 1,
  "scheduler": {
    "run_at": null,
    "run_before_day": null
  },
  "category": "action",
  "filter": [],
  "description": "",
  "component_id": 18,
  "component": {
    "id": 18,
    "name": "Component Name",
    "description": "",
    "order": 0,
    "type": "in",
    "filters": [],
    "details": null,
    "table": "transactions",
    "action": null,
    "category": "action",
    "scheduler": {
      "frequency_type": "F",
      "frequency_interval": "0",
      "run_at": "",
      "run_before_day": 0
    },
    "queue_name": "",
    "code": "Auto_013",
    "enable": 1
  },
  "tasks": [
    {
      "id": 1530,
      "filter": null,
      "details": {
        "recipient_type": "employee",
        "recipient_id": 33575,
        "subject": null,
        "message": "Task message here",
        "send_type": 0,
        "template_id": null,
        "url_zns_template": null,
        "params": {
          "param_01": "",
          "param_02": "",
          "param_03": "",
          "param_04": "",
          "param_05": "",
          "param_06": "",
          "param_07": "",
          "param_08": "",
          "param_09": "",
          "param_10": ""
        }
      },
      "order": 0,
      "parent_id": null,
      "component_id": 18,
      "automation_id": 310,
      "type": "send_zalo",
      "scheduler": {
        "frequency_type": "O",
        "frequency_interval": null,
        "run_at": "2023-12-12 16:28:41",
        "run_before_day": 1,
        "limited_day": 1,
        "is_frequency": 1,
        "run_after_type": "M"
      },
      "config": null
    }
  ]
}

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

Example error response:

{
  "status_code": 401,
  "message": "Token expired"
}

Add New Automation

To create automated marketing strategies, set up automation using the following code:

curl -X 'POST' \
  'https://api-nextcrm.nextcrm.vn/api/automation/automation' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token' \
  -H 'Content-Type: application/json' \
  -d '{
  "automation": {
    "title": "Automatic Response Email",
    "type": "in",
    "frequency": "daily",
    "is_active": true,
    "description": "",
    "component_id": 13,
    "filter": [],
    "scheduler": {
      "run_at": "2024-09-19T11:06:03",
      "run_before_day": 1,
      "frequency_interval": null,
      "frequency_type": "O"
    },
    "tasks": [
      {
        "type": "send_email",
        "details": {
          "recipient_type": "contact",
          "recipient_id": null,
          "subject": "Thank you for using our service",
          "message": "<p>Thank you for using our service</p>",
          "params": {
            "param_01": "",
            "param_02": "",
            "param_03": "",
            "param_04": "",
            "param_05": "",
            "param_06": "",
            "param_07": ""
          }
        }
      }
    ]
  },
  "query_parameters": {
    "branch_id": 1,
    "from_date": "2024-07-01",
    "to_date": "2024-09-30"
  },
  "responses": {
    "successful": {
      "json_structure": {
        "key": "TotalIncome",
        "Name": "Total Income",
        "Value": 988233161.02
      }
    },
    "error": {
      "json_structure": {
        "meta": {
          "message": "Token expired",
          "status_code": 401
        },
        "data": []
      }
    }
  }
}

import requests
import json

url = "https://api-nextcrm.nextcrm.vn/api/automation/automation"
payload = {
  "automation": {
    "title": "Automatic Response Email",
    "type": "in",
    "frequency": "daily",
    "is_active": true,
    "description": "",
    "component_id": 13,
    "filter": [],
    "scheduler": {
      "run_at": "2024-09-19T11:06:03",
      "run_before_day": 1,
      "frequency_interval": null,
      "frequency_type": "O"
    },
    "tasks": [
      {
        "type": "send_email",
        "details": {
          "recipient_type": "contact",
          "recipient_id": null,
          "subject": "Thank you for using our service",
          "message": "<p>Thank you for using our service</p>",
          "params": {
            "param_01": "",
            "param_02": "",
            "param_03": "",
            "param_04": "",
            "param_05": "",
            "param_06": "",
            "param_07": ""
          }
        }
      }
    ]
  },
  "query_parameters": {
    "branch_id": 1,
    "from_date": "2024-07-01",
    "to_date": "2024-09-30"
  },
  "responses": {
    "successful": {
      "json_structure": {
        "key": "TotalIncome",
        "Name": "Total Income",
        "Value": 988233161.02
      }
    },
    "error": {
      "json_structure": {
        "meta": {
          "message": "Token expired",
          "status_code": 401
        },
        "data": []
      }
    }
  }
}

headers = {
  'accept': 'application/json',
  'Authorization': 'Bearer your_access_token',
  'Content-Type': 'application/json'
}

response = requests.post(url, headers=headers, data=json.dumps(payload))
print(response.json())
const fetch = require('node-fetch');

const url = 'https://api-nextcrm.nextcrm.vn/api/automation/automation';
const data = {
  "automation": {
    "title": "Automatic Response Email",
    "type": "in",
    "frequency": "daily",
    "is_active": true,
    "description": "",
    "component_id": 13,
    "filter": [],
    "scheduler": {
      "run_at": "2024-09-19T11:06:03",
      "run_before_day": 1,
      "frequency_interval": null,
      "frequency_type": "O"
    },
    "tasks": [
      {
        "type": "send_email",
        "details": {
          "recipient_type": "contact",
          "recipient_id": null,
          "subject": "Thank you for using our service",
          "message": "<p>Thank you for using our service</p>",
          "params": {
            "param_01": "",
            "param_02": "",
            "param_03": "",
            "param_04": "",
            "param_05": "",
            "param_06": "",
            "param_07": ""
          }
        }
      }
    ]
  },
  "query_parameters": {
    "branch_id": 1,
    "from_date": "2024-07-01",
    "to_date": "2024-09-30"
  },
  "responses": {
    "successful": {
      "json_structure": {
        "key": "TotalIncome",
        "Name": "Total Income",
        "Value": 988233161.02
      }
    },
    "error": {
      "json_structure": {
        "meta": {
          "message": "Token expired",
          "status_code": 401
        },
        "data": []
      }
    }
  }
}
;

const options = {
  method: 'POST',
  headers: {
    'accept': 'application/json',
    'Authorization': 'Bearer your_access_token',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(data)
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint allows to add a new automation.

The command returns JSON structured as follows:

{
  "transaction_id": null,
  "transaction_date": "2024-08-08",
  "store_id": null,
  "customer_id": null,
  "discount_type": "fixed",
  "discount_amount": 0,
  "total_before_tax": 0,
  "tax_amount": 0,
  "final_total": 0,
  "additional_notes": "",
  "staff_note": "",
  "user_id": 0,
  "return_charges": 0,
  "products": [
    {
      "id_sort": 0,
      "product_id": 0,
      "variation_id": 0,
      "unit_price": 0,
      "unit_id": 0,
      "f_convert": 1,
      "tax_id": null,
      "item_tax": 0,
      "quantity": 0,
      "sell_line_note": "",
      "line_discount_type": "fixed",
      "line_discount_amount": 0,
      "sell_line_id": 0
    }
  ],
  "payment": [
    {
      "note": "",
      "payment_type": "in_come",
      "method": "cash",
      "amount": 0,
      "account_id": null
    }
  ],
  "invoice_no": "",
  "branch_id": null
}

This endpoint allows to add a new automation

HTTP Request

POST https://api-nextcrm.nextcrm.vn/api/automation/automation

Parameters

Data Name Data Type Description
title string The title of the automation
type string The type of automation (e.g., "in" for input)
frequency string The execution frequency (e.g., "daily")
is_active boolean Activation status (true or false)
description string The description of the automation
category string The category of the automation (e.g., "action")
component_id integer The ID of the component
filter array Array of filters (if any)
scheduler object Scheduling information
tasks array Array of tasks to be performed
recipient_type string The type of recipient (e.g., "contact")
recipient_id integer or null The ID of the recipient (if any)
subject string The subject of the email or message
message string The content of the message or email
params object Object containing parameters
frequency_type string The type of frequency (e.g., "O" for one-time)
frequency_interval integer or null The interval between executions
run_at string The time to execute
run_before_day integer Number of days before execution
is_frequency integer Execution frequency (1 for recurring)
limited_day integer The limited execution day
run_after_type string The type of post-execution time

Response

If the request is successful, the server will return a JSON response with updated information

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The command returns JSON structured as follows:

{
  "status_code": 401,
  "message": "Token expired"
}

Update Information Automation

To update information of Automation, use this code:

import requests
import json

url = "https://api-nextcrm.nextcrm.vn/api/automation/automation/{id}" 
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

data = {
   "automation": {
    "title": "Automatic Response Email",
    "type": "in",
    "frequency": "daily",
    "is_active": true,
    "description": "",
    "component_id": 13,
    "filter": [],
    "scheduler": {
      "run_at": "2024-09-19T11:06:03",
      "run_before_day": 1,
      "frequency_interval": null,
      "frequency_type": "O"
    },
    "tasks": [
      {
        "type": "send_email",
        "details": {
          "recipient_type": "contact",
          "recipient_id": null,
          "subject": "Thank you for using our service",
          "message": "<p>Thank you for using our service</p>",
          "params": {
            "param_01": "",
            "param_02": "",
            "param_03": "",
            "param_04": "",
            "param_05": "",
            "param_06": "",
            "param_07": ""
          }
        }
      }
    ]
  },
  "query_parameters": {
    "branch_id": 1,
    "from_date": "2024-07-01",
    "to_date": "2024-09-30"
  },
  "responses": {
    "successful": {
      "json_structure": {
        "key": "TotalIncome",
        "Name": "Total Income",
        "Value": 988233161.02
      }
    },
    "error": {
      "json_structure": {
        "meta": {
          "message": "Token expired",
          "status_code": 401
        },
        "data": []
      }
    }
  }
}
response = requests.put(url, headers=headers, data=json.dumps(data))
print(response.json())
curl -X 'PUT' \
  'https://api-nextcrm.nextcrm.vn/api/automation/automation/{id}' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d ' "automation": {
    "title": "Automatic Response Email",
    "type": "in",
    "frequency": "daily",
    "is_active": true,
    "description": "",
    "component_id": 13,
    "filter": [],
    "scheduler": {
      "run_at": "2024-09-19T11:06:03",
      "run_before_day": 1,
      "frequency_interval": null,
      "frequency_type": "O"
    },
    "tasks": [
      {
        "type": "send_email",
        "details": {
          "recipient_type": "contact",
          "recipient_id": null,
          "subject": "Thank you for using our service",
          "message": "<p>Thank you for using our service</p>",
          "params": {
            "param_01": "",
            "param_02": "",
            "param_03": "",
            "param_04": "",
            "param_05": "",
            "param_06": "",
            "param_07": ""
          }
        }
      }
    ]
  },
  "query_parameters": {
    "branch_id": 1,
    "from_date": "2024-07-01",
    "to_date": "2024-09-30"
  },
  "responses": {
    "successful": {
      "json_structure": {
        "key": "TotalIncome",
        "Name": "Total Income",
        "Value": 988233161.02
      }
    },
    "error": {
      "json_structure": {
        "meta": {
          "message": "Token expired",
          "status_code": 401
        },
        "data": []
      }
    }
  }
}
const fetch = require('node-fetch');

const url = 'https://api-nextcrm.nextcrm.vn/api/automation/automation/{id}';  
const options = {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  },
  body: JSON.stringify({
    "automation": {
    "title": "Automatic Response Email",
    "type": "in",
    "frequency": "daily",
    "is_active": true,
    "description": "",
    "component_id": 13,
    "filter": [],
    "scheduler": {
      "run_at": "2024-09-19T11:06:03",
      "run_before_day": 1,
      "frequency_interval": null,
      "frequency_type": "O"
    },
    "tasks": [
      {
        "type": "send_email",
        "details": {
          "recipient_type": "contact",
          "recipient_id": null,
          "subject": "Thank you for using our service",
          "message": "<p>Thank you for using our service</p>",
          "params": {
            "param_01": "",
            "param_02": "",
            "param_03": "",
            "param_04": "",
            "param_05": "",
            "param_06": "",
            "param_07": ""
          }
        }
      }
    ]
  },
  "query_parameters": {
    "branch_id": 1,
    "from_date": "2024-07-01",
    "to_date": "2024-09-30"
  },
  "responses": {
    "successful": {
      "json_structure": {
        "key": "TotalIncome",
        "Name": "Total Income",
        "Value": 988233161.02
      }
    },
    "error": {
      "json_structure": {
        "meta": {
          "message": "Token expired",
          "status_code": 401
        },
        "data": []
      }
    }
  }
})
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint allows to retrieve update the information of an automation.

HTTP Request

PUT 'https://api-nextcrm.nextcrm.vn/api/automation/automation/{id}

Parameters

Parameter Data Type Description
id integer The ID of the automation to view

Response

Example Request

{
        "title": "Tr\u1ea3 l\u1eddi tin nh\u1eafn t\u1ef1 \u0111\u1ed9ng",
        "type": "in",
        "frequency": "daily",
        "is_active": true,
        "description": "",
        "component_id": 13,
        "category": "action",
        "filter": [],
        "scheduler": {
            "run_at": null,
            "run_before_day": null,
            "frequency_interval": null,
            "frequency_type": null
        },
        "tenant_id": 1596,
        "id": 376
}

If the request is successful, the server will return a JSON response If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The command returns JSON structured as follows:

{
  "status_code": 401,
  "message": "Token expired"
}

Campaign

View Campaign

To get the list of campaigns, use this code:

import requires
url = "https://api-nextcrm.nextcrm.vn/api/crm/campaign?page=1&pageLimit=15&strSearch=&from_date=2024-09-01&to_date=2024-09-30"
header = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
  'https://api-nextcrm.nextcrm.vn/api/crm/campaign?page=1&pageLimit=15&strSearch=&from_date=2024-09-01&to_date=2024-09-30' \  # thay thế bằng số trang và số item muốn có trên một trang
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url = 'https://api-nextcrm.nextcrm.vn/api/crm/campaign?page=1&pageLimit=15&strSearch=&from_date=2024-09-01&to_date=2024-09-30'  # thay thế bằng số trang  số item muốn  trên một trang
const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint allows to retrieve list of campaigns.

HTTPS Request

GET https://api-nextcrm.nextcrm.vn/api/crm/campaign

Parameters (Variables)

Parameter Data Type Description
page integer Page number
pageLimit integer Number of items per page
strSearch string Search filter
from_date string Start date for filtering
to_date string End date for filtering

Response

If the request is successful, the server will return a JSON response with the ongoing campaigns.

The command returns JSON structured as follows:

{
   {
             "id": 732,
        "name": "Ch\u0103m s\u00f3c KH",
        "start_date": "2024-09-19",
        "end_date": "2024-09-22",
        "budget": "0.00",
        "actual_cost": null,
        "objective": "",
        "description": "",
        "status": "37250",
        "campaign_status": {
            "name": "\u0110ang di\u1ec5n ra",
            "id": 37250
        },
        "type": {
            "name": "Telesales",
            "id": 107
        },
        "impression": null,
        "expected_cost": null,
        "expected_revenue": null,
        "assigned_to": 7025,
        "user": {
            "name": "admin3",
            "email": "",
            "firstname": "",
            "lastname": "admin",
            "picture": null
        },
        "assigned": {
            "name": "admin3",
            "email": "",
            "firstname": "",
            "lastname": "admin",
            "picture": null
        },
        "user_id": 7025,
        "stage": [
            {
                "id": 4018,
                "name": "Th\u00f4ng tin kh\u00e1ch",
                "value": "Th\u00f4ng tin kh\u00e1ch",
                "campaign_id": 732,
                "order": 1,
                "parent_id": null,
                "stage_type_id": 1,
                "stage_type_name": "Th\u00f4ng tin kh\u00e1ch"
            },
}

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The command returns JSON structured as follows:

{
  "status_code": 401,
  "message": "Token expired"
}

View detail information of Campaign

To view detail information of a campaign, use this code:

import requires
url = "https://api-nextcrm.nextcrm.vn/api/crm/campaign/{id}"
header = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
  'https://api-nextcrm.nextcrm.vn/api/crm/campaign/{id}' \  # replace with the id of  campaigns
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url =  'https://api-nextcrm.nextcrm.vn/api/crm/campaign/{id}'  # replace with the id of campaigns
const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint allows to retrieve detail information of campaigns.

HTTPS Request

GET https://api-nextcrm.nextcrm.vn/api/crm/campaign/{id}

Parameters

Parameter Type Description
id integer ID ofcampaigns

Response

If the request is successful, the server will return a JSON response with updated information

The command returns JSON structured as follows:

   "id": 732,
        "name": "Ch\u0103m s\u00f3c KH",
        "start_date": "2024-09-19",
        "end_date": "2024-09-22",
        "budget": "0.00",
        "actual_cost": null,
        "objective": "",
        "description": "",
        "status": "37250",
        "campaign_status": {
            "name": "\u0110ang di\u1ec5n ra",
            "id": 37250
        },
        "type": {
            "name": "Telesales",
            "id": 107
        },
        "impression": null,
        "expected_cost": null,
        "expected_revenue": null,
        "assigned_to": 7025,
        "user": {
            "name": "admin3",
            "email": "",
            "firstname": "",
            "lastname": "admin",
            "picture": null
        },
        "assigned": {
            "name": "admin3",
            "email": "",
            "firstname": "",
            "lastname": "admin",
            "picture": null
        },
        "user_id": 7025,
        "stage": [
            {
                "id": 4018,
                "name": "Th\u00f4ng tin kh\u00e1ch",
                "value": "Th\u00f4ng tin kh\u00e1ch",
                "campaign_id": 732,
                "order": 1,
                "parent_id": null,
                "stage_type_id": 1,
                "stage_type_name": "Th\u00f4ng tin kh\u00e1ch"
            },
            }

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The command returns JSON structured as follows:

{
  "status_code": 401,
  "message": "Token expired"
}

Add New Campaign

To add a new campaigns, use this code:

curl -X 'POST' \
  'https://api-nextcrm.nextcrm.vn/api/automation/automation' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token' \
  -H 'Content-Type: application/json' \
  -d '{
  {
  "allow_duplicate_opportunity": 0,
  "assigned_to": 4761,
  "branch_id": 2518,
  "budget": "0",
  "campaign_failed_id": null,
  "campaign_success_id": null,
  "campaign_type": "107",
  "code": "CP000035",
  "contacts": [],
  "correlatives": [
    {
      "id": 4761,
      "rate": 1
    }
  ],
  "description": "",
  "divide_opportunity_auto": 1,
  "end_date": "2024-09-26",
  "failed_campaign_id": null,
  "hide_opportunity_info": 1,
  "name": "Campaign test",
  "objective": "",
  "stages": [
    {
      "name": "Thông tin khách",
      "value": "Thông tin khách",
      "order": 1,
      "stage_type_id": 1
    },
    {
      "name": "Thực hiện campaigns",
      "value": "Thực hiện campaigns",
      "order": 2,
      "stage_type_id": 2
    }
  ],
  "start_date": "2024-09-19",
  "status": "37250",
  "success_campaign_id": null
}

'
import requests
import json

url = "https://api-nextcrm.nextcrm.vn/api/automation/automation"
payload = {
  "allow_duplicate_opportunity": 0,
  "assigned_to": 4761,
  "branch_id": 2518,
  "budget": "0",
  "campaign_failed_id": null,
  "campaign_success_id": null,
  "campaign_type": "107",
  "code": "CP000035",
  "contacts": [],
  "correlatives": [
    {
      "id": 4761,
      "rate": 1
    }
  ],
  "description": "",
  "divide_opportunity_auto": 1,
  "end_date": "2024-09-26",
  "failed_campaign_id": null,
  "hide_opportunity_info": 1,
  "name": "Campaign test",
  "objective": "",
  "stages": [
    {
      "name": "Thông tin khách",
      "value": "Thông tin khách",
      "order": 1,
      "stage_type_id": 1
    },
    {
      "name": "Thực hiện campaigns",
      "value": "Thực hiện campaigns",
      "order": 2,
      "stage_type_id": 2
    }
  ],
  "start_date": "2024-09-19",
  "status": "37250",
  "success_campaign_id": null
}

headers = {
  'accept': 'application/json',
  'Authorization': 'Bearer your_access_token',
  'Content-Type': 'application/json'
}

response = requests.post(url, headers=headers, data=json.dumps(payload))
print(response.json())
const fetch = require('node-fetch');

const url = 'https://api-nextcrm.nextcrm.vn/api/automation/automation';
const data = {
  "allow_duplicate_opportunity": 0,
  "assigned_to": 4761,
  "branch_id": 2518,
  "budget": "0",
  "campaign_failed_id": null,
  "campaign_success_id": null,
  "campaign_type": "107",
  "code": "CP000035",
  "contacts": [],
  "correlatives": [
    {
      "id": 4761,
      "rate": 1
    }
  ],
  "description": "",
  "divide_opportunity_auto": 1,
  "end_date": "2024-09-26",
  "failed_campaign_id": null,
  "hide_opportunity_info": 1,
  "name": "Campaign test",
  "objective": "",
  "stages": [
    {
      "name": "Thông tin khách",
      "value": "Thông tin khách",
      "order": 1,
      "stage_type_id": 1
    },
    {
      "name": "Thực hiện campaigns",
      "value": "Thực hiện campaigns",
      "order": 2,
      "stage_type_id": 2
    }
  ],
  "start_date": "2024-09-19",
  "status": "37250",
  "success_campaign_id": null
}

;

const options = {
  method: 'POST',
  headers: {
    'accept': 'application/json',
    'Authorization': 'Bearer your_access_token',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(data)
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint allows to add a new campaigns.

The command returns JSON structured as follows:

{
 "id": 733,
        "name": "Chi\u1ebfn d\u1ecbch test",
        "start_date": "2024-09-19",
        "end_date": "2024-09-26",
        "budget": "0",
        "actual_cost": null,
        "objective": "",
        "description": "",
        "status": "37250",
        "campaign_status": {
            "name": "\u0110ang di\u1ec5n ra",
            "id": 37250
        },
        "type": {
            "name": "Telesales",
            "id": 107
        },
        "impression": null,
        "expected_cost": null,
        "expected_revenue": null,
        "assigned_to": 4761,
        "user": {
            "name": "admin",
            "email": "vietphat.vpic@gmail.com",
            "firstname": "",
            "lastname": "demo",
            "picture": null
        },
        "assigned": {
            "name": "admin",
            "email": "vietphat.vpic@gmail.com",
            "firstname": "",
            "lastname": "demo",
            "picture": null
        },
        "user_id": 4761,
        "stage": [
            {
                "id": 4024,
                "name": "Th\u00f4ng tin kh\u00e1ch",
                "value": "Th\u00f4ng tin kh\u00e1ch",
                "campaign_id": 733,
                "order": 1,
                "parent_id": null,
                "stage_type_id": 1,
                "stage_type_name": "Th\u00f4ng tin kh\u00e1ch"
            },
}

This endpoint allows to add a new automation

HTTP Request

POST https://api-nextcrm.nextcrm.vn/api/automation/automation

Parameters

Variable Name Data Type Description
allow_duplicate_opportunity Integer Allows creation of duplicate campaigns (0: no, 1: yes)
assigned_to Integer ID of the assigned person
branch_id Integer ID of the branch
budget String Budget for the campaigns
campaign_failed_id Null/Integer ID of the failed campaign (if any)
campaign_success_id Null/Integer ID of the successful campaign (if any)
campaign_type String Type of campaign
code String Campaign code
contacts Array List of contacts for the campaign
correlatives Array List of related contacts with ID and ratio
description String Campaign description
divide_opportunity_auto Integer Automatically split SMS campaigns (0: no, 1: yes)
end_date String (Date) Campaign end date
failed_campaign_id Null/Integer ID of the failed campaign (if any)
hide_opportunity_info Integer Hide SMS campaign info (0: no, 1: yes)
name String Campaign name
objective String Campaign objective
stages Array Stages of the campaign with name, value, and order
start_date String (Date) Campaign start date
status String Campaign status
success_campaign_id Null/Integer ID of the successful campaign (if any)

Response

If the request is successful, the server will return a JSON response with updated information

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The command returns JSON structured as follows:

{
  "status_code": 401,
  "message": "Token expired"
}

Update Information of a Campaign

To update information of campaigns, use this code:

import requests
import json

url = "https://api-nextcrm.nextcrm.vn/api/crm/campaign/{id}" 
headers = {
  "allow_duplicate_opportunity": 0,
  "assigned_to": 4761,
  "branch_id": 2518,
  "budget": "0",
  "campaign_failed_id": null,
  "campaign_success_id": null,
  "campaign_type": "107",
  "code": "CP000035",
  "contacts": [],
  "correlatives": [
    {
      "id": 4761,
      "rate": 1
    }
  ],
  "description": "",
  "divide_opportunity_auto": 1,
  "end_date": "2024-09-26",
  "failed_campaign_id": null,
  "hide_opportunity_info": 1,
  "name": "Campaign test",
  "objective": "",
  "stages": [
    {
      "name": "Thông tin khách",
      "value": "Thông tin khách",
      "order": 1,
      "stage_type_id": 1
    },
    {
      "name": "Thực hiện campaigns",
      "value": "Thực hiện campaigns",
      "order": 2,
      "stage_type_id": 2
    }
  ],
  "start_date": "2024-09-19",
  "status": "37250",
  "success_campaign_id": null
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())
curl -X 'POST' \
  'https://api-nextcrm.nextcrm.vn/api/crm/campaign/{id}' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token' \
  -H 'Content-Type: application/json' \
  -d '{
  {
  "allow_duplicate_opportunity": 0,
  "assigned_to": 4761,
  "branch_id": 2518,
  "budget": "0",
  "campaign_failed_id": null,
  "campaign_success_id": null,
  "campaign_type": "107",
  "code": "CP000035",
  "contacts": [],
  "correlatives": [
    {
      "id": 4761,
      "rate": 1
    }
  ],
  "description": "",
  "divide_opportunity_auto": 1,
  "end_date": "2024-09-26",
  "failed_campaign_id": null,
  "hide_opportunity_info": 1,
  "name": "Campaign test",
  "objective": "",
  "stages": [
    {
      "name": "Thông tin khách",
      "value": "Thông tin khách",
      "order": 1,
      "stage_type_id": 1
    },
    {
      "name": "Thực hiện campaigns",
      "value": "Thực hiện campaigns",
      "order": 2,
      "stage_type_id": 2
    }
  ],
  "start_date": "2024-09-19",
  "status": "37250",
  "success_campaign_id": null
}
'
const fetch = require('node-fetch');

const url = 'https://api-nextcrm.nextcrm.vn/api/crm/campaign/{id}';  
const options = {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  },
  body: JSON.stringify({
  "allow_duplicate_opportunity": 0,
  "assigned_to": 4761,
  "branch_id": 2518,
  "budget": "0",
  "campaign_failed_id": null,
  "campaign_success_id": null,
  "campaign_type": "107",
  "code": "CP000035",
  "contacts": [],
  "correlatives": [
    {
      "id": 4761,
      "rate": 1
    }
  ],
  "description": "",
  "divide_opportunity_auto": 1,
  "end_date": "2024-09-26",
  "failed_campaign_id": null,
  "hide_opportunity_info": 1,
  "name": "Campaign test",
  "objective": "",
  "stages": [
    {
      "name": "Thông tin khách",
      "value": "Thông tin khách",
      "order": 1,
      "stage_type_id": 1
    },
    {
      "name": "Thực hiện campaigns",
      "value": "Thực hiện campaigns",
      "order": 2,
      "stage_type_id": 2
    }
  ],
  "start_date": "2024-09-19",
  "status": "37250",
  "success_campaign_id": null
})
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint allows to retrieve update the information of campaigns.

HTTP Request

PUT 'https://api-nextcrm.nextcrm.vn/api/crm/campaign/{id}

Path Tham số

Parameter Data Type Description
id string Campaign ID (required)

Response

Example Request

{
       "id": 733,
        "name": "Chi\u1ebfn d\u1ecbch test",
        "start_date": "2024-09-19",
        "end_date": "2024-09-26",
        "budget": "0",
        "actual_cost": null,
        "objective": "",
        "description": "",
        "status": "37250",
        "campaign_status": {
            "name": "\u0110ang di\u1ec5n ra",
            "id": 37250
        },
        "type": {
            "name": "Telesales",
            "id": 107
        },
        "impression": null,
        "expected_cost": null,
        "expected_revenue": null,
        "assigned_to": 4761,
        "user": {
            "name": "admin",
            "email": "vietphat.vpic@gmail.com",
            "firstname": "",
            "lastname": "demo",
            "picture": null
        },
        "assigned": {
            "name": "admin",
            "email": "vietphat.vpic@gmail.com",
            "firstname": "",
            "lastname": "demo",
            "picture": null
        },
        "user_id": 4761,
        "stage": [
            {
                "id": 4024,
                "name": "Th\u00f4ng tin kh\u00e1ch",
                "value": "Th\u00f4ng tin kh\u00e1ch",
                "campaign_id": 733,
                "order": 1,
                "parent_id": null,
                "stage_type_id": 1,
                "stage_type_name": "Th\u00f4ng tin kh\u00e1ch"
            },
}

If the request is successful, the server will return a JSON response If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The command returns JSON structured as follows:

{
  "status_code": 401,
  "message": "Token expired"
}

Opportunities

View List of Opportunities

To get the list of opportunities, use this code:

import requires
url = "https://api-nextcrm.nextcrm.vn/api/crm/opportunity?page=1&pageLimit=15&strSearch=&from_date=2024-09-01&to_date=2024-09-30&from_date_result=&to_date_result="
header = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
  'https://api-nextcrm.nextcrm.vn/api/crm/opportunity?page=1&pageLimit=15&strSearch=&from_date=2024-09-01&to_date=2024-09-30&from_date_result=&to_date_result=' \  # thay thế bằng số trang và số item muốn có trên một trang
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url = 'https://api-nextcrm.nextcrm.vn/api/crm/opportunity?page=1&pageLimit=15&strSearch=&from_date=2024-09-01&to_date=2024-09-30&from_date_result=&to_date_result='  # thay thế bằng số trang  số item muốn  trên một trang
const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint allows to retrieve list of opportunities.

HTTPS Request

GET https://api-nextcrm.nextcrm.vn/api/crm/opportunity

Parameters

Parameter Data Type Description
page integer Page number
pageLimit integer Number of items per page
strSearch string Search filter
from_date string Start time for filtering
to_date string End time for filtering

Response

If the request is successful, the server will return a JSON response of ongoing opportunities

The command returns JSON structured as follows:

{
   {
             "id": 113134,
            "name": "tessxt",
            "opportunity_amount": "0.00",
            "sales_stage": "4018",
            "probability": 0,
            "description": "",
            "expected_close_date": "2024-09-22",
            "type": null,
            "lead_source": null,
            "campaign_id": 732,
            "assigned_to": 5149,
            "user": {
                "name": "admin3",
                "email": "",
                "firstname": "",
                "lastname": "admin",
                "picture": null
            },
            "assigned": {
                "name": "ducdx",
                "email": "",
                "firstname": "Duong Xuan",
                "lastname": "Duc",
                "picture": null
            },
            "lead_source_description": null,
            "contact_id": 718136,
            "user_id": 7025,
            "status": null,
            "reason_failed": null,
            "model_name": "App\\Models\\Crm\\Opportunity",
            "campaign": {
                "id": 732,
                "name": "Ch\u0103m s\u00f3c KH",
                "start_date": "2024-09-19",
                "end_date": "2024-09-22",
                "allow_duplicate_opportunity": 0,
                "divide_opportunity_auto": null,
                "hide_opportunity_info": 0,
                "success_campaign_id": null,
                "failed_campaign_id": null
            },
            "source": null,
            "stage": {
                "id": 4018,
                "name": "Th\u00f4ng tin kh\u00e1ch",
                "stage_type_id": 1,
                "order": 1
            },
            "result_id": null,
            "action_id": 11065,
            "next_action_id": null,
            "prev_action_id": null,
            "perform_after_day": 0,
            "perform_after_hour": 0,
            "perform_after_minute": 0,
            "action": {
                "id": 11065,
                "name": "TH-G\u1ecdi l\u1ea7n 1",
                "order": 17,
                "is_default": 1,
                "is_active": 1,
                "next_action_id": null,
                "perform_after_day": 0,
                "perform_after_hour": 0,
                "perform_after_minute": 30,
                "description": "G\u1ecdi sau khi ti\u1ebfp nh\u1eadn th\u00f4ng tin",
                "results": [
                    {
                        "id": 12951,
                        "order": 3,
                        "name": "G\u1ecdi l\u1ea1i sau",
                        "action_id": null,
                        "status": "in_process",
                        "description": "",
                        "is_active": 1,
                        "tenant_id": 1596,
                        "stage_type_id": 1,
                        "pivot": {
                            "action_id": 11065,
                            "result_id": 12951,
                            "next_action_id": 10079,
                            "order": 1,
                            "perform_after_day": 0,
                            "perform_after_hour": 0,
                            "perform_after_minute": 30
                        }
                    }
                ]
            },
            "next_action": null,
            "prev_action": null,
            "action_result": null,
            "contact": {
                "id": 718136,
                "name": "tessxt",
                "email": "",
                "code": "KH24000004",
                "mobile": "0963419120",
                "address": "",
                "resources": [
                    {
                        "id": 26,
                        "name": "Facebook"
                    }
                ],
                "categories": [
                    {
                        "id": 37741,
                        "name": "Kh\u00e1ch ti\u1ec1m n\u0103ng"
                    }
                ],
                "relationships": []
            },
            "resource_contact": [
                {
                    "id": 26,
                    "name": "Facebook"
                }
            ],
            "category_contact": [
                {
                    "id": 37741,
                    "name": "Kh\u00e1ch ti\u1ec1m n\u0103ng"
                }
            ],
            "relationships_contact": [],
            "contact_name": "tessxt",
            "contact_mobile": "0963419120",
            "contact_email": "",
            "contact_address": "",
            "created_at": "2024-09-19 13:38:39",
            "updated_at": "2024-09-19 13:38:39",
            "time_updated_result": "2024-09-19 13:38:39",
            "tags": [],
            "activity_log": null,
            "total_money": "0.0000",
            "time_update_status": null,
            "last_comment": null,
            "campaign_stage": [
                {
                    "id": 4018,
                    "name": "Th\u00f4ng tin kh\u00e1ch",
                    "stage_type_id": 1,
                    "order": 1
                },
                {
                    "id": 4019,
                    "name": "Ph\u00e2n t\u00edch nhu c\u1ea7u",
                    "stage_type_id": 2,
                    "order": 2
                },
                {
                    "id": 4020,
                    "name": "B\u00e1o gi\u00e1",
                    "stage_type_id": 3,
                    "order": 3
                },
                {
                    "id": 4021,
                    "name": "\u0110\u00e0m ph\u00e1n",
                    "stage_type_id": 4,
                    "order": 4
                },
                {
                    "id": 4022,
                    "name": "Th\u00e0nh c\u00f4ng",
                    "stage_type_id": 5,
                    "order": 5
                },
                {
                    "id": 4023,
                    "name": "Th\u1ea5t b\u1ea1i",
                    "stage_type_id": 6,
                    "order": 6
                }
            ]
        }
            },
}

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The command returns JSON structured as follows:

{
  "status_code": 401,
  "message": "Token expired"
}

View detail information of Opportunity

To view detail information of an opportunity, use this code:

import requires
url = "https://api-nextcrm.nextcrm.vn/api/crm/opportunity/{id}"
header = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
  'https://api-nextcrm.nextcrm.vn/api/crm/opportunity/{id}' \  # replace with the id ofopportunity
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url =  'https://api-nextcrm.nextcrm.vn/api/crm/opportunity/{id}'  # replace with the id ofopportunity
const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint allows to retrieve list of opportunity.

HTTPS Request

GET https://api-nextcrm.nextcrm.vn/api/crm/opportunity/{id}

Parameters

Parameter Data Type Description
id string Opprtunity ID (required)

Response

If the request is successful, the server will return a JSON response with updated information

The command returns JSON structured as follows:

  {  "id": 113134,
            "name": "tessxt",
            "opportunity_amount": "0.00",
            "sales_stage": "4018",
            "probability": 0,
            "description": "",
            "expected_close_date": "2024-09-22",
            "type": null,
            "lead_source": null,
            "campaign_id": 732,
            "assigned_to": 5149,
            "user": {
                "name": "admin3",
                "email": "",
                "firstname": "",
                "lastname": "admin",
                "picture": null
            },
            "assigned": {
                "name": "ducdx",
                "email": "",
                "firstname": "Duong Xuan",
                "lastname": "Duc",
                "picture": null
            },
            "lead_source_description": null,
            "contact_id": 718136,
            "user_id": 7025,
            "status": null,
            "reason_failed": null,
            "model_name": "App\\Models\\Crm\\Opportunity",
            "campaign": {
                "id": 732,
                "name": "Ch\u0103m s\u00f3c KH",
                "start_date": "2024-09-19",
                "end_date": "2024-09-22",
                "allow_duplicate_opportunity": 0,
                "divide_opportunity_auto": null,
                "hide_opportunity_info": 0,
                "success_campaign_id": null,
                "failed_campaign_id": null
            },
            "source": null,
            "stage": {
                "id": 4018,
                "name": "Th\u00f4ng tin kh\u00e1ch",
                "stage_type_id": 1,
                "order": 1
            },
            "result_id": null,
            "action_id": 11065,
            "next_action_id": null,
            "prev_action_id": null,
            "perform_after_day": 0,
            "perform_after_hour": 0,
            "perform_after_minute": 0,
            "action": {
                "id": 11065,
                "name": "TH-G\u1ecdi l\u1ea7n 1",
                "order": 17,
                "is_default": 1,
                "is_active": 1,
                "next_action_id": null,
                "perform_after_day": 0,
                "perform_after_hour": 0,
                "perform_after_minute": 30,
                "description": "G\u1ecdi sau khi ti\u1ebfp nh\u1eadn th\u00f4ng tin",
                "results": [
                    {
                        "id": 12951,
                        "order": 3,
                        "name": "G\u1ecdi l\u1ea1i sau",
                        "action_id": null,
                        "status": "in_process",
                        "description": "",
                        "is_active": 1,
                        "tenant_id": 1596,
                        "stage_type_id": 1,
                        "pivot": {
                            "action_id": 11065,
                            "result_id": 12951,
                            "next_action_id": 10079,
                            "order": 1,
                            "perform_after_day": 0,
                            "perform_after_hour": 0,
                            "perform_after_minute": 30
                        }
                    }
                ]
            },
            "next_action": null,
            "prev_action": null,
            "action_result": null,
            "contact": {
                "id": 718136,
                "name": "tessxt",
                "email": "",
                "code": "KH24000004",
                "mobile": "0963419120",
                "address": "",
                "resources": [
                    {
                        "id": 26,
                        "name": "Facebook"
                    }
                ],
                "categories": [
                    {
                        "id": 37741,
                        "name": "Kh\u00e1ch ti\u1ec1m n\u0103ng"
                    }
                ],
                "relationships": []
            },
            "resource_contact": [
                {
                    "id": 26,
                    "name": "Facebook"
                }
            ],
            "category_contact": [
                {
                    "id": 37741,
                    "name": "Kh\u00e1ch ti\u1ec1m n\u0103ng"
                }
            ],
            "relationships_contact": [],
            "contact_name": "tessxt",
            "contact_mobile": "0963419120",
            "contact_email": "",
            "contact_address": "",
            "created_at": "2024-09-19 13:38:39",
            "updated_at": "2024-09-19 13:38:39",
            "time_updated_result": "2024-09-19 13:38:39",
            "tags": [],
            "activity_log": null,
            "total_money": "0.0000",
            "time_update_status": null,
            "last_comment": null,
            "campaign_stage": [
                {
                    "id": 4018,
                    "name": "Th\u00f4ng tin kh\u00e1ch",
                    "stage_type_id": 1,
                    "order": 1
                },
                {
                    "id": 4019,
                    "name": "Ph\u00e2n t\u00edch nhu c\u1ea7u",
                    "stage_type_id": 2,
                    "order": 2
                },
                {
                    "id": 4020,
                    "name": "B\u00e1o gi\u00e1",
                    "stage_type_id": 3,
                    "order": 3
                },
                {
                    "id": 4021,
                    "name": "\u0110\u00e0m ph\u00e1n",
                    "stage_type_id": 4,
                    "order": 4
                },
                {
                    "id": 4022,
                    "name": "Th\u00e0nh c\u00f4ng",
                    "stage_type_id": 5,
                    "order": 5
                },
                {
                    "id": 4023,
                    "name": "Th\u1ea5t b\u1ea1i",
                    "stage_type_id": 6,
                    "order": 6
                }
            ]
        }
            }

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The command returns JSON structured as follows:

{
  "status_code": 401,
  "message": "Token expired"
}

Add New Opportunity

To add a new opportunity, ta use this code:

curl -X 'POST' \
  'https://api-nextcrm.nextcrm.vn/api/crm/opportunity_create' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token' \
  -H 'Content-Type: application/json' \
  -d '{
  "contact": {
    "user_id": 4761,
    "name": "abc",
    "mobile": "",
    "email": "",
    "address": "",
    "sales_stage": null,
    "code": "KH24000338",
    "avatar": "",
    "birthday": null,
    "branch_id": 2518,
    "categories": [],
    "contact_id": null,
    "description": "",
    "details": "",
    "employee_id": null,
    "facebook_zalo": "",
    "relationships": [],
    "resources": [],
    "sex": "male",
    "title": "",
    "website": ""
  },
  "opportunity": {
    "name": "abc",
    "description": "",
    "probability": 0,
    "opportunity_amount": 0,
    "assigned_to": 4761,
    "campaign_id": 733,
    "expected_close_date": "2024-09-19",
    "lead_source": 41098,
    "lead_source_description": "",
    "sales_stage": 4024
  }
}

'
import requests
import json

url = "https://api-nextcrm.nextcrm.vn/api/crm/opportunity_create"
payload = {
  "contact": {
    "user_id": 4761,
    "name": "abc",
    "mobile": "",
    "email": "",
    "address": "",
    "sales_stage": null,
    "code": "KH24000338",
    "avatar": "",
    "birthday": null,
    "branch_id": 2518,
    "categories": [],
    "contact_id": null,
    "description": "",
    "details": "",
    "employee_id": null,
    "facebook_zalo": "",
    "relationships": [],
    "resources": [],
    "sex": "male",
    "title": "",
    "website": ""
  },
  "opportunity": {
    "name": "abc",
    "description": "",
    "probability": 0,
    "opportunity_amount": 0,
    "assigned_to": 4761,
    "campaign_id": 733,
    "expected_close_date": "2024-09-19",
    "lead_source": 41098,
    "lead_source_description": "",
    "sales_stage": 4024
  }
}

headers = {
  'accept': 'application/json',
  'Authorization': 'Bearer your_access_token',
  'Content-Type': 'application/json'
}

response = requests.post(url, headers=headers, data=json.dumps(payload))
print(response.json())
const fetch = require('node-fetch');

const url = 'https://api-nextcrm.nextcrm.vn/api/crm/opportunity_create';
const data = {
  "contact": {
    "user_id": 4761,
    "name": "abc",
    "mobile": "",
    "email": "",
    "address": "",
    "sales_stage": null,
    "code": "KH24000338",
    "avatar": "",
    "birthday": null,
    "branch_id": 2518,
    "categories": [],
    "contact_id": null,
    "description": "",
    "details": "",
    "employee_id": null,
    "facebook_zalo": "",
    "relationships": [],
    "resources": [],
    "sex": "male",
    "title": "",
    "website": ""
  },
  "opportunity": {
    "name": "abc",
    "description": "",
    "probability": 0,
    "opportunity_amount": 0,
    "assigned_to": 4761,
    "campaign_id": 733,
    "expected_close_date": "2024-09-19",
    "lead_source": 41098,
    "lead_source_description": "",
    "sales_stage": 4024
  }
}
;

const options = {
  method: 'POST',
  headers: {
    'accept': 'application/json',
    'Authorization': 'Bearer your_access_token',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(data)
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint allows to add a new opportunity.

The command returns JSON structured as follows:

{
 meta: {status_code: 0, message: "Successfully"}, data: null
        }

This endpoint allows to create a new opportunity

HTTP Request

POST https://api-nextcrm.nextcrm.vn/api/crm/opportunity_create

Parameters

Variable Name Variable Type Description
contact Object Contact information (user_id, name, phone number, email, code)
address String Contact address
avatar String Avatar image
birthday Null/String Contact's date of birth
branch_id Integer Branch ID
categories Array Contact categories
code String Customer code
contact_id Null/Integer Contact ID
description String Description of the contact
details String Contact details
email String Contact email
employee_id Null/Integer Employee ID of the contact
facebook_zalo String Facebook/Zalo account information of the contact
mobile String Contact's phone number
name String Contact's name
relationships Array Relationships of the contact
resources Array Contact sources
sales_stage Null/Integer Sales stage of the contact
sex String Contact's gender
title String Contact's title
user_id Integer User ID of the contact
website String Contact website
opportunity Object Opportunity information (name, description, probability, value)
assigned_to Integer ID of the person assigned to the opportunity
campaign_id Integer Related campaign ID
description String Description of the opportunity
expected_close_date String (Date) Expected closing date of the opportunity
lead_source Integer Lead source
lead_source_description String Description of the lead source
name String Name of the opportunity
opportunity_amount Integer Value of the opportunity
probability Integer Success probability of the opportunity
sales_stage Integer Sales stage of the opportunity

Response

If the request is successful, the server will return a JSON response with updated information

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The command returns JSON structured as follows:

{
  "status_code": 401,
  "message": "Token expired"
}

Update Information opportunity

To update information of opportunity, use this code:

import requests
import json

url = "https://api-nextcrm.nextcrm.vn/api/crm/opportunity/{id}" 
headers = {
  "assigned_to": 4761,
  "campaign_id": 733,
  "contact_id": 837208,
  "description": "",
  "expected_close_date": "2024-09-19",
  "lead_source": "41098",
  "lead_source_description": "",
  "name": "xyz",
  "opportunity_amount": "0.00",
  "probability": 0,
  "sales_stage": 4024
}


response = requests.post(url, json=payload, headers=headers)
print(response.json())
curl -X 'POST' \
  'https://api-nextcrm.nextcrm.vn/api/crm/opportunity/{id}' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token' \
  -H 'Content-Type: application/json' \
  -d '{
  "assigned_to": 4761,
  "campaign_id": 733,
  "contact_id": 837208,
  "description": "",
  "expected_close_date": "2024-09-19",
  "lead_source": "41098",
  "lead_source_description": "",
  "name": "xyz",
  "opportunity_amount": "0.00",
  "probability": 0,
  "sales_stage": 4024
}

'
const fetch = require('node-fetch');

const url = 'https://api-nextcrm.nextcrm.vn/api/crm/opportunity/{id}';  
const options = {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  },
  body: JSON.stringify({
  "assigned_to": 4761,
  "campaign_id": 733,
  "contact_id": 837208,
  "description": "",
  "expected_close_date": "2024-09-19",
  "lead_source": "41098",
  "lead_source_description": "",
  "name": "xyz",
  "opportunity_amount": "0.00",
  "probability": 0,
  "sales_stage": 4024
})
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint allows to retrieve update the information of opportunity.

HTTP Request

PUT https://api-nextcrm.nextcrm.vn/api/crm/opportunity/{id}

Path Tham số

Parameter Data Type Description
id string Opprtunity ID (required)

Response

Example Response

"id": 113135,
        "name": "xyz",
        "opportunity_amount": "0.00",
        "sales_stage": 4024,
        "probability": 0,
        "description": "",
        "expected_close_date": "2024-09-19",
        "type": null,
        "lead_source": "41098",
        "campaign_id": 733,
        "assigned_to": 4761,
        "user": null,
        "assigned": {
            "name": "admin",
            "email": "vietphat.vpic@gmail.com",
            "firstname": "",
            "lastname": "demo",
            "picture": null
        },
        "lead_source_description": "",
        "contact_id": 837208,
        "user_id": null,
        "status": null,
        "reason_failed": null,
        "model_name": "App\\Models\\Crm\\Opportunity",
        "campaign": {
            "id": 733,
            "name": "Chi\u1ebfn d\u1ecbch test",
            "start_date": "2024-09-19",
            "end_date": "2024-09-26",
            "allow_duplicate_opportunity": 0,
            "divide_opportunity_auto": 1,
            "hide_opportunity_info": 1,
            "success_campaign_id": null,
            "failed_campaign_id": null
        },
        "source": {
            "id": 41098,
            "name": "Facebook"
        },
        "stage": {
            "id": 4024,
            "name": "Th\u00f4ng tin kh\u00e1ch",
            "stage_type_id": 1,
            "order": 1
        },
        "result_id": null,
        "action_id": 11065,
        "next_action_id": null,
        "prev_action_id": null,
        "perform_after_day": 0,
        "perform_after_hour": 0,
        "perform_after_minute": 0,
        "action": {
            "id": 11065,
            "name": "TH-G\u1ecdi l\u1ea7n 1",
            "order": 17,
            "is_default": 1,
            "is_active": 1,
            "next_action_id": null,
            "perform_after_day": 0,
            "perform_after_hour": 0,
            "perform_after_minute": 30,
            "description": "G\u1ecdi sau khi ti\u1ebfp nh\u1eadn th\u00f4ng tin",
            "results": [
                {
                    "id": 12951,
                    "order": 3,
                    "name": "G\u1ecdi l\u1ea1i sau",
                    "action_id": null,
                    "status": "in_process",
                    "description": "",
                    "is_active": 1,
                    "tenant_id": 1596,
                    "stage_type_id": 1,
                    "pivot": {
                        "action_id": 11065,
                        "result_id": 12951,
                        "next_action_id": 10079,
                        "order": 1,
                        "perform_after_day": 0,
                        "perform_after_hour": 0,
                        "perform_after_minute": 30
                    }
                }
            ]
        },
        "next_action": null,
        "prev_action": null,
        "action_result": null,
        "contact": {
            "id": 837208,
            "name": "abc",
            "email": "",
            "code": "KH24000338",
            "mobile": "",
            "address": "",
            "resources": [],
            "categories": [],
            "relationships": []
        },
        "resource_contact": [],
        "category_contact": [],
        "relationships_contact": [],
        "contact_name": null,
        "contact_mobile": null,
        "contact_email": null,
        "contact_address": null,
        "created_at": "2024-09-19 15:31:39",
        "updated_at": "2024-09-19 15:38:16",
        "time_updated_result": "2024-09-19 15:31:39",
        "tags": [],
        "activity_log": null,
        "total_money": "0.0000",
        "time_update_status": null,
        "last_comment": null,
        "campaign_stage": [
            {
                "id": 4024,
                "name": "Th\u00f4ng tin kh\u00e1ch",
                "stage_type_id": 1,
                "order": 1
            },
            {
                "id": 4025,
                "name": "Ph\u00e2n t\u00edch nhu c\u1ea7u",
                "stage_type_id": 2,
                "order": 2
            },
            {
                "id": 4026,
                "name": "B\u00e1o gi\u00e1",
                "stage_type_id": 3,
                "order": 3
            },
            {
                "id": 4027,
                "name": "\u0110\u00e0m ph\u00e1n",
                "stage_type_id": 4,
                "order": 4
            },
            {
                "id": 4028,
                "name": "Th\u00e0nh c\u00f4ng",
                "stage_type_id": 5,
                "order": 5
            },
            {
                "id": 4029,
                "name": "Th\u1ea5t b\u1ea1i",
                "stage_type_id": 6,
                "order": 6
            }
        ]

If the request is successful, the server will return a JSON response If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The command returns JSON structured as follows:

{
  "status_code": 401,
  "message": "Token expired"
}

SMS Marketing

View Marketing Campaigns with SMS message

To get the list of SMS campaigns, use this code:

import requires
url = "https://api-nextcrm.nextcrm.vn/api/sms/To get the list of"
header = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
  'https://api-nextcrm.nextcrm.vn/api/sms/To get the list of' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url =  https://api-nextcrm.nextcrm.vn/api/sms/To get the list of'  
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint allows to retrieve list of Campaign SMS.

HTTPS Request

https://api-nextcrm.nextcrm.vn/api/sms/To get the list of

Parameters

Parameter Data Type Description
page integer Page number
pageLimit integer Number of items per page
strSearch string Search filter

Response

If the request is successful, the server will return a JSON response with updated information

The command returns JSON structured as follows:

  {          "id": 155,
        "name": "Chi\u1ebfn d\u1ecbch test 23.9",
        "description": "",
        "sms_content": "Test SMS Marketing campaign ",
        "send_object_type": null,
        "send_all_contact": 1,
        "send_now": 1,
        "send_time": null,
        "template_id": null,
        "type": "sms",
        "params": {
            "param_01": "",
            "param_02": "",
            "param_03": "",
            "param_04": "",
            "param_05": "",
            "param_06": "",
            "param_07": "",
            "param_08": "",
            "param_09": "",
            "param_10": ""
        },
        "created_by": 21,
        "user": {
            "name": "admin",
            "email": "lelinhbk@gmail.com",
            "firstname": "H\u1ea3o",
            "lastname": "nguy\u00ean",
            "picture": null
        },
        "customers": [],
        "customer_groups": [],
        "sms_others": [],
        "To get the list of": [],
        "total_sms": null,
        "total_send": null,
        "total_not_send": 0,
        "total_success": null,
        "total_fail": null,
        "status": "Ch\u01b0a g\u1eedi",
        "time_run": "2024-09-23T07:37:19.000000Z"
    }
}

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The command returns JSON structured as follows:

{
  "status_code": 401,
  "message": "Token expired"
}

View detail information of Campaign SMS

To view detail information of a SMS Campaign, use this code:

import requires
url = "https://api-nextcrm.nextcrm.vn/api/sms/To get the list of/{id}"
header = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
  'https://api-nextcrm.nextcrm.vn/api/sms/To get the list of/{id}' \  # replace with the id ofSMS Campaign
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url =  'https://api-nextcrm.nextcrm.vn/api/sms/To get the list of/{id}'  # replace with the id ofSMS Campaign
const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint allows toto retrieve detail information of SMS Campaign.

HTTPS Request

GET https://api-nextcrm.nextcrm.vn/api/sms/To get the list of/{id}

Parameters

Parameter Type Description
id integer ID of SMS Campaign

Response

If the request is successful, the server will return a JSON response with updated information

The command returns JSON structured as follows:

  {
        "id": 155,
        "name": "Chi\u1ebfn d\u1ecbch test 23.9",
        "description": "",
        "sms_content": "Test SMS Marketing campaign ",
        "send_object_type": null,
        "send_all_contact": 1,
        "send_now": 1,
        "send_time": null,
        "template_id": null,
        "type": "sms",
        "params": {
            "param_01": "",
            "param_02": "",
            "param_03": "",
            "param_04": "",
            "param_05": "",
            "param_06": "",
            "param_07": "",
            "param_08": "",
            "param_09": "",
            "param_10": ""
        },
        "created_by": 21,
        "user": {
            "name": "admin",
            "email": "lelinhbk@gmail.com",
            "firstname": "H\u1ea3o",
            "lastname": "nguy\u00ean",
            "picture": null
        },
        "customers": [],
        "customer_groups": [],
        "sms_others": [],
        "To get the list of": [],
        "total_sms": null,
        "total_send": null,
        "total_not_send": 0,
        "total_success": null,
        "total_fail": null,
        "status": "Ch\u01b0a g\u1eedi",
        "time_run": "2024-09-23T07:37:19.000000Z"
    }

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The command returns JSON structured as follows:

{
  "status_code": 401,
  "message": "Token expired"
}

Add New Campaign SMS

To add a new SMS Campaign, ta use this code:

curl -X 'POST' \
  'https://api-nextcrm.nextcrm.vn/api/sms/To get the list of' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token' \
  -H 'Content-Type: application/json' \
  -d '{
  "To get the list of": [],
  "created_by": 21,
  "customer_groups": [],
  "customers": [],
  "description": "",
  "id": 155,
  "name": "Campaign test 23.9",
  "params": {
    "param_01": "",
    "param_02": "",
    "param_03": "",
    "param_04": "",
    "param_05": "",
    "param_06": "",
    "param_07": ""
  },
  "send_all_contact": 1,
  "send_now": 1,
  "send_object_type": null,
  "send_time": null,
  "sms_content": "Test SMS Marketing campaign",
  "sms_others": [],
  "status": "Chưa gửi",
  "template_id": null,
  "time_run": "2024-09-23T07:37:19.000000Z",
  "total_fail": null,
  "total_not_send": 0,
  "total_send": null,
  "total_sms": null,
  "total_success": null,
  "type": "sms",
  "user": {
    "name": "admin",
    "email": "lelinhbk@gmail.com",
    "firstname": "Hảo",
    "lastname": "nguyên",
    "picture": null
  }
}

'
import requests
import json

url = "https://api-nextcrm.nextcrm.vn/api/sms/To get the list of"
payload = {
  "To get the list of": [],
  "created_by": 21,
  "customer_groups": [],
  "customers": [],
  "description": "",
  "id": 155,
  "name": "Campaign test 23.9",
  "params": {
    "param_01": "",
    "param_02": "",
    "param_03": "",
    "param_04": "",
    "param_05": "",
    "param_06": "",
    "param_07": ""
  },
  "send_all_contact": 1,
  "send_now": 1,
  "send_object_type": null,
  "send_time": null,
  "sms_content": "Test SMS Marketing campaign",
  "sms_others": [],
  "status": "Chưa gửi",
  "template_id": null,
  "time_run": "2024-09-23T07:37:19.000000Z",
  "total_fail": null,
  "total_not_send": 0,
  "total_send": null,
  "total_sms": null,
  "total_success": null,
  "type": "sms",
  "user": {
    "name": "admin",
    "email": "lelinhbk@gmail.com",
    "firstname": "Hảo",
    "lastname": "nguyên",
    "picture": null
  }
}


headers = {
  'accept': 'application/json',
  'Authorization': 'Bearer your_access_token',
  'Content-Type': 'application/json'
}

response = requests.post(url, headers=headers, data=json.dumps(payload))
print(response.json())
const fetch = require('node-fetch');

const url = 'https://api-nextcrm.nextcrm.vn/api/sms/To get the list of';
const data = {
  "To get the list of": [],
  "created_by": 21,
  "customer_groups": [],
  "customers": [],
  "description": "",
  "id": 155,
  "name": "Campaign test 23.9",
  "params": {
    "param_01": "",
    "param_02": "",
    "param_03": "",
    "param_04": "",
    "param_05": "",
    "param_06": "",
    "param_07": ""
  },
  "send_all_contact": 1,
  "send_now": 1,
  "send_object_type": null,
  "send_time": null,
  "sms_content": "Test SMS Marketing campaign",
  "sms_others": [],
  "status": "Chưa gửi",
  "template_id": null,
  "time_run": "2024-09-23T07:37:19.000000Z",
  "total_fail": null,
  "total_not_send": 0,
  "total_send": null,
  "total_sms": null,
  "total_success": null,
  "type": "sms",
  "user": {
    "name": "admin",
    "email": "lelinhbk@gmail.com",
    "firstname": "Hảo",
    "lastname": "nguyên",
    "picture": null
  }
}

;

const options = {
  method: 'POST',
  headers: {
    'accept': 'application/json',
    'Authorization': 'Bearer your_access_token',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(data)
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint allows to add a new Campaign SMS.

The command returns JSON structured as follows:

{
 meta: {status_code: 0, 
        message: "Successfully"}, data: null
        }

This endpoint allows to create a new SMS Campaign.

HTTP Request

POST https://api-nextcrm.nextcrm.vn/api/sms/To get the list of

Parameters

Variable Variable Type Description
campaigns Array List of related campaigns.
created_by Integer ID of the user who created the campaigns.
customer_groups Array List of customer groups.
customers Array List of customers.
description String Description of the campaigns.
id Integer ID of the campaigns.
name String Name of the campaigns.
params Object Configuration parameters of the campaigns.
send_all_contact Integer Value indicating whether to send to all contacts (1 for yes).
send_now Integer Value indicating whether to send immediately (1 for yes).
send_object_type Null Object type to send (currently null).
send_time Null Scheduled send time (currently null).
sms_content String SMS message content.
sms_others Array List of other related SMS.
status String Status of the campaigns (Not sent, Sent, etc.).
template_id Null ID of the message template (currently null).
time_run String (DateTime) Time when campaigns run.
total_fail Null Total number of failed sends (currently null).
total_not_send Integer Total number of unsent messages.
total_send Null Total number of sent messages (currently null).
total_sms Null Total number of related SMS (currently null).
total_success Null Total number of successful sends (currently null).
type String Type of campaigns (SMS or other types).
user Object Information about the user who created the campaigns.
user.name String User's name (admin).
user.email String User's email.
user.firstname String User's first name.
user.lastname String User's last name.
user.picture Null User's profile picture (currently null).

Response

If the request is successful, the server will return a JSON response with updated information

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The command returns JSON structured as follows:

{
  "status_code": 401,
  "message": "Token expired"
}

Update Information SMS Campaign

To update information of SMS Campaign, use this code:

import requests
import json

url = "https://api-nextcrm.nextcrm.vn/api/sms/To get the list of/{id}" 
headers = {
  "To get the list of": [],
  "created_by": 21,
  "customer_groups": [],
  "customers": [],
  "description": "",
  "id": 155,
  "name": "Campaign test 23.9",
  "params": {
    "param_01": "",
    "param_02": "",
    "param_03": "",
    "param_04": "",
    "param_05": "",
    "param_06": "",
    "param_07": ""
  },
  "send_all_contact": 1,
  "send_now": 1,
  "send_object_type": null,
  "send_time": null,
  "sms_content": "Test SMS Marketing campaign",
  "sms_others": [],
  "status": "Chưa gửi",
  "template_id": null,
  "time_run": "2024-09-23T07:37:19.000000Z",
  "total_fail": null,
  "total_not_send": 0,
  "total_send": null,
  "total_sms": null,
  "total_success": null,
  "type": "sms",
  "user": {
    "name": "admin",
    "email": "lelinhbk@gmail.com",
    "firstname": "Hảo",
    "lastname": "nguyên",
    "picture": null
  }
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
curl -X 'POST' \
  'https://api-nextcrm.nextcrm.vn/api/sms/To get the list of/{id}' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token' \
  -H 'Content-Type: application/json' \
  -d '{
  "To get the list of": [],
  "created_by": 21,
  "customer_groups": [],
  "customers": [],
  "description": "",
  "id": 155,
  "name": "Campaign test 23.9",
  "params": {
    "param_01": "",
    "param_02": "",
    "param_03": "",
    "param_04": "",
    "param_05": "",
    "param_06": "",
    "param_07": ""
  },
  "send_all_contact": 1,
  "send_now": 1,
  "send_object_type": null,
  "send_time": null,
  "sms_content": "Test SMS Marketing campaign",
  "sms_others": [],
  "status": "Chưa gửi",
  "template_id": null,
  "time_run": "2024-09-23T07:37:19.000000Z",
  "total_fail": null,
  "total_not_send": 0,
  "total_send": null,
  "total_sms": null,
  "total_success": null,
  "type": "sms",
  "user": {
    "name": "admin",
    "email": "lelinhbk@gmail.com",
    "firstname": "Hảo",
    "lastname": "nguyên",
    "picture": null
  }
}
'
const fetch = require('node-fetch');

const url = 'https://api-nextcrm.nextcrm.vn/api/sms/To get the list of/{id}';  
const options = {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  },
  body: JSON.stringify({
  "To get the list of": [],
  "created_by": 21,
  "customer_groups": [],
  "customers": [],
  "description": "",
  "id": 155,
  "name": "Campaign test 23.9",
  "params": {
    "param_01": "",
    "param_02": "",
    "param_03": "",
    "param_04": "",
    "param_05": "",
    "param_06": "",
    "param_07": ""
  },
  "send_all_contact": 1,
  "send_now": 1,
  "send_object_type": null,
  "send_time": null,
  "sms_content": "Test SMS Marketing campaign",
  "sms_others": [],
  "status": "Chưa gửi",
  "template_id": null,
  "time_run": "2024-09-23T07:37:19.000000Z",
  "total_fail": null,
  "total_not_send": 0,
  "total_send": null,
  "total_sms": null,
  "total_success": null,
  "type": "sms",
  "user": {
    "name": "admin",
    "email": "lelinhbk@gmail.com",
    "firstname": "Hảo",
    "lastname": "nguyên",
    "picture": null
  }
})
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint allows to retrieve update the information of a SMS Campaign.

HTTP Request

PUT https://api-nextcrm.nextcrm.vn/api/sms/To get the list of/{id}

Path Tham số

Parameter Type Description
id string ID of SMS Campaign (required)

Response

Example Request

 {      "id": 155,
        "name": "Chi\u1ebfn d\u1ecbch test 23.9",
        "description": "",
        "sms_content": "Test SMS Marketing campaign ",
        "send_object_type": null,
        "send_all_contact": 1,
        "send_now": 1,
        "send_time": null,
        "template_id": null,
        "type": "sms",
        "params": {
            "param_01": "",
            "param_02": "",
            "param_03": "",
            "param_04": "",
            "param_05": "",
            "param_06": "",
            "param_07": "",
            "param_08": "",
            "param_09": "",
            "param_10": ""
        },
        "created_by": 21,
        "user": {
            "name": "admin",
            "email": "lelinhbk@gmail.com",
            "firstname": "H\u1ea3o",
            "lastname": "nguy\u00ean",
            "picture": null
        },
        "customers": [],
        "customer_groups": [],
        "sms_others": [],
        "To get the list of": [],
        "total_sms": null,
        "total_send": null,
        "total_not_send": 0,
        "total_success": null,
        "total_fail": null,
        "status": "Ch\u01b0a g\u1eedi",
        "time_run": "2024-09-23T07:37:19.000000Z"
    }
}

If the request is successful, the server will return a JSON response If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The command returns JSON structured as follows:

{
  "status_code": 401,
  "message": "Token expired"
}

View SMS message History

To get the list of sent SMS messages, use this code:

import requires
url = "https://api-nextcrm.nextcrm.vn/api/sms/history"
header = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
  'https://api-nextcrm.nextcrm.vn/api/sms/history' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url =  https://api-nextcrm.nextcrm.vn/api/sms/history'  
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint allows to retrieve list of sent SMS mesages.

HTTPS Request

https://api-nextcrm.nextcrm.vn/api/sms/history

Parameters

Parameter Type Description
page integer Page number
pageLimit integer Number of items per page
strSearch string Search filter
fromDate string Start date for filtering
toDate string End date for filtering
search[sms_type] string Filter by message type

Response

If the request is successful, the server will return a JSON response with updated information

The command returns JSON structured as follows:

  {
            "id": 144019,
            "sms_id": null,
            "content": "Test SMS Marketing campaign ",
            "phone": "0123123123",
            "status": 0,
            "message": "TokenNotValid: IDX10000: The parameter 'token' cannot be a 'null' or an empty object.\r\nParameter name: token",
            "date_send": "2024-09-23 14:37:22",
            "sms_type": "sms",
            "causer_type": "App\\Models\\Customer\\Customer",
            "causer_id": 9,
            "causer": {
                "id": 9,
                "type": "supplier",
                "supplier_business_name": "nghia test lan 2",
                "name": "nghia test lan 2",
                "email": null,
                "contact_id": "nghia_test_lan_2",
                "tax_number": null,
                "city": null,
                "state": null,
                "country": null,
                "landmark": null,
                "mobile": "0123123123",
                "landline": null,
                "alternate_number": null,
                "pay_term_number": null,
                "pay_term_type": "days",
                "created_by": null,
                "is_default": 0,
                "credit_limit": null,
                "customer_group_id": null,
                "custom_field1": null,
                "custom_field2": null,
                "custom_field3": null,
                "custom_field4": null,
                "total_rp": 0,
                "total_rp_used": 0,
                "total_rp_expired": 0,
                "tenant_id": 1,
                "address": null,
                "description": null,
                "avatar": null,
                "lead_id": null,
                "employee_id": null,
                "subject_type": "",
                "subject_id": null,
                "ecommerce_refer_id": null,
                "province_id": null,
                "district_id": null,
                "ward_id": null,
                "date_assigned": null,
                "gender": null,
                "birthday": null,
                "branch_id": null,
                "is_active": 1,
                "user_zalo_id": null,
                "password": null,
                "current_due": "2888317.4332",
                "total_credit": "3195486.4286",
                "total_debit": "331612.9954",
                "user_id": null,
                "is_blocked": 0,
                "is_sample_data": 0,
                "refer_tenant_id": null,
                "lat": null,
                "lng": null,
                "referral_code": null,
                "account_name": null,
                "account_address": null,
                "account_no": null,
                "ecommerce": null,
                "type_id": null,
                "channel_id": null,
                "region_id": null,
                "parent_id": null
            },
            "causer_name": "0123123123"
        }

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The command returns JSON structured as follows:

{
  "status_code": 401,
  "message": "Token expired"
}

Email Marketing

View list of campaigns Marketing with Email message

To get the list of Email campaign, use this code:

import requires
url = "https://api-nextcrm.nextcrm.vn/api/email/campaign"
header = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
  'https://api-nextcrm.nextcrm.vn/api/email/campaign' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url =  'https://api-nextcrm.nextcrm.vn/api/email/campaign'  
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint allows to retrieve list of Campaign Email.

HTTPS Request

GET https://api-nextcrm.nextcrm.vn/api/email/campaign

Parameters

Parameter Type Description
page integer Page number
pageLimit integer Number of items per page
strSearch string Search filter

Response

If the request is successful, the server will return a JSON response with updated information

The command returns JSON structured as follows:

  {
            "id": 106,
            "name": "Test g\u1eedi emailXXXXXXXXX",
            "description": "",
            "from_name": "NextX",
            "mail_from": "noreply.nextcrm@gmail.com",
            "mail_subject": "XXXXXXH\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng ph\u1ea7n m\u1ec1m NextCrmXXXXXXXX",
            "mail_content": "<p> <strong>{{contact_name}} th\u00e2n m\u1ebfn,<\/strong><\/p><p>C\u1ea3m \u01a1n \u0111\u00e3 quan t\u00e2m \u0111\u1ebfn ph\u1ea7m m\u1ec1m qu\u1ea3n l\u00fd v\u00e0 ch\u0103m s\u00f3c kh\u00e1ch h\u00e0ng c\u1ee7a NEXTCRM. M\u1eddi b\u1ea1n xem th\u00eam h\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng ph\u1ea7n m\u1ec1m \u0111\u1ec3 c\u00f3 nh\u1eefng tr\u1ea3i nghi\u1ec7m t\u1ed1t h\u01a1n v\u00e0 c\u00f3 th\u00eam nh\u1eefng \u00fd t\u01b0\u1edfng m\u1edbi \u1ee9ng d\u1ee5ng v\u00e0o gi\u1ea3i b\u00e0i to\u00e1n doanh nghi\u1ec7p \u0111ang g\u1eb7p ph\u1ea3i:<\/p><p><span style=\"color: rgb(34, 34, 34); font-family: Roboto, RobotoDraft, Helvetica, Arial, sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; font-size: 14px;\">*H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng ph\u1ea7n m\u1ec1m:<\/span><span>&nbsp;<\/span><a href=\"https:\/\/support.nextcrm.vn\/\" target=\"_blank\" title=\"H\u01b0\u1edbng d\u1eabn x\u1eed d\u1ee5ng\"><span style=\"font-size: 14px;\">[H\u01b0\u1edbng d\u1eabn]<\/span><\/a><\/p><p><span style=\"color: rgb(34, 34, 34); font-family: Roboto, RobotoDraft, Helvetica, Arial, sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; font-size: 14px;\">Ch\u00fac b\u1ea1n m\u1ed9t ng\u00e0y t\u1ed1t l\u00e0nh!<\/span><br style=\"color: rgb(34, 34, 34); font-family: Roboto, RobotoDraft, Helvetica, Arial, sans-serif; font-size: small; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;\">NEXT<span class=\"il\">CRM<\/span><\/p>",
            "send_object_type": null,
            "file_attach": null,
            "send_all_contact": 0,
            "is_mail_system": 1,
            "send_now": 1,
            "is_track_mail": 1,
            "send_time": null,
            "template_id": null,
            "created_by": 21,
            "user": {
                "name": "admin",
                "email": "lelinhbk@gmail.com",
                "firstname": "H\u1ea3o",
                "lastname": "nguy\u00ean",
                "picture": null
            },
            "customers": [
                {
                    "id": 222216,
                    "type": "customer",
                    "supplier_business_name": "",
                    "name": "Le Van Linh",
                    "email": "lelinhbk@gmail.com",
                    "contact_id": "24000390",
                    "tax_number": "",
                    "city": "",
                    "state": "",
                    "country": null,
                    "landmark": "",
                    "mobile": "",
                    "landline": "",
                    "alternate_number": "",
                    "pay_term_number": 0,
                    "pay_term_type": "days",
                    "created_by": null,
                    "is_default": 0,
                    "credit_limit": "0.0000",
                    "customer_group_id": 1,
                    "custom_field1": "",
                    "custom_field2": "",
                    "custom_field3": "",
                    "custom_field4": "",
                    "total_rp": 0,
                    "total_rp_used": 0,
                    "total_rp_expired": 0,
                    "tenant_id": 1,
                    "address": "",
                    "description": "Ngu\u1ed3n t\u1eeb chat facebook: NextX Gym Master",
                    "avatar": "https:\/\/img.nextcrm.vn\/nextcrm\/nextcrm\/1721532870998\/avatar.jpg",
                    "lead_id": 790271,
                    "employee_id": 36430,
                    "subject_type": "App\\Models\\Contact\\Contact",
                    "subject_id": 790271,
                    "ecommerce_refer_id": null,
                    "province_id": null,
                    "district_id": null,
                    "ward_id": null,
                    "date_assigned": "2024-08-05",
                    "gender": null,
                    "birthday": null,
                    "branch_id": 1,
                    "is_active": 1,
                    "user_zalo_id": null,
                    "password": null,
                    "current_due": "0.0000",
                    "total_credit": "0.0000",
                    "total_debit": "0.0000",
                    "user_id": null,
                    "is_blocked": 0,
                    "is_sample_data": 0,
                    "refer_tenant_id": null,
                    "lat": 21.018533767745573,
                    "lng": 105.78038547188044,
                    "referral_code": null,
                    "account_name": "",
                    "account_address": "",
                    "account_no": "",
                    "ecommerce": null,
                    "type_id": null,
                    "channel_id": null,
                    "region_id": null,
                    "parent_id": null,
                    "pivot": {
                        "email_id": 106,
                        "customer_id": 222216
                    }
                }
            ],
            "customer_groups": [],
            "email_others": [
                {
                    "id": 1,
                    "email_id": 106,
                    "mobile": "0977999888",
                    "name": "Nguy\u1ec5n H\u1eefu T\u00f9ng",
                    "email": "abc@gmail.com",
                    "sex": "Nam",
                    "birthday": "2020-04-14",
                    "address": "H\u00e0 N\u1ed9i",
                    "message": "K\u00ednh ch\u00e0o qu\u00fd kh\u00e1ch",
                    "param_01": "param_01",
                    "param_02": "param_02",
                    "param_03": "param_03",
                    "param_04": "param_04",
                    "param_05": "param_05"
                }

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The command returns JSON structured as follows:

{
  "status_code": 401,
  "message": "Token expired"
}

View detail information of Campaign Email

To view detail information of a Email campaign, use this code:

import requires
url = "https://api-nextcrm.nextcrm.vn/api/email/campaign/{id}"
header = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
  'https://api-nextcrm.nextcrm.vn/api/email/campaign/{id}' \  # replace with the id of Email campaign
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url =  'https://api-nextcrm.nextcrm.vn/api/email/campaign/{id}'  # replace with the id of Email campaign
const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint allows toto retrieve detail information of 1 Email campaign.

HTTPS Request

GET https://api-nextcrm.nextcrm.vn/api/email/campaign/{id}

Parameters

Parameter Type Description
id integer ID of Email campaign

Response

If the request is successful, the server will return a JSON response with updated information

The command returns JSON structured as follows:

{
        "id": 106,
        "name": "Test g\u1eedi emailXXXXXXXXX",
        "description": "",
        "from_name": "NextX",
        "mail_from": "noreply.nextcrm@gmail.com",
        "mail_subject": "XXXXXXH\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng ph\u1ea7n m\u1ec1m NextCrmXXXXXXXX",
        "mail_content": "<p> <strong>{{contact_name}} th\u00e2n m\u1ebfn,<\/strong><\/p><p>C\u1ea3m \u01a1n \u0111\u00e3 quan t\u00e2m \u0111\u1ebfn ph\u1ea7m m\u1ec1m qu\u1ea3n l\u00fd v\u00e0 ch\u0103m s\u00f3c kh\u00e1ch h\u00e0ng c\u1ee7a NEXTCRM. M\u1eddi b\u1ea1n xem th\u00eam h\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng ph\u1ea7n m\u1ec1m \u0111\u1ec3 c\u00f3 nh\u1eefng tr\u1ea3i nghi\u1ec7m t\u1ed1t h\u01a1n v\u00e0 c\u00f3 th\u00eam nh\u1eefng \u00fd t\u01b0\u1edfng m\u1edbi \u1ee9ng d\u1ee5ng v\u00e0o gi\u1ea3i b\u00e0i to\u00e1n doanh nghi\u1ec7p \u0111ang g\u1eb7p ph\u1ea3i:<\/p><p><span style=\"color: rgb(34, 34, 34); font-family: Roboto, RobotoDraft, Helvetica, Arial, sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; font-size: 14px;\">*H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng ph\u1ea7n m\u1ec1m:<\/span><span>&nbsp;<\/span><a href=\"https:\/\/support.nextcrm.vn\/\" target=\"_blank\" title=\"H\u01b0\u1edbng d\u1eabn x\u1eed d\u1ee5ng\"><span style=\"font-size: 14px;\">[H\u01b0\u1edbng d\u1eabn]<\/span><\/a><\/p><p><span style=\"color: rgb(34, 34, 34); font-family: Roboto, RobotoDraft, Helvetica, Arial, sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; font-size: 14px;\">Ch\u00fac b\u1ea1n m\u1ed9t ng\u00e0y t\u1ed1t l\u00e0nh!<\/span><br style=\"color: rgb(34, 34, 34); font-family: Roboto, RobotoDraft, Helvetica, Arial, sans-serif; font-size: small; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;\">NEXT<span class=\"il\">CRM<\/span><\/p>",
        "send_object_type": null,
        "file_attach": null,
        "send_all_contact": 0,
        "is_mail_system": 1,
        "send_now": 1,
        "is_track_mail": 1,
        "send_time": null,
        "template_id": null,
        "created_by": 21,
        "user": {
            "name": "admin",
            "email": "lelinhbk@gmail.com",
            "firstname": "H\u1ea3o",
            "lastname": "nguy\u00ean",
            "picture": null
        },
        "customers": [
            {
                "id": 222216,
                "type": "customer",
                "supplier_business_name": "",
                "name": "Le Van Linh",
                "email": "lelinhbk@gmail.com",
                "contact_id": "24000390",
                "tax_number": "",
                "city": "",
                "state": "",
                "country": null,
                "landmark": "",
                "mobile": "",
                "landline": "",
                "alternate_number": "",
                "pay_term_number": 0,
                "pay_term_type": "days",
                "created_by": null,
                "is_default": 0,
                "credit_limit": "0.0000",
                "customer_group_id": 1,
                "custom_field1": "",
                "custom_field2": "",
                "custom_field3": "",
                "custom_field4": "",
                "total_rp": 0,
                "total_rp_used": 0,
                "total_rp_expired": 0,
                "tenant_id": 1,
                "address": "",
                "description": "Ngu\u1ed3n t\u1eeb chat facebook: NextX Gym Master",
                "avatar": "https:\/\/img.nextcrm.vn\/nextcrm\/nextcrm\/1721532870998\/avatar.jpg",
                "lead_id": 790271,
                "employee_id": 36430,
                "subject_type": "App\\Models\\Contact\\Contact",
                "subject_id": 790271,
                "ecommerce_refer_id": null,
                "province_id": null,
                "district_id": null,
                "ward_id": null,
                "date_assigned": "2024-08-05",
                "gender": null,
                "birthday": null,
                "branch_id": 1,
                "is_active": 1,
                "user_zalo_id": null,
                "password": null,
                "current_due": "0.0000",
                "total_credit": "0.0000",
                "total_debit": "0.0000",
                "user_id": null,
                "is_blocked": 0,
                "is_sample_data": 0,
                "refer_tenant_id": null,
                "lat": 21.018533767745573,
                "lng": 105.78038547188044,
                "referral_code": null,
                "account_name": "",
                "account_address": "",
                "account_no": "",
                "ecommerce": null,
                "type_id": null,
                "channel_id": null,
                "region_id": null,
                "parent_id": null,
                "pivot": {
                    "email_id": 106,
                    "customer_id": 222216
                }
            }
        ],
        "customer_groups": [],
        "email_others": [
            {
                "id": 1,
                "email_id": 106,
                "mobile": "0977999888",
                "name": "Nguy\u1ec5n H\u1eefu T\u00f9ng",
                "email": "abc@gmail.com",
                "sex": "Nam",
                "birthday": "2020-04-14",
                "address": "H\u00e0 N\u1ed9i",
                "message": "K\u00ednh ch\u00e0o qu\u00fd kh\u00e1ch",
                "param_01": "param_01",
                "param_02": "param_02",
                "param_03": "param_03",
                "param_04": "param_04",
                "param_05": "param_05"
            },
            {
                "id": 2,
                "email_id": 106,
                "mobile": "0977999888",
                "name": "Nguy\u1ec5n H\u1eefu T\u00f9ng",
                "email": "abc@gmail.com",
                "sex": "Nam",
                "birthday": "2020-04-14",
                "address": "H\u00e0 N\u1ed9i",
                "message": "K\u00ednh ch\u00e0o qu\u00fd kh\u00e1ch",
                "param_01": "param_01",
                "param_02": "param_02",
                "param_03": "param_03",
                "param_04": "param_04",
                "param_05": "param_05"
            },
            {
                "id": 3,
                "email_id": 106,
                "mobile": "0977999888",
                "name": "Nguy\u1ec5n H\u1eefu T\u00f9ng",
                "email": "abc@gmail.com",
                "sex": "Nam",
                "birthday": "2020-04-14",
                "address": "H\u00e0 N\u1ed9i",
                "message": "K\u00ednh ch\u00e0o qu\u00fd kh\u00e1ch",
                "param_01": "param_01",
                "param_02": "param_02",
                "param_03": "param_03",
                "param_04": "param_04",
                "param_05": "param_05"
            }
        ],
        "params": {
            "param_01": "",
            "param_02": "",
            "param_03": "",
            "param_04": "",
            "param_05": "",
            "param_06": "",
            "param_07": "",
            "param_08": "",
            "param_09": "",
            "param_10": ""
        },
        "campaign": [],
        "total_emails": null,
        "total_send": null,
        "total_not_send": 0,
        "total_read": null,
        "total_not_read": null,
        "total_success": null,
        "total_fail": null,
        "status": "\u0110\u00e3 g\u1eedi",
        "time_run": "2024-08-07T10:06:11.000000Z"
    }

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The command returns JSON structured as follows:

{
  "status_code": 401,
  "message": "Token expired"
}

Add New Campaign Email

To add a new Email campaign, ta use this code:

curl -X 'POST' \
  'https://api-nextcrm.nextcrm.vn/api/email/campaign' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token' \
  -H 'Content-Type: application/json' \
  -d '{
  "campaign": [708],
  "customer_groups": ["26"],
  "customers": [],
  "description": "",
  "email_others": [],
  "from_name": "DemoX",
  "is_mail_system": 1,
  "is_track_mail": 0,
  "mail_content": "<p>Marketing tự động</p>",
  "mail_from": "noreply.nextcrm@gmail.com",
  "mail_subject": "Test Email campaign",
  "name": "Email campaign",
  "params": {
    "param_01": "",
    "param_02": "",
    "param_03": "",
    "param_04": "",
    "param_05": "",
    "param_06": "",
    "param_07": ""
  },
  "send_all_contact": 0,
  "send_now": 1,
  "send_time": null
}

'
import requests
import json

url = "https://api-nextcrm.nextcrm.vn/api/email/campaign"
payload = {
  "campaign": [708],
  "customer_groups": ["26"],
  "customers": [],
  "description": "",
  "email_others": [],
  "from_name": "DemoX",
  "is_mail_system": 1,
  "is_track_mail": 0,
  "mail_content": "<p>Marketing tự động</p>",
  "mail_from": "noreply.nextcrm@gmail.com",
  "mail_subject": "Test Email campaign",
  "name": "Email campaign",
  "params": {
    "param_01": "",
    "param_02": "",
    "param_03": "",
    "param_04": "",
    "param_05": "",
    "param_06": "",
    "param_07": ""
  },
  "send_all_contact": 0,
  "send_now": 1,
  "send_time": null
}



headers = {
  'accept': 'application/json',
  'Authorization': 'Bearer your_access_token',
  'Content-Type': 'application/json'
}

response = requests.post(url, headers=headers, data=json.dumps(payload))
print(response.json())
const fetch = require('node-fetch');

const url = 'https://api-nextcrm.nextcrm.vn/api/email/campaign';
const data = {
  "campaign": [708],
  "customer_groups": ["26"],
  "customers": [],
  "description": "",
  "email_others": [],
  "from_name": "DemoX",
  "is_mail_system": 1,
  "is_track_mail": 0,
  "mail_content": "<p>Marketing tự động</p>",
  "mail_from": "noreply.nextcrm@gmail.com",
  "mail_subject": "Test Email campaign",
  "name": "Email campaign",
  "params": {
    "param_01": "",
    "param_02": "",
    "param_03": "",
    "param_04": "",
    "param_05": "",
    "param_06": "",
    "param_07": ""
  },
  "send_all_contact": 0,
  "send_now": 1,
  "send_time": null
}


;

const options = {
  method: 'POST',
  headers: {
    'accept': 'application/json',
    'Authorization': 'Bearer your_access_token',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(data)
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint allows to add a new Campaign Email.

The command returns JSON structured as follows:

{
 meta: {status_code: 0, 
        message: "Successfully"}, data: null
        }

This endpoint allows to create a new Email campaign.

HTTP Request

POST https://api-nextcrm.nextcrm.vn/api/email/campaign

Parameters

Variable Type Description
campaign Array List of IDs of related campaigns.
customer_groups Array List of IDs of related customer groups.
customers Array List of customers.
description String Description of the campaigns.
email_others Array List of other emails related to the campaigns.
from_name String Sender's name for the campaign emails.
is_mail_system Integer Indicates whether a mail system is used (1 for yes).
is_track_mail Integer Indicates whether to track emails (0 for no).
mail_content String Content of the email in the campaigns.
mail_from String Sender's email address.
mail_subject String Subject of the campaign emails.
name String Name of the campaign email.
params Object Configuration parameters for the campaigns.
send_all_contact Integer Indicates whether to send to all contacts.
send_now Integer Indicates whether to send immediately (1 for yes).
send_time Null Scheduled send time (currently null).

Response

If the request is successful, the server will return a JSON response with updated information

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The command returns JSON structured as follows:

{
  "status_code": 401,
  "message": "Token expired"
}

Update Information Email campaign

To update information of Email campaign, use this code:

import requests
import json

url = "https://api-nextcrm.nextcrm.vn/api/sms/campaign/{id}" 
headers = {
  {
  "campaign": [708],
  "customer_groups": ["26"],
  "customers": [],
  "description": "",
  "email_others": [],
  "from_name": "DemoX",
  "is_mail_system": 1,
  "is_track_mail": 0,
  "mail_content": "<p>Marketing tự động</p>",
  "mail_from": "noreply.nextcrm@gmail.com",
  "mail_subject": "Test Email campaign",
  "name": "Email campaign",
  "params": {
    "param_01": "",
    "param_02": "",
    "param_03": "",
    "param_04": "",
    "param_05": "",
    "param_06": "",
    "param_07": ""
  },
  "send_all_contact": 0,
  "send_now": 1,
  "send_time": null
}


response = requests.post(url, json=payload, headers=headers)
print(response.json())
curl -X 'POST' \
  'https://api-nextcrm.nextcrm.vn/api/sms/campaign/{id}' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token' \
  -H 'Content-Type: application/json' \
  -d '{
  "campaign": [708],
  "customer_groups": ["26"],
  "customers": [],
  "description": "",
  "email_others": [],
  "from_name": "DemoX",
  "is_mail_system": 1,
  "is_track_mail": 0,
  "mail_content": "<p>Marketing tự động</p>",
  "mail_from": "noreply.nextcrm@gmail.com",
  "mail_subject": "Test Email campaign",
  "name": "Email campaign",
  "params": {
    "param_01": "",
    "param_02": "",
    "param_03": "",
    "param_04": "",
    "param_05": "",
    "param_06": "",
    "param_07": ""
  },
  "send_all_contact": 0,
  "send_now": 1,
  "send_time": null
}

'
const fetch = require('node-fetch');

const url = 'https://api-nextcrm.nextcrm.vn/api/sms/campaign/{id}';  
const options = {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  },
  body: JSON.stringify({
  "campaign": [708],
  "customer_groups": ["26"],
  "customers": [],
  "description": "",
  "email_others": [],
  "from_name": "DemoX",
  "is_mail_system": 1,
  "is_track_mail": 0,
  "mail_content": "<p>Marketing tự động</p>",
  "mail_from": "noreply.nextcrm@gmail.com",
  "mail_subject": "Test Email campaign",
  "name": "Email campaign",
  "params": {
    "param_01": "",
    "param_02": "",
    "param_03": "",
    "param_04": "",
    "param_05": "",
    "param_06": "",
    "param_07": ""
  },
  "send_all_contact": 0,
  "send_now": 1,
  "send_time": null
}
)
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint allows to retrieve update the information of Email campaign.

HTTP Request

PUT https://api-nextcrm.nextcrm.vn/api/email/campaign/{id}

Path Tham số

Parameter Type Description
id string ID of Email campaign (required)

Response

Example Request

 {      {
        "id": 115,
        "name": "Email campaign",
        "description": "",
        "from_name": "DemoX",
        "mail_from": "noreply.nextcrm@gmail.com",
        "mail_subject": "Test chi\u1ebfn d\u1ecbch Email",
        "mail_content": "<p>Marketing t\u1ef1 \u0111\u1ed9ng<\/p>",
        "send_object_type": null,
        "file_attach": null,
        "send_all_contact": 0,
        "is_mail_system": 1,
        "send_now": 1,
        "is_track_mail": 0,
        "send_time": null,
        "template_id": null,
        "created_by": 21,
        "user": {
            "name": "admin",
            "email": "lelinhbk@gmail.com",
            "firstname": "H\u1ea3o",
            "lastname": "nguy\u00ean",
            "picture": null
        },
        "customers": [],
        "customer_groups": [
            {
                "id": 26,
                "name": "Kh\u00e1ch h\u00e0ng c\u01a1 b\u1ea3n",
                "amount": 0,
                "description": "\u0110\u00e3 m\u1edf t\u00e0i kho\u1ea3n t\u1ea1i MB",
                "is_sample_data": 0,
                "pivot": {
                    "email_id": 115,
                    "customer_group_id": 26
                }
            }
        ],
        "email_others": [],
        "params": {
            "param_01": "",
            "param_02": "",
            "param_03": "",
            "param_04": "",
            "param_05": "",
            "param_06": "",
            "param_07": "",
            "param_08": "",
            "param_09": "",
            "param_10": ""
        },
        "campaign": [
            {
                "id": 708,
                "name": "Tuyen test",
                "start_date": "2024-05-10",
                "end_date": "2024-05-10",
                "budget": "0.00",
                "actual_cost": null,
                "objective": "",
                "description": "",
                "status": "108",
                "type": null,
                "impression": null,
                "expected_cost": null,
                "expected_revenue": null,
                "assigned_to": 21,
                "tenant_id": 1,
                "user_id": 21,
                "code": "CP000143",
                "allow_duplicate_opportunity": 0,
                "divide_opportunity_auto": null,
                "hide_opportunity_info": 0,
                "success_campaign_id": null,
                "failed_campaign_id": null,
                "time_wait_register": null,
                "campaign_type": 107,
                "branch_id": 1,
                "pivot": {
                    "email_id": 115,
                    "campaign_id": 708
                }
            }
        ],
        "total_emails": null,
        "total_send": null,
        "total_not_send": 0,
        "total_read": null,
        "total_not_read": null,
        "total_success": null,
        "total_fail": null,
        "status": "\u0110\u00e3 g\u1eedi",
        "time_run": "2024-09-23T08:39:49.000000Z"
    }

If the request is successful, the server will return a JSON response If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The command returns JSON structured as follows:

{
  "status_code": 401,
  "message": "Token expired"
}

View Email Message History

To get the list of sent email message, use this code:

import requires
url = "https://api-nextcrm.nextcrm.vn/api/email/history"
header = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
  'https://api-nextcrm.nextcrm.vn/api/email/history' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url =  'https://api-nextcrm.nextcrm.vn/api/email/history'  
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint allows to retrive the list of sent Email messages history.

HTTPS Request

GET https://api-nextcrm.nextcrm.vn/api/email/history

Parameters

Parameter Type Description
page integer Page number
pageLimit integer Number of items per page
campaign_name string Name of the campaigns
mail_from string Email sender
mail_to string Email recipient
from_date string Start date for filtering
to_date string End date for filtering

Response

If the request is successful, the server will return a JSON response with updated information

The command returns JSON structured as follows:

 {
            "id": 115,
            "subject": "Test chi\u1ebfn d\u1ecbch Email",
            "body": "<p>Marketing t\u1ef1 \u0111\u1ed9ng<\/p>",
            "email": "9999999999999999999@gmai.com",
            "status": 1,
            "date_send": "2024-09-23 15:39:52",
            "causer_type": "App\\Models\\Contact\\Contact",
            "causer_id": 713436,
            "error_message": "G\u1eedi th\u00e0nh c\u00f4ng",
            "email_id": 115,
            "email_from": "noreply.nextcrm@gmail.com",
            "is_read": 0,
            "time_read": null,
            "causer": {
                "id": 713436,
                "name": "aaaaaaaaaaaaaa",
                "phone": null,
                "mobile": "0977999555",
                "email": "9999999999999999999@gmai.com",
                "default": null,
                "website": null,
                "details": null,
                "address": null,
                "street": null,
                "city": null,
                "state": null,
                "country": null,
                "zip": null,
                "lat": null,
                "lng": null,
                "status": null,
                "slug": null,
                "user_id": null,
                "user_type": null,
                "upload_folder": null,
                "tenant_id": 1,
                "deleted_at": null,
                "created_at": "2024-01-20 10:16:32",
                "updated_at": "2024-07-31 16:51:05",
                "title": null,
                "sales_stage": null,
                "code": "24000057",
                "birthday": null,
                "sex": "male",
                "contact_tel": null,
                "contact_name": null,
                "contact_description": null,
                "contact_email": null,
                "contact_position": null,
                "facebook_zalo": null,
                "employee_id": null,
                "branch_id": 21,
                "user_zalo_id": null,
                "avatar": null,
                "description": "aaaaaa",
                "member_id": null,
                "source": "landing_page",
                "page_id": null,
                "psid": null,
                "utm_id": null,
                "utm_source": null,
                "utm_medium": null,
                "utm_campaign": null,
                "utm_term": null,
                "utm_content": null,
                "utm_ref_code": null,
                "utm_seller_code": null,
                "province_id": 1,
                "district_id": null,
                "ward_id": null,
                "date_assigned": null,
                "refer_tenant_id": null,
                "is_sample_data": 0,
                "created_by": null,
                "updated_by": null,
                "tax_number": null,
                "account_name": null,
                "account_address": null,
                "account_no": null,
                "pipeline_note": null,
                "pipeline_id": 8,
                "constraint_code": null
            }
        }

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The command returns JSON structured as follows:

{
  "status_code": 401,
  "message": "Token expired"
}

Get Statistic of Email campaign

To view statistic of Email campaign, use this code:

import requires
url = "https://api-nextcrm.nextcrm.vn/api/email/statistic"
header = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
  'https://api-nextcrm.nextcrm.vn/api/email/statistic' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url =  'https://api-nextcrm.nextcrm.vn/api/email/statistic'  
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint allows to retrieve list of Campaign Email.

HTTPS Request

GET https://api-nextcrm.nextcrm.vn/api/email/statistic

Parameters

Parameter Type Description
page integer Page number
pageLimit integer Number of items per page
strSreach string Search filter
from_date string Filter from date
to_date string Filter to date

Response

If the request is successful, the server will return a JSON response with updated information

The command returns JSON structured as follows:

 {
            "id": 115,
            "name": "Email campaign",
            "description": "",
            "from_name": "DemoX",
            "mail_from": "noreply.nextcrm@gmail.com",
            "mail_subject": "Test chi\u1ebfn d\u1ecbch Email",
            "mail_content": "<p>Marketing t\u1ef1 \u0111\u1ed9ng<\/p>",
            "send_object_type": null,
            "file_attach": null,
            "send_all_contact": 0,
            "is_mail_system": 1,
            "send_now": 1,
            "is_track_mail": 0,
            "send_time": null,
            "template_id": null,
            "created_by": 21,
            "user": {
                "name": "admin",
                "email": "lelinhbk@gmail.com",
                "firstname": "H\u1ea3o",
                "lastname": "nguy\u00ean",
                "picture": null
            },
            "customers": [],
            "customer_groups": [
                {
                    "id": 26,
                    "name": "Kh\u00e1ch h\u00e0ng c\u01a1 b\u1ea3n",
                    "amount": 0,
                    "description": "\u0110\u00e3 m\u1edf t\u00e0i kho\u1ea3n t\u1ea1i MB",
                    "is_sample_data": 0,
                    "pivot": {
                        "email_id": 115,
                        "customer_group_id": 26
                    }
                }
            ],
            "email_others": [],
            "params": {
                "param_01": "",
                "param_02": "",
                "param_03": "",
                "param_04": "",
                "param_05": "",
                "param_06": "",
                "param_07": "",
                "param_08": "",
                "param_09": "",
                "param_10": ""
            },
            "campaign": [
                {
                    "id": 708,
                    "name": "Tuyen test",
                    "start_date": "2024-05-10",
                    "end_date": "2024-05-10",
                    "budget": "0.00",
                    "actual_cost": null,
                    "objective": "",
                    "description": "",
                    "status": "108",
                    "type": null,
                    "impression": null,
                    "expected_cost": null,
                    "expected_revenue": null,
                    "assigned_to": 21,
                    "tenant_id": 1,
                    "user_id": 21,
                    "code": "CP000143",
                    "allow_duplicate_opportunity": 0,
                    "divide_opportunity_auto": null,
                    "hide_opportunity_info": 0,
                    "success_campaign_id": null,
                    "failed_campaign_id": null,
                    "time_wait_register": null,
                    "campaign_type": 107,
                    "branch_id": 1,
                    "pivot": {
                        "email_id": 115,
                        "campaign_id": 708
                    }
                }
            ],
            "total_emails": null,
            "total_send": null,
            "total_not_send": 0,
            "total_read": null,
            "total_not_read": null,
            "total_success": null,
            "total_fail": null,
            "status": "\u0110\u00e3 g\u1eedi",
            "time_run": "2024-09-23T08:39:49.000000Z"
        }

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The command returns JSON structured as follows:

{
  "status_code": 401,
  "message": "Token expired"
}

Task

View List of tasks

To get the list of task, use this code:

import requires
url = "https://api-nextcrm.nextcrm.vn/api/task/task"
header = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
  'https://api-nextcrm.nextcrm.vn/api/task/task' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url =  'https://api-nextcrm.nextcrm.vn/api/task/task'  
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint allows to retrieve list of Tasks.

HTTPS Request

GET https://api-nextcrm.nextcrm.vn/api/task/task

Parameters

Parameter Type Description
page integer Page number
pageLimit integer Number of items per page
strSreach string Search filter
start string Filter from date
end string Filter to date
search[status] string Search by status

Response

If the request is successful, the server will return a JSON response with updated information

The command returns JSON structured as follows:

  {
            "id": 2633,
            "task": "\u0111i kh\u00e1ch",
            "code": "CV4371068",
            "parent_id": 0,
            "parent": null,
            "created_at": "13\/09\/2024",
            "start": "2024-09-13 09:26:44",
            "end": "2024-09-13 10:00:00",
            "progress": 0,
            "priority": "\u01afu ti\u00ean",
            "stage_status": null,
            "color": "rgba(47, 117, 181, 1)",
            "attachments": null,
            "description": "",
            "location": null,
            "assigned_to": 6120,
            "project_id": null,
            "category_id": 404,
            "user": {
                "id": 21,
                "name": "admin",
                "email": "lelinhbk@gmail.com",
                "firstname": "H\u1ea3o",
                "lastname": "nguy\u00ean",
                "picture": null,
                "designation": "T\u00e0i kho\u1ea3n qu\u1ea3n l\u00fd"
            },
            "assigned": {
                "id": 6120,
                "name": "halinh",
                "email": "",
                "firstname": "tran ha",
                "lastname": "linh",
                "picture": null,
                "designation": "",
                "employee_id": 34215
            },
            "category": {
                "id": 404,
                "name": "G\u1ecdi \u0111i\u1ec7n",
                "description": "G\u1ecdi \u0111i\u1ec7n"
            },
            "project": null,
            "correlative": [],
            "project_stage_status": null,
            "project_stage_status_name": null,
            "status_text": "<div class='slow'>Ch\u1eadm 10 ng\u00e0y <\/div>",
            "sub_tasks": [],
            "tags": [],
            "model_name": "App\\Models\\Task\\Task",
            "view_type": null,
            "favourite": null,
            "result_id": null,
            "result": null,
            "result_note": null,
            "index": 0,
            "is_important": null,
            "is_urgent": null
        }

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The command returns JSON structured as follows:

{
  "status_code": 401,
  "message": "Token expired"
}

View detail information of Task

To view detail information of a task, use this code:

import requires
url = "https://api-nextcrm.nextcrm.vn/api/task/task/{id}"
header = {
  'Accept': 'application/json',
  'Authorization': 'Bearer your_access_token'
}

response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
  'https://api-nextcrm.nextcrm.vn/api/task/task/{id}' \  # replace with the id of Email campaign
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');

const url =  'https://api-nextcrm.nextcrm.vn/api/task/task/{id}'  # replace with the id of Email campaign
const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint allows toto retrieve detail information of 1 Email campaign.

HTTPS Request

GET https://api-nextcrm.nextcrm.vn/api/task/task/{id}

Parameters

Parameter Type Description
id integer ID of the task

Response

If the request is successful, the server will return a JSON response with updated information

The command returns JSON structured as follows:

{
            "id": 2633,
            "task": "\u0111i kh\u00e1ch",
            "code": "CV4371068",
            "parent_id": 0,
            "parent": null,
            "created_at": "13\/09\/2024",
            "start": "2024-09-13 09:26:44",
            "end": "2024-09-13 10:00:00",
            "progress": 0,
            "priority": "\u01afu ti\u00ean",
            "stage_status": null,
            "color": "rgba(47, 117, 181, 1)",
            "attachments": null,
            "description": "",
            "location": null,
            "assigned_to": 6120,
            "project_id": null,
            "category_id": 404,
            "user": {
                "id": 21,
                "name": "admin",
                "email": "lelinhbk@gmail.com",
                "firstname": "H\u1ea3o",
                "lastname": "nguy\u00ean",
                "picture": null,
                "designation": "T\u00e0i kho\u1ea3n qu\u1ea3n l\u00fd"
            },
            "assigned": {
                "id": 6120,
                "name": "halinh",
                "email": "",
                "firstname": "tran ha",
                "lastname": "linh",
                "picture": null,
                "designation": "",
                "employee_id": 34215
            },
            "category": {
                "id": 404,
                "name": "G\u1ecdi \u0111i\u1ec7n",
                "description": "G\u1ecdi \u0111i\u1ec7n"
            },
            "project": null,
            "correlative": [],
            "project_stage_status": null,
            "project_stage_status_name": null,
            "status_text": "<div class='slow'>Ch\u1eadm 10 ng\u00e0y <\/div>",
            "sub_tasks": [],
            "tags": [],
            "model_name": "App\\Models\\Task\\Task",
            "view_type": null,
            "favourite": null,
            "result_id": null,
            "result": null,
            "result_note": null,
            "index": 0,
            "is_important": null,
            "is_urgent": null
        }

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The command returns JSON structured as follows:

{
  "status_code": 401,
  "message": "Token expired"
}

Add New Task

To add a new task, ta use this code:

curl -X 'POST' \
  'https://api-nextcrm.nextcrm.vn/api/task/task' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token' \
  -H 'Content-Type: application/json' \
  -d '{
  "assigned": {
    "id": 6120,
    "name": "halinh",
    "email": "",
    "firstname": "tran ha",
    "lastname": "linh",
    "picture": null
  },
  "designation": "",
  "email": "",
  "employee_id": 34215,
  "firstname": "tran ha",
  "id": 6120,
  "lastname": "linh",
  "name": "halinh",
  "picture": null,
  "assigned_to": 6120,
  "attachments": null,
  "category": {
    "id": 1062,
    "name": "CSKH",
    "description": "Danh mục hệ thống, không được xóa"
  },
  "category_id": 1062,
  "checkins": [],
  "checklists": [],
  "code": "CV4371070",
  "color": "rgba(47, 117, 181, 1)",
  "correlative": [],
  "date_complete": null,
  "description": "",
  "end": "2024-10-15 08:27:03",
  "id": 2639,
  "index": 0,
  "is_complete": 0,
  "is_important": null,
  "is_urgent": null,
  "location": null,
  "model_name": "App\\Models\\Task\\Task",
  "parent": null,
  "parent_id": 0,
  "
}
'
import requests
import json

url = "https://api-nextcrm.nextcrm.vn/api/task/task"
payload = {
  "assigned": {
    "id": 6120,
    "name": "halinh",
    "email": "",
    "firstname": "tran ha",
    "lastname": "linh",
    "picture": null
  },
  "designation": "",
  "email": "",
  "employee_id": 34215,
  "firstname": "tran ha",
  "id": 6120,
  "lastname": "linh",
  "name": "halinh",
  "picture": null,
  "assigned_to": 6120,
  "attachments": null,
  "category": {
    "id": 1062,
    "name": "CSKH",
    "description": "Danh mục hệ thống, không được xóa"
  },
  "category_id": 1062,
  "checkins": [],
  "checklists": [],
  "code": "CV4371070",
  "color": "rgba(47, 117, 181, 1)",
  "correlative": [],
  "date_complete": null,
  "description": "",
  "end": "2024-10-15 08:27:03",
  "id": 2639,
  "index": 0,
  "is_complete": 0,
  "is_important": null,
  "is_urgent": null,
  "location": null,
  "model_name": "App\\Models\\Task\\Task",
  "parent": null,
  "parent_id": 0,
  "
  }

headers = {
  'accept': 'application/json',
  'Authorization': 'Bearer your_access_token',
  'Content-Type': 'application/json'
}

response = requests.post(url, headers=headers, data=json.dumps(payload))
print(response.json())
const fetch = require('node-fetch');

const url = 'https://api-nextcrm.nextcrm.vn/api/task/task';
const data = {
  "assigned": {
    "id": 6120,
    "name": "halinh",
    "email": "",
    "firstname": "tran ha",
    "lastname": "linh",
    "picture": null
  },
  "designation": "",
  "email": "",
  "employee_id": 34215,
  "firstname": "tran ha",
  "id": 6120,
  "lastname": "linh",
  "name": "halinh",
  "picture": null,
  "assigned_to": 6120,
  "attachments": null,
  "category": {
    "id": 1062,
    "name": "CSKH",
    "description": "Danh mục hệ thống, không được xóa"
  },
  "category_id": 1062,
  "checkins": [],
  "checklists": [],
  "code": "CV4371070",
  "color": "rgba(47, 117, 181, 1)",
  "correlative": [],
  "date_complete": null,
  "description": "",
  "end": "2024-10-15 08:27:03",
  "id": 2639,
  "index": 0,
  "is_complete": 0,
  "is_important": null,
  "is_urgent": null,
  "location": null,
  "model_name": "App\\Models\\Task\\Task",
  "parent": null,
  "parent_id": 0,
  "
}
;

const options = {
  method: 'POST',
  headers: {
    'accept': 'application/json',
    'Authorization': 'Bearer your_access_token',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(data)
};

fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint allows to add a new Campaign Email.

The command returns JSON structured as follows:

{
 meta: {status_code: 0, 
        message: "Successfully"}, data: null
        }

This endpoint allows to create a new Email campaign.

HTTP Request

POST https://api-nextcrm.nextcrm.vn/api/task/task

Parameters

// | Tên biến | Kiểu biến | Mô tả | // |----------------------|-----------------|------------------------------------------------------------------| // | assigned | Object | Thông tin người được giao nhiệm vụ (id, tên, email, họ tên) | // | designation | String | Chức vụ | // | email | String | Email của người được giao nhiệm vụ | // | employee_id | Integer | ID nhân viên | // | firstname | String | Tên (phần đầu của tên đầy đủ) của người được giao nhiệm vụ | // | id | Integer | ID của nhiệm vụ | // | lastname | String | Họ của người được giao nhiệm vụ | // | name | String | Tên đầy đủ của người được giao nhiệm vụ | // | picture | String/Null | Ảnh đại diện của người được giao nhiệm vụ | // | assigned_to | Integer | ID người được giao nhiệm vụ | // | attachments | Null | Tệp đính kèm của nhiệm vụ | // | category | Object | Thông tin danh mục (id, tên, mô tả) | // | category_id | Integer | ID của danh mục nhiệm vụ | // | checkins | Array | Danh sách các lần check-in của nhiệm vụ | // | checklists | Array | Danh sách các mục kiểm tra của nhiệm vụ | // | code | String | Mã nhiệm vụ | // | color | String | Mã màu của nhiệm vụ (RGBA) | // | correlative | Array | Danh sách liên hệ tương quan | // | date_complete | Null | Ngày hoàn thành nhiệm vụ | // | description | String | Mô tả nhiệm vụ | // | end | String (Date) | Ngày giờ kết thúc nhiệm vụ | // | index | Integer | Chỉ số thứ tự của nhiệm vụ | // | is_complete | Integer | Trạng thái hoàn thành nhiệm vụ (0: chưa hoàn thành, 1: hoàn thành)| // | is_important | Null | Đánh dấu nhiệm vụ quan trọng | // | is_urgent | Null | Đánh dấu nhiệm vụ khẩn cấp | // | location | Null | Vị trí thực hiện nhiệm vụ | // | model_name | String | Tên mô hình nhiệm vụ trong hệ thống | // | parent | Null | Nhiệm vụ cha (nếu có) | // | parent_id | Integer | ID của nhiệm vụ cha | // | priority | String | Mức độ ưu tiên của nhiệm vụ (Ví dụ: "Ưu tiên") | // | progress | Integer | Tiến độ hoàn thành nhiệm vụ | // | project | Object | Thông tin dự án (id, tên, mã dự án, ngày bắt đầu, kết thúc) | // | project_id | Integer | ID của dự án | // | project_stage_status | Null | Trạng thái giai đoạn dự án | // | result | Null | Kết quả nhiệm vụ | // | result_id | Null | ID của kết quả nhiệm vụ | // | result_note | Null | Ghi chú về kết quả nhiệm vụ | // | stage_status | Null | Trạng thái giai đoạn nhiệm vụ | // | start | String (Date) | Ngày giờ bắt đầu nhiệm vụ | // | sub_tasks | Array | Danh sách các nhiệm vụ con | // | tags | Array | Danh sách thẻ gắn vào nhiệm vụ | // | task | String | Tên nhiệm vụ | // | user | Object | Thông tin người tạo nhiệm vụ (id, tên, email, họ tên) | // | view_type | Null | Loại hiển thị của nhiệm vụ |

Response

If the request is successful, the server will return a JSON response with updated information

If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The command returns JSON structured as follows:

{
  "status_code": 401,
  "message": "Token expired"
}

Update Information Task

To update information of a task, use this code:

import requests
import json

url = "https://api-nextcrm.nextcrm.vn/api/task/task/{id}" 
headers = {
        "id": 2639,
        "task": "Task 15.10",
        "code": "CV4371070",
        "parent_id": 0,
        "parent": null,
        "start": "2024-10-15 08:27:03",
        "end": "2024-10-15 08:27:03",
        "progress": "0",
        "priority": "Cao",
        "stage_status": null,
        "color": "rgba(47, 117, 181, 1)",
        "attachments": null,
        "description": "",
        "location": null,
        "assigned_to": 6120,
        "project_id": 42,
        "category_id": "1062",
        "user": {
            "id": 21,
            "name": "admin",
            "email": "lelinhbk@gmail.com",
            "firstname": "H\u1ea3o",
            "lastname": "nguy\u00ean",
            "picture": null,
            "designation": "T\u00e0i kho\u1ea3n qu\u1ea3n l\u00fd"
        },
        "assigned": {
            "id": 6120,
            "name": "halinh",
            "email": "",
            "firstname": "tran ha",
            "lastname": "linh",
            "picture": null,
            "designation": "",
            "employee_id": 34215
        },
        "correlative": [],
        "category": {
            "id": 1062,
            "name": "CSKH",
            "description": "Danh m\u1ee5c h\u1ec7 th\u1ed1ng, kh\u00f4ng \u0111\u01b0\u1ee3c x\u00f3a"
        },
        "project": {
            "id": 42,
            "name": "Ca s\u00e1ng",
            "code": null,
            "start": "2020-11-06",
            "end": "2021-08-28",
            "description": null
        },
        "is_complete": 0,
        "date_complete": null,
        "project_stage_status": null,
        "sub_tasks": [],
        "model_name": "App\\Models\\Task\\Task",
        "view_type": null,
        "tags": [],
        "checkins": [],
        "result_id": null,
        "result": null,
        "result_note": null,
        "checklists": [],
        "index": 0,
        "is_important": null,
        "is_urgent": null
    },


response = requests.post(url, json=payload, headers=headers)
print(response.json())
curl -X 'POST' \
  'https://api-nextcrm.nextcrm.vn/api/task/task/{id}' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer your_access_token' \
  -H 'Content-Type: application/json' \
  -d '{
        "id": 2639,
        "task": "Task 15.10",
        "code": "CV4371070",
        "parent_id": 0,
        "parent": null,
        "start": "2024-10-15 08:27:03",
        "end": "2024-10-15 08:27:03",
        "progress": "0",
        "priority": "Cao",
        "stage_status": null,
        "color": "rgba(47, 117, 181, 1)",
        "attachments": null,
        "description": "",
        "location": null,
        "assigned_to": 6120,
        "project_id": 42,
        "category_id": "1062",
        "user": {
            "id": 21,
            "name": "admin",
            "email": "lelinhbk@gmail.com",
            "firstname": "H\u1ea3o",
            "lastname": "nguy\u00ean",
            "picture": null,
            "designation": "T\u00e0i kho\u1ea3n qu\u1ea3n l\u00fd"
        },
        "assigned": {
            "id": 6120,
            "name": "halinh",
            "email": "",
            "firstname": "tran ha",
            "lastname": "linh",
            "picture": null,
            "designation": "",
            "employee_id": 34215
        },
        "correlative": [],
        "category": {
            "id": 1062,
            "name": "CSKH",
            "description": "Danh m\u1ee5c h\u1ec7 th\u1ed1ng, kh\u00f4ng \u0111\u01b0\u1ee3c x\u00f3a"
        },
        "project": {
            "id": 42,
            "name": "Ca s\u00e1ng",
            "code": null,
            "start": "2020-11-06",
            "end": "2021-08-28",
            "description": null
        },
        "is_complete": 0,
        "date_complete": null,
        "project_stage_status": null,
        "sub_tasks": [],
        "model_name": "App\\Models\\Task\\Task",
        "view_type": null,
        "tags": [],
        "checkins": [],
        "result_id": null,
        "result": null,
        "result_note": null,
        "checklists": [],
        "index": 0,
        "is_important": null,
        "is_urgent": null
    },


'
const fetch = require('node-fetch');

const url = 'https://api-nextcrm.nextcrm.vn/api/task/task/{id}';  
const options = {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': 'Bearer your_access_token'
  },
  body: JSON.stringify({
        "id": 2639,
        "task": "Task 15.10",
        "code": "CV4371070",
        "parent_id": 0,
        "parent": null,
        "start": "2024-10-15 08:27:03",
        "end": "2024-10-15 08:27:03",
        "progress": "0",
        "priority": "Cao",
        "stage_status": null,
        "color": "rgba(47, 117, 181, 1)",
        "attachments": null,
        "description": "",
        "location": null,
        "assigned_to": 6120,
        "project_id": 42,
        "category_id": "1062",
        "user": {
            "id": 21,
            "name": "admin",
            "email": "lelinhbk@gmail.com",
            "firstname": "H\u1ea3o",
            "lastname": "nguy\u00ean",
            "picture": null,
            "designation": "T\u00e0i kho\u1ea3n qu\u1ea3n l\u00fd"
        },
        "assigned": {
            "id": 6120,
            "name": "halinh",
            "email": "",
            "firstname": "tran ha",
            "lastname": "linh",
            "picture": null,
            "designation": "",
            "employee_id": 34215
        },
        "correlative": [],
        "category": {
            "id": 1062,
            "name": "CSKH",
            "description": "Danh m\u1ee5c h\u1ec7 th\u1ed1ng, kh\u00f4ng \u0111\u01b0\u1ee3c x\u00f3a"
        },
        "project": {
            "id": 42,
            "name": "Ca s\u00e1ng",
            "code": null,
            "start": "2020-11-06",
            "end": "2021-08-28",
            "description": null
        },
        "is_complete": 0,
        "date_complete": null,
        "project_stage_status": null,
        "sub_tasks": [],
        "model_name": "App\\Models\\Task\\Task",
        "view_type": null,
        "tags": [],
        "checkins": [],
        "result_id": null,
        "result": null,
        "result_note": null,
        "checklists": [],
        "index": 0,
        "is_important": null,
        "is_urgent": null
    },


fetch(url, options)
  .then(response => response.json())
  .then(data => console.log(data));

This endpoint allows to retrieve update the information of Email campaign.

HTTP Request

PUT https://api-nextcrm.nextcrm.vn/api/task/task/{id}

Path Tham số

Parameter Type Description
id string ID of the task (required)

Response

Example Request

 {     {
        "id": 2639,
        "task": "Task 15.10",
        "code": "CV4371070",
        "parent_id": 0,
        "parent": null,
        "start": "2024-10-15 08:27:03",
        "end": "2024-10-15 08:27:03",
        "progress": "0",
        "priority": "Cao",
        "stage_status": null,
        "color": "rgba(47, 117, 181, 1)",
        "attachments": null,
        "description": "",
        "location": null,
        "assigned_to": 6120,
        "project_id": 42,
        "category_id": "1062",
        "user": {
            "id": 21,
            "name": "admin",
            "email": "lelinhbk@gmail.com",
            "firstname": "H\u1ea3o",
            "lastname": "nguy\u00ean",
            "picture": null,
            "designation": "T\u00e0i kho\u1ea3n qu\u1ea3n l\u00fd"
        },
        "assigned": {
            "id": 6120,
            "name": "halinh",
            "email": "",
            "firstname": "tran ha",
            "lastname": "linh",
            "picture": null,
            "designation": "",
            "employee_id": 34215
        },
        "correlative": [],
        "category": {
            "id": 1062,
            "name": "CSKH",
            "description": "Danh m\u1ee5c h\u1ec7 th\u1ed1ng, kh\u00f4ng \u0111\u01b0\u1ee3c x\u00f3a"
        },
        "project": {
            "id": 42,
            "name": "Ca s\u00e1ng",
            "code": null,
            "start": "2020-11-06",
            "end": "2021-08-28",
            "description": null
        },
        "is_complete": 0,
        "date_complete": null,
        "project_stage_status": null,
        "sub_tasks": [],
        "model_name": "App\\Models\\Task\\Task",
        "view_type": null,
        "tags": [],
        "checkins": [],
        "result_id": null,
        "result": null,
        "result_note": null,
        "checklists": [],
        "index": 0,
        "is_important": null,
        "is_urgent": null
    },

If the request is successful, the server will return a JSON response If the token is expired or invalid, the server will return a 401 status code with a message indicating that the token has expired.

The command returns JSON structured as follows:

{
  "status_code": 401,
  "message": "Token expired"
}

Errors

The NextX API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Token is expired or invalid.