Introduction
Welcome to the NextX API documentation! This document provides detailed information on how to interact with the NextX - NextFarm API. Please feel free to contact us if you need assistance or wish to subscribe to our service.
NextFarm API
Below are the system functional APIs of NextX NextFarm that you can integrate into your system.
Log In (Authentication)
import requests
url = "https://api.nextfarm.vn/api/auth/login"
payload = {
"password": "your_password",
"tenantcode": "your_tenant_code",
"username": "your_user_name"
}
headers = {'Content-Type': 'application/json'}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
curl -X POST "https://api.nextfarm.vn/api/auth/login" \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"password": "your_password",
"tenantcode": "your_tenant_code",
"username": "your_user_name"
}'
const fetch = require('node-fetch');
const url = "https://api.nextfarm.vn/api/auth/login";
const body = {
"password": "your_password",
"tenantcode": "your_tenant_code",
"username": "your_user_name"
};
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));
Ensure you replace the login information with your actual customer credentials.
The NextX API uses an API key to allow access to the API.
NextX requires that the API key be included in all API requests sent to the server in the header as follows: Authorization: Bearer your_key_here
HTTP Request
POST https://api.nextfarm.vn/api/auth/login
Parameters
Parameter | Type | Description |
---|---|---|
password | string | Your password |
username | string | Your username |
tenantcode | string | Your tenant code ( xxx.nextfarm.vn) |
Request
Example Request
[
{
username: "name",
password: "pass",
tenantcode: "code"}
]
Response
The response will contain the access token and other related information.
If the request is successful, the server will return a JSON response indicating success.
If the authentication information is incorrect, the server will return a JSON response with an error message.
The above command returns a JSON structured as follows:
{
"meta": {
"status_code": 1,
"message": "Account or password is incorrect."
}
}
]
Homepage
Crops - Livestock
Get List of Crops - Livestock
To retrieve the list of crops and livestock, use the following code:
import requests
url = "https://api.nextfarm.vn/api/crop/crop"
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer your_access_token'
}
response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
'https://api.nextfarm.vn/api/crop/crop' \
-H 'accept: application/json' \
-H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');
const url = 'https://api.nextfarm.vn/api/crop/crop';
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));
The above command returns a JSON structured as follows:
[
{
"id": 431,
"name": "Gà thịt",
"description": "",
"location": null,
"crop_type": 152,
"image": null,
"sku": "",
"code": "P0033",
"price": 0,
"status": true,
"category_id": 344
}
]
The endpoint allows you to retrieve a list of crops and livestock.
HTTP Request
GET https://api.nextfarm.vn/api/crop/crop?page=1&pageLimit=15&search[name]=&search[code]=&search[sku]=&search[price]=
Query Parameters
Parameter | Type | Description |
---|---|---|
page | integer | Page number (Start from 0) |
pageLimit | integer | Maximun items in 1 page |
search[] | array[string] | tìm kiếm theo tên, code, sku, giá tiền |
Response
If the request is successful, the server will return a JSON response with a list of crops and livestock.
If the token has expired or is invalid, the server will return a status code 401 with a message indicating that the token has expired.
The JSON response is structured as follows:
[
{
"meta": {
"message": "Token expired",
"status_code": 401
},
"data": []
}
]
View Details of Crops and Livestock
To view detailed information of a specific crop or livestock, use the following code snippet:
import requests
url = "https://api.nextfarm.vn/api/crop/crop/{id}"
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer your_access_token'
}
response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
'https://api.nextfarm.vn/api/crop/crop/{id}' \
-H 'accept: application/json' \
-H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');
const url = 'https://api.nextfarm.vn/api/crop/crop/{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));
The above command returns a JSON structured as follows:
{
"id": 431,
"name": "Gà thịt",
"description": "",
"location": null,
"crop_type": 152,
"full_description": "<p><\/p>",
"images": "[]",
"sku": "",
"code": "P0033",
"price": 0,
"status": true,
"category_id": 344
}
The endpoint allows you to retrieve detailed information about a specific crop or livestock.
HTTP Request
GET https://api.nextfarm.vn/api/crop/crop/<ID>
Parameters
Parameter | Type | Description |
---|---|---|
ID | integer | The ID of the livestock or crop. |
Response
If the request is successful, the server will return a JSON response with a list of customer sources.
The JSON response is structured as follows:
[
{
id": 431,
"name": "G\u00e0 th\u1ecbt",
"description": "",
"location": null,
"crop_type": 152,
"full_description": "<p><\/p>",
"images": "[]",
"sku": "",
"code": "P0033",
"price": 0,
"status": true,
"category_id": 344
}
]
If the token has expired or is invalid, the server will return a status code 401 with a message indicating that the token has expired.
The above command returns a JSON structured as follows:
[
{
"meta": {
"message": "Token expired",
"status_code": 401
},
"data": []
}
]
Add New Crop or Livestock
To add a new crop or livestock, use the following code snippet:
import requests
import json
url = "https://api.nextfarm.vn/api/crop/crop"
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer your_access_token'
}
data = {
"id": 441,
"name": "C\u00e2y 17.8",
"description": "",
"location": null,
"crop_type": 17,
"full_description": "<p><\/p>",
"images": "[]",
"sku": "",
"code": "P0034",
"price": 40000,
"status": true,
"category_id": 3
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
curl -X 'POST' \
'https://api.nextfarm.vn/api/crop/crop' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer your_access_token' \
-d '{
"id": 441,
"name": "C\u00e2y 17.8",
"description": "",
"location": null,
"crop_type": 17,
"full_description": "<p><\/p>",
"images": "[]",
"sku": "",
"code": "P0034",
"price": 40000,
"status": true,
"category_id": 3
}'
const fetch = require('node-fetch');
const url = 'https://api.nextfarm.vn/api/crop/crop';
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer your_access_token'
},
body: JSON.stringify({
"id": 441,
"name": "C\u00e2y 17.8",
"description": "",
"location": null,
"crop_type": 17,
"full_description": "<p><\/p>",
"images": "[]",
"sku": "",
"code": "P0034",
"price": 40000,
"status": true,
"category_id": 3
})
};
fetch(url, options)
.then(response => response.json())
.then(data => console.log(data));
This endpoint creates a new type of crop or livestock.
HTTP Request
POST https://api.nextfarm.vn/api/crop/crop
Request
Request example:
{
category_id: 3
code: "P0034"
crop_type: 17
description: ""
full_description: "<p></p>"
images: "[]"
name: "Cây 17.8"
price: 40000
sku: ""
status: 1
}
Parameters
Variable | Data Type | Description |
---|---|---|
category_id_ | integer | ID of the crop group |
crop_type | integer | ID of the crop variety |
image | string | URL or path to the image |
full_description | string | Detailed description of the crop |
code | string | Crop/livestock code |
name | string | Name of the crop/livestock |
price | integer | Price of the crop/livestock |
sku | string | SKU code |
description | string | Notes for the crop/livestock |
status | bool | Active (1) or not (0) |
Response
If the request is successful, the server will return a JSON response confirming the update.
The above command returns a JSON structured as follows:
[
{
"id": 441,
"name": "C\u00e2y 17.8",
"description": "",
"location": null,
"crop_type": 17,
"full_description": "<p><\/p>",
"images": "[]",
"sku": "",
"code": "P0034",
"price": 40000,
"status": true,
"category_id": 3
}
]
If the token has expired or is invalid, the server will return a status code 401 with a message indicating that the token has expired.
The above command returns a JSON structured as follows:
[
{
"meta": {
"message": "Token expried",
"status_code": 401
},
"data": []
}
]
Update Crop or Livestock Information
To edit the information of a crop or livestock, use the following code snippet:
curl -X 'PUT' \
'https://api.nextfarm.vn/api/crop/crop/{id}' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer your_access_token' \
-d '{
"id": 441,
"name": "C\u00e2y 17.8",
"description": "",
"location": null,
"crop_type": 17,
"full_description": "<p><\/p>",
"images": "[]",
"sku": "1234",
"code": "P0034",
"price": 40000,
"status": false,
"category_id": 3
}'
import requests
url = "https://api.nextfarm.vn/api/crop/crop/{id}"
payload = {
"id": 441,
"name": "C\u00e2y 17.8",
"description": "",
"location": null,
"crop_type": 17,
"full_description": "<p><\/p>",
"images": "[]",
"sku": "1234",
"code": "P0034",
"price": 40000,
"status": false,
"category_id": 3
}
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.nextfarm.vn/api/crop/crop/{id}';
const payload = {
"id": 441,
"name": "C\u00e2y 17.8",
"description": "",
"location": null,
"crop_type": 17,
"full_description": "<p><\/p>",
"images": "[]",
"sku": "1234",
"code": "P0034",
"price": 40000,
"status": false,
"category_id": 3
};
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));
The above command returns a JSON structured as follows:
[
{
"status_code": 0,
"message": "Thành công"
}
]
This endpoint allows you to update the detailed information of a crop or livestock.
HTTP Request
PUT https://api.nextfarm.vn/api/crop/crop/{id}
Parameters
Path Parameters
Parameters | Type | Description |
---|---|---|
id | integer | ID of crop or livestock |
Body Parameters
Parameters | Type | Description |
---|---|---|
category_id_ | integer | ID of the crop group |
crop_type | integer | ID of the crop variety |
image | string | URL or path to the image |
full_description | string | Detailed description of the crop |
code | string | Crop/livestock code |
name | string | Name of the crop/livestock |
price | integer | Price of the crop/livestock |
sku | string | SKU code |
description | string | Notes for the crop/livestock |
status | bool | Active (1) or not (0) |
Response
If the request is successful, the server will return a JSON response confirming the update.
The above command returns a JSON structured as follows:
[
{
"id": 441,
"name": "C\u00e2y 17.8",
"description": "",
"location": null,
"crop_type": 17,
"full_description": "<p><\/p>",
"images": "[]",
"sku": "1234",
"code": "P0034",
"price": 40000,
"status": false,
"category_id": 3
}
]
If the token has expired or is invalid, the server will return a status code 401 with a message indicating that the token has expired.
The above command returns a JSON structured as follows:
json [ { "meta": { "message": "Token expried", "status_code": 401 }, "data": [] } ]
Add New Type of crop or livestock
To Add New Type of crop or livestock, use this code:
import requests
import json
url = "https://api.nextfarm.vn/api/croptype/croptype"
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer your_access_token'
}
data = {
"id": 183,
"name": "Cây cho sản phẩm công nghiệp",
"description": "",
"parent_id": 0,
"images": null
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
curl -X 'POST' \
'https://api.nextfarm.vn/api/croptype/croptype' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer your_access_token' \
-d '{
"id": 183,
"name": "Cây cho sản phẩm công nghiệp",
"description": "",
"parent_id": 0,
"images": null
}'
const fetch = require('node-fetch');
const url = 'https://api.nextfarm.vn/api/croptype/croptype';
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer your_access_token'
},
body: JSON.stringify({
"id": 183,
"name": "Cây cho sản phẩm công nghiệp",
"description": "",
"parent_id": 0,
"images": null
})
};
fetch(url, options)
.then(response => response.json())
.then(data => console.log(data));
This endpoint allows you to add a new crop or livestock variety.
HTTPS request
POST https://api.nextfarm.vn/api/croptype/croptype
Parameters
Parameters | Type | Description |
---|---|---|
id | integer | ID of the crop or livestock variety (system-generated) |
description | string | Description of the variety |
name | string | Name of the crop or livestock variety |
images | string | URL of the image |
parent-id | string | Parent variety group |
Response
If the request is successful, the server will return a JSON response confirming the update.
The above command returns a JSON structured as follows:
[
{
"id": 183,
"name": "C\u00e2y cho s\u1ea3n ph\u1ea9m c\u00f4ng nghi\u1ec7p",
"description": "",
"parent_id": 0,
"images": null
}
]
If the token has expired or is invalid, the server will return a status code 401 with a message indicating that the token has expired.
The above command returns a JSON structured as follows:
json [ { "meta": { "message": "Token expried", "status_code": 401 }, "data": [] } ]
Update Crop or Livestock Type Information
To edit the information of a crop or livestock variety, use the following code snippet:
curl -X 'PUT' \
'https://api.nextfarm.vn/api/croptype/croptype/{id}' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer your_access_token' \
-d '{
description: ""
images: null
name: "Cây công nghiệp"
parent_id: 0
}'
import requests
url = "https://api.nextfarm.vn/api/croptype/croptype/{id}"
payload = {
description: ""
images: null
name: "Cây công nghiệp"
parent_id: 0
}
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.nextfarm.vn/api/croptype/croptype/{id}';
const payload = {
description: ""
images: null
name: "Cây công nghiệp"
parent_id: 0
};
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));
The above command returns a JSON structured as follows:
[
{
"status_code": 0,
"message": "Thành công"
}
]
This endpoint allows you to update the detailed information of a crop or livestock variety.
HTTP Request
PUT https://api.nextfarm.vn/api/croptype/croptype/{id}
Parameters
Path Parameters
Parameters | Type | Description |
---|---|---|
id | integer | ID of crop or livestock |
Body Parameters
Parameters | Type | Description |
---|---|---|
description | string | Description of the variety |
name | string | Name of the crop or livestock variety |
images | string | URL of the image |
parent-id | string | Parent variety group |
Response
If the request is successful, the server will return a JSON response confirming the update.
The above command returns a JSON structured as follows:
[
{
"id": 183,
"name": "C\u00e2y c\u00f4ng nghi\u1ec7p",
"description": "",
"parent_id": 0,
"images": null
}
]
If the token has expired or is invalid, the server will return a status code 401 with a message indicating that the token has expired.
The above command returns a JSON structured as follows:
json [ { "meta": { "message": "Token expried", "status_code": 401 }, "data": [] } ]
Add new category of crop or livestock
To Add New new category of crop or livestock, use this code:
import requests
import json
url = "https://api.nextfarm.vn/api/productcategory/productcategory"
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer your_access_token'
}
data = {
code: "PCT-03"
description: ""
name: "Cây công nghiệp"
status: 1
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
curl -X 'POST' \
'https://api.nextfarm.vn/api/productcategory/productcategory' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer your_access_token' \
-d '{
code: "PCT-03"
description: ""
name: "Cây công nghiệp"
status: 1
}'
const fetch = require('node-fetch');
const url = 'https://api.nextfarm.vn/api/productcategory/productcategory';
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer your_access_token'
},
body: JSON.stringify({
code: "PCT-03"
description: ""
name: "Cây công nghiệp"
status: 1
})
};
fetch(url, options)
.then(response => response.json())
.then(data => console.log(data));
This endpoint allows you to add a new crop or livestock category.
HTTPS request
POST https://api.nextfarm.vn/api/productcategory/productcategory
Parameters
Parameters | Type | Description |
---|---|---|
id | integer | ID of the crop or livestock group (system-generated) |
description | string | Description of the group |
name | string | Name of the crop or livestock group |
code | string | Code for the group |
parent-id | string | Parent group |
status | bool | Active status (1) or not (0) |
Response
If the request is successful, the server will return a JSON response confirming the update.
The above command returns a JSON structured as follows:
[
{
"id": 366,
"name": "Cây công nghiệp",
"code": "PCT-03",
"status": 1,
"description": "",
"parent_id": null
}
]
If the token has expired or is invalid, the server will return a status code 401 with a message indicating that the token has expired.
The above command returns a JSON structured as follows:
json [ { "meta": { "message": "Token expried", "status_code": 401 }, "data": [] } ]
Update Crop or Livestock Group/ Category.
To edit the information of a crop or livestock group, use the following code snippet:
curl -X 'PUT' \
'https://api.nextfarm.vn/api/productcategory/productcategory/{id}' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer your_access_token' \
-d '{
code: "PCT-03"
description: "123"
name: "Cây công nghiệp"
status: 1
}'
import requests
url = "https://api.nextfarm.vn/api/productcategory/productcategory/{id}"
payload = {
code: "PCT-03"
description: "123"
name: "Cây công nghiệp"
status: 1
}
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.nextfarm.vn/api/productcategory/productcategory/id}';
const payload = {
code: "PCT-03"
description: "123"
name: "Cây công nghiệp"
status: 1
};
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));
The above command returns a JSON structured as follows:
[
{
"status_code": 0,
"message": "Thành công"
}
]
This endpoint allows you to update the detailed information of a crop or livestock group.
HTTP Request
PUT
https://api.nextfarm.vn/api/productcategory/productcategory/{id}
Parameters
Path Parameters
Parameters | Type | Description |
---|---|---|
id | integer | ID of crop or livestock group/ catrgory. |
Body Parameters
Parameters | Type | Description |
---|---|---|
id | integer | ID of the crop or livestock group (system-generated) |
description | string | Description of the group |
name | string | Name of the crop or livestock group |
code | string | Code for the group |
parent-id | string | Parent group |
status | bool | Active status (1) or not (0) |
Response
If the request is successful, the server will return a JSON response confirming the update.
The above command returns a JSON structured as follows:
[
{
"id": 366,
"name": "Cây công nghiệp",
"code": "PCT-03",
"status": 1,
"description": "123",
"parent_id": 0
}
]
If the token has expired or is invalid, the server will return a status code 401 with a message indicating that the token has expired.
The above command returns a JSON structured as follows:
json [ { "meta": { "message": "Token expried", "status_code": 401 }, "data": [] } ]
Production Log (Diary)
Get Job List
To view the list of jobs in the production log, use the following code snippet:
import requests
url = "https://api.nextfarm.vn/api/diary/production"
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer your_access_token'
}
response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
'https://api.nextfarm.vn/api/diary/production' \
-H 'accept: application/json' \
-H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');
const url = 'https://api.nextfarm.vn/api/diary/production';
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));
The above command returns a JSON structured as follows:
[
{
"id": 141,
"name": "xu\u1ed1ng gi\u1ed1ng",
"start": "2024-08-16 11:36:11",
"end": null,
"description": "",
"images": [],
"location": "",
"category_task_id": 575,
"category": {
"id": 575,
"name": "c\u1ea5y gi\u1ed1ng"
},
"assigned_to": 578,
"assigned": {
"id": 578,
"name": "duy",
"firstname": "Nguy\u1ec5n Kh\u01b0\u01a1ng",
"lastname": "Duy",
"picture": "https:\/\/img.nextfarm.vn\/nextfarm\/hosco\/1661308081861\/1661308001.png"
},
"season_id": 834,
"season": {
"id": 834,
"name": "D\u01b0a l\u01b0\u1edbi qu\u00fd 1"
},
"user_id": 21,
"user": {
"id": 21,
"name": "admin",
"firstname": "Admin",
"lastname": "Hosco",
"picture": "https:\/\/img.nextfarm.vn\/nextfarm\/hosco\/1703564824243\/.jpeg"
},
"sub_cates": [
{
"id": 557,
"name": "c\u1ea5y gi\u1ed1ng c\u00e2y con",
"pivot": {
"production_daily_id": 141,
"sub_cate_id": 557
}
}
],
"amount": 0
}
]
This endpoint allows you to retrieve a list of tasks.
HTTP Request
GET https://api.nextfarm.vn/api/diary/production
Query Parameters
Parameters | Type | Description |
---|---|---|
page | integer | Page number (starting from 0) |
pageLimit | integer | Maximum number of items per page |
strSearch[] | array[string] | Search by name, code, SKU, price |
from_date | string | Start date (beginning of the range) |
to_date | string | End date (end of the range) |
Response
If the request is successful, the server will return a JSON response with Tasks list .
If the token has expired or is invalid, the server will return a status code 401 with a message indicating that the token has expired.
The above command returns a JSON structured as follows:
[
{
"meta": {
"message": "Token expired",
"status_code": 401
},
"data": []
}
]
View Task Details
To view the detailed information of a job in the production log, use the following code snippet:
import requests
url = "https://api.nextfarm.vn/api/diary/production/{id}"
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer your_access_token'
}
response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
'https://api.nextfarm.vn/api/diary/production/{id}' \
-H 'accept: application/json' \
-H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');
const url = 'https://api.nextfarm.vn/api/diary/production/{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 allows you to access detailed information of a job in the production log.
HTTP Request
GET https://api.nextfarm.vn/api/diary/production/{id}
Response
If the request is successful, the server will return a JSON response with Task detail .
The above command returns a JSON structured as follows:
[
{
"id": 141,
"name": "xu\u1ed1ng gi\u1ed1ng",
"start": "2024-08-16 11:36:11",
"end": null,
"description": "",
"images": [],
"location": "",
"category_task_id": 575,
"category": {
"id": 575,
"name": "c\u1ea5y gi\u1ed1ng"
},
"assigned_to": 578,
"assigned": {
"id": 578,
"name": "duy",
"firstname": "Nguy\u1ec5n Kh\u01b0\u01a1ng",
"lastname": "Duy",
"picture": "https:\/\/img.nextfarm.vn\/nextfarm\/hosco\/1661308081861\/1661308001.png"
},
"season_id": 834,
"season": {
"id": 834,
"name": "D\u01b0a l\u01b0\u1edbi qu\u00fd 1"
},
"user_id": 21,
"user": {
"id": 21,
"name": "admin",
"firstname": "Admin",
"lastname": "Hosco",
"picture": "https:\/\/img.nextfarm.vn\/nextfarm\/hosco\/1703564824243\/.jpeg"
},
"sub_cates": [
{
"id": 557,
"name": "c\u1ea5y gi\u1ed1ng c\u00e2y con",
"pivot": {
"production_daily_id": 141,
"sub_cate_id": 557
}
}
],
"amount": 0
}
]
If the token has expired or is invalid, the server will return a status code 401 with a message indicating that the token has expired.
The above command returns a JSON structured as follows:
[
{
"meta": {
"message": "Token expired",
"status_code": 401
},
"data": []
}
]
Add New Task
To add a new task, use this code:
import requests
import json
url = "https://api.nextfarm.vn/api/diary/production"
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer your_access_token'
}
data = {
"assigned_to": 856
"category_task_id": 577
"description": "<p></p>"
"end": "2024-08-21 00:00:00"
"images": []
"location": ""
"name": "bón phân"
"season_id": 846
""start": "2024-08-20 08:29:03"
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
curl -X 'POST' \
'https://api.nextfarm.vn/api/diary/production' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer your_access_token' \
-d '{
"assigned_to": 856
"category_task_id": 577
"description": "<p></p>"
"end": "2024-08-21 00:00:00"
"images": []
"location": ""
"name": "bón phân"
"season_id": 846
""start": "2024-08-20 08:29:03"
}'
const fetch = require('node-fetch');
const url = 'https://api.nextfarm.vn/api/diary/production';
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer your_access_token'
},
body: JSON.stringify({
"assigned_to": 856
"category_task_id": 577
"description": "<p></p>"
"end": "2024-08-21 00:00:00"
"images": []
"location": ""
"name": "bón phân"
"season_id": 846
""start": "2024-08-20 08:29:03"
})
};
fetch(url, options)
.then(response => response.json())
.then(data => console.log(data));
This endpoint allows you to add a new job.
HTTPS request
POST https://api.nextfarm.vn/api/diary/production
Parameters
Parameters | Type | Description |
---|---|---|
id | integer | ID of the job (system-generated) |
description | string | Description of the job |
name | string | Name of the job |
assigned_to[] | array | Information about the assigned staff |
start | string | Start date |
end | string | End date |
image | string | URL of the image |
location | string | Address |
season[] | array | Seasons (ID, season name) |
category_task_id | integer | ID of the task category |
sub_cates[] | array | Details of the sub-tasks |
user[] | array | Information about users |
Response
If the request is successful, the server will return a JSON response confirming the update.
The above command returns a JSON structured as follows:
[
{
"id": 143,
"name": "bón phân",
"start": "2024-08-20 08:29:03",
"end": "2024-08-21 00:00:00",
"description": "<p><\/p>",
"images": [],
"location": "",
"category_task_id": 577,
"category": {
"id": 577,
"name": "thu ho\u1ea1ch"
},
"assigned_to": 856,
"assigned": {
"id": 856,
"name": "tranvanB",
"firstname": "Tran",
"lastname": "Tran B",
"picture": null
},
"season_id": 846,
"season": {
"id": 846,
"name": "m\u00f9a \u0111\u00f4ng 16\/01"
},
"user_id": 21,
"user": {
"id": 21,
"name": "admin",
"firstname": "Admin",
"lastname": "Hosco",
"picture": "https:\/\/img.nextfarm.vn\/nextfarm\/hosco\/1703564824243\/.jpeg"
},
"sub_cates": [
{
"id": 559,
"name": "Thu ho\u1ea1ch",
"pivot": {
"production_daily_id": 143,
"sub_cate_id": 559
}
}
],
"amount": null
}
]
If the token has expired or is invalid, the server will return a status code 401 with a message indicating that the token has expired.
The above command returns a JSON structured as follows:
json [ { "meta": { "message": "Token expried", "status_code": 401 }, "data": [] } ]
Update Task Information
To update a task information, use this code:
curl -X 'PUT' \
'https://api.nextfarm.vn/api/diary/production/{id}' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer your_access_token' \
-d '{
"assigned_to": 856
"category_task_id": 577
"description": "<p></p>"
"end": "2024-08-23 00:00:00"
"images": []
"location": ""
"name": "bón phân"
"season_id": 846
""start": "2024-08-20 08:29:03"
}'
import requests
url = "https://api.nextfarm.vn/api/diary/production/{id}"
payload = {
"assigned_to": 856
"category_task_id": 577
"description": "<p></p>"
"end": "2024-08-23 00:00:00"
"images": []
"location": ""
"name": "bón phân"
"season_id": 846
""start": "2024-08-20 08:29:03"
}
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.nextfarm.vn/api/diary/production/{id}';
const payload = {
"assigned_to": 856
"category_task_id": 577
"description": "<p></p>"
"end": "2024-08-23 00:00:00"
"images": []
"location": ""
"name": "bón phân"
"season_id": 846
""start": "2024-08-20 08:29:03"
};
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));
The above command returns a JSON structured as follows:
[
{
"status_code": 0,
"message": "Thành công"
}
]
This endpoint allows you to update the detailed information of a job.
HTTP Request
PUT https://api.nextfarm.vn/api/diary/production/{id}
Parameters
Path Parameters
Parameters | Type | Description |
---|---|---|
id | integer | ID of the task |
Body Parameters
Parameters | Type | Description |
---|---|---|
id | integer | ID of the job (system-generated) |
description | string | Description of the job |
name | string | Name of the job |
assigned_to[] | array | Information about the assigned staff |
start | string | Start date |
end | string | End date |
image | string | URL of the image |
location | string | Address |
season[] | array | Seasons (ID, season name) |
category_task_id | integer | ID of the task category |
sub_cates[] | array | Details of the sub-tasks |
user[] | array | Information about users |
Response
If the request is successful, the server will return a JSON response confirming the update.
The above command returns a JSON structured as follows:
[
{
"id": 143,
"name": "bón phân",
"start": "2024-08-20 08:29:03",
"end": "2024-08-23 00:00:00",
"description": "<p><\/p>",
"images": [],
"location": "",
"category_task_id": 577,
"category": {
"id": 577,
"name": "thu ho\u1ea1ch"
},
"assigned_to": 856,
"assigned": {
"id": 856,
"name": "tranvanB",
"firstname": "Tran",
"lastname": "Tran B",
"picture": null
},
"season_id": 846,
"season": {
"id": 846,
"name": "m\u00f9a \u0111\u00f4ng 16\/01"
},
"user_id": 21,
"user": {
"id": 21,
"name": "admin",
"firstname": "Admin",
"lastname": "Hosco",
"picture": "https:\/\/img.nextfarm.vn\/nextfarm\/hosco\/1703564824243\/.jpeg"
},
"sub_cates": [
{
"id": 559,
"name": "Thu ho\u1ea1ch",
"pivot": {
"production_daily_id": 143,
"sub_cate_id": 559
}
}
],
"amount": null
}
]
If the token has expired or is invalid, the server will return a status code 401 with a message indicating that the token has expired.
The above command returns a JSON structured as follows:
json [ { "meta": { "message": "Token expried", "status_code": 401 }, "data": [] } ]
Crop Season
Get List of Seasons
To retrieve the list of seasons, use the following code snippet:
import requests
url = "https://api.nextfarm.vn/api/crop/season"
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer your_access_token'
}
response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
'https://api.nextfarm.vn/api/crop/season' \
-H 'accept: application/json' \
-H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');
const url = 'https://api.nextfarm.vn/api/crop/season';
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));
The above command returns a JSON structured as follows:
[
{
"id": 930,
"name": "BD))!",
"start_date": "2024-07-15",
"end_date": "2024-08-22",
"description": "",
"season_template_id": 1,
"crop_id": 1,
"status": "Pending",
"template_name": null,
"image": null,
"code": "MBT",
"crop_code": "M123",
"crop_name": "D\u01b0a l\u01b0\u1edbi",
"season_custom_field1": "",
"season_custom_field2": "",
"season_custom_field3": "",
"season_custom_field4": "",
"season_custom_field5": null,
"block_id": 230,
"block": {
"id": 230,
"name": "farm 7"
},
"farm_id": 332,
"farm": {
"id": 332,
"name": "V\u01b0\u1eddn ti\u00eau",
"surface": "1000 m2",
"lat": "21.043779",
"lng": "105.789502",
"address": "\u0110\u1eafc l\u1eafk",
"published": 1,
"ownership": "Nguy\u1ec5n V\u0103n A",
"description": "test update mo ta",
"order": 0,
"avatar": "[]",
"tenant_id": 1,
"created_by": null
},
"amount": 0,
"area": 0
}
]
This endpoint allows you to retrieve a list of seasons.
HTTP Request
GET https://api.nextfarm.vn/api/crop/season
Query Parameters
Parameters | Type | Description |
---|---|---|
page | integer | Page number (starting from 0) |
pageLimit | integer | Maximum number of items per page |
search[] | array[string] | Search by name, code, SKU, price |
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 a season list.
If the token has expired or is invalid, the server will return a status code 401 with a message indicating that the token has expired.
The above command returns a JSON structured as follows:
[
{
"meta": {
"message": "Token expired",
"status_code": 401
},
"data": []
}
]
View Season Details
To view detailed information about a season, use the following code snippet:
import requests
url = "https://api.nextfarm.vn/api/crop/season/{id}"
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer your_access_token'
}
response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
'https://api.nextfarm.vn/api/crop/season{id}' \
-H 'accept: application/json' \
-H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');
const url = 'https://api.nextfarm.vn/api/crop/season{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 allows you to retrieve detailed information about a season.
HTTPS Request
GET https://api.nextfarm.vn/api/crop/season{id}
Parameters
Path Parameters
Parameters | Type | Description |
---|---|---|
id | integer | ID of the season |
Body Parameters
Parameters | Type | Description |
---|---|---|
id |
Integer | Unique identifier for the record. |
name |
String | Name of the season. |
start_date |
Date | Start date of the season. |
end_date |
Date | End date of the season. |
description |
String | Description of the season (can be empty). |
season_template_id |
Integer | ID of the season template associated with this season. |
crop_id |
Integer | ID of the crop linked to this season. |
status |
String | Current status of the season (e.g., "Pending"). |
template_name |
String | Template name, if any (can be null). |
image |
String | URL to the image of the season (can be null). |
images |
Array | JSON array containing image URLs (can be empty). |
full_description |
String | Full description of the season in HTML format. |
note_private |
String | Private notes related to the season (can be empty). |
warning_info |
String | Warning information, if any (can be empty). |
promotion_info |
String | Promotion information, if any (can be empty). |
manufacturers |
Array | List of manufacturers linked to the season (can be empty). |
vendors |
Array | List of vendors linked to the season (can be empty). |
product_id |
Integer | ID of the linked product, if any (can be null). |
attach_files |
Array | List of attached files, if any (can be null). |
code |
String | Code representing the season. |
season_custom_field1 |
String | Custom field 1 for the season (can be empty). |
season_custom_field2 |
String | Custom field 2 for the season (can be empty). |
season_custom_field3 |
String | Custom field 3 for the season (can be empty). |
season_custom_field4 |
String | Custom field 4 for the season (can be empty). |
season_custom_field5 |
String | Custom field 5 for the season (can be null). |
crop |
Object | Details about the crop linked to the season, including ID, name, and code. |
count_temp |
Integer | Number of temperature recordings for the season (default is 0). |
temp_from |
Integer | Starting temperature range (default is 0). |
temp_to |
Integer | Ending temperature range (default is 0). |
block_id |
Integer | ID of the block linked to the season. |
block |
Object | Details about the block linked to the season, including ID and name. |
farm_id |
Integer | ID of the farm linked to the season. |
farm |
Object | Details about the farm linked to the season, including ID, name, area, location, etc. |
amount |
Integer | Quantity related to the season (default is 0). |
area |
Integer | Area covered by the season (default is 0). |
Response
If the request is successful, the server will return a JSON response confirming the update.
The above command returns a JSON structured as follows:
[
{
"id": 930,
"name": "BD))!",
"start_date": "2024-07-15",
"end_date": "2024-08-22",
"description": "",
"season_template_id": 1,
"crop_id": 1,
"status": "Pending",
"template_name": null,
"image": null,
"images": "[]",
"full_description": "<p><\/p>",
"note_private": "",
"warning_info": "<p><\/p>",
"promotion_info": "<p><\/p>",
"manufacturers": [],
"vendors": [],
"product_id": null,
"attach_files": null,
"code": "MBT",
"season_custom_field1": "",
"season_custom_field2": "",
"season_custom_field3": "",
"season_custom_field4": "",
"season_custom_field5": null,
"crop": {
"id": 1,
"name": "D\u01b0a l\u01b0\u1edbi",
"code": "M123"
},
"count_temp": 0,
"temp_from": 0,
"temp_to": 0,
"block_id": 230,
"block": {
"id": 230,
"name": "farm 7"
},
"farm_id": 332,
"farm": {
"id": 332,
"name": "V\u01b0\u1eddn ti\u00eau",
"surface": "1000 m2",
"lat": "21.043779",
"lng": "105.789502",
"address": "\u0110\u1eafc l\u1eafk",
"published": 1,
"ownership": "Nguy\u1ec5n V\u0103n A",
"description": "test update mo ta",
"order": 0,
"avatar": "[]",
"tenant_id": 1,
"created_by": null
},
"amount": 0,
"area": 0
}
]
If the token has expired or is invalid, the server will return a status code 401 with a message indicating that the token has expired.
The above command returns a JSON structured as follows:
[
{
"meta": {
"message": "Token expired",
"status_code": 401
},
"data": []
}
]
Add New Season
To add a new season, use this code:
import requests
import json
url = "https://api.nextfarm.vn/api/crop/season"
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer your_access_token'
}
data = {
"block_id": 187,
"code": "",
"crop_id": 5,
"end_date": "2024-11-20",
"farm_id": 332,
"full_description": "<p></p>",
"images": "[]",
"manufacturers": [],
"name": "mùa vụ tháng 8",
"promotion_info": "",
"season_custom_field1": "",
"season_custom_field2": "",
"season_custom_field3": "",
"season_custom_field4": "",
"season_template_id": 58,
"start_date": "2024-08-20",
"status": "Pending",
"vendors": [],
"warning_info": ""
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
curl -X 'POST' \
'https://api.nextfarm.vn/api/crop/season' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer your_access_token' \
-d '{
"block_id": 187,
"code": "",
"crop_id": 5,
"end_date": "2024-11-20",
"farm_id": 332,
"full_description": "<p></p>",
"images": "[]",
"manufacturers": [],
"name": "mùa vụ tháng 8",
"promotion_info": "",
"season_custom_field1": "",
"season_custom_field2": "",
"season_custom_field3": "",
"season_custom_field4": "",
"season_template_id": 58,
"start_date": "2024-08-20",
"status": "Pending",
"vendors": [],
"warning_info": ""
}'
const fetch = require('node-fetch');
const url = 'https://api.nextfarm.vn/api/crop/season';
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer your_access_token'
},
"block_id": 187,
"code": "",
"crop_id": 5,
"end_date": "2024-11-20",
"farm_id": 332,
"full_description": "<p></p>",
"images": "[]",
"manufacturers": [],
"name": "mùa vụ tháng 8",
"promotion_info": "",
"season_custom_field1": "",
"season_custom_field2": "",
"season_custom_field3": "",
"season_custom_field4": "",
"season_template_id": 58,
"start_date": "2024-08-20",
"status": "Pending",
"vendors": [],
"warning_info": ""
})
};
fetch(url, options)
.then(response => response.json())
.then(data => console.log(data));
This endpoint allows you to retrieve Add New season.
HTTPS request
POST https://api.nextfarm.vn/api/crop/season
Parameters
Parameters | Type | Description |
---|---|---|
id |
Integer | Unique identifier for the record. |
name |
String | Name of the season. |
start_date |
Date | Start date of the season. |
end_date |
Date | End date of the season. |
description |
String | Description of the season (can be empty). |
season_template_id |
Integer | ID of the season template associated with this season. |
crop_id |
Integer | ID of the crop linked to this season. |
status |
String | Current status of the season (e.g., "Pending"). |
template_name |
String | Template name, if any (can be null). |
image |
String | URL to the image of the season (can be null). |
images |
Array | JSON array containing image URLs (can be empty). |
full_description |
String | Full description of the season in HTML format. |
note_private |
String | Private notes related to the season (can be empty). |
warning_info |
String | Warning information, if any (can be empty). |
promotion_info |
String | Promotion information, if any (can be empty). |
manufacturers |
Array | List of manufacturers linked to the season (can be empty). |
vendors |
Array | List of vendors linked to the season (can be empty). |
product_id |
Integer | ID of the linked product, if any (can be null). |
attach_files |
Array | List of attached files, if any (can be null). |
code |
String | Code representing the season. |
season_custom_field1 |
String | Custom field 1 for the season (can be empty). |
season_custom_field2 |
String | Custom field 2 for the season (can be empty). |
season_custom_field3 |
String | Custom field 3 for the season (can be empty). |
season_custom_field4 |
String | Custom field 4 for the season (can be empty). |
season_custom_field5 |
String | Custom field 5 for the season (can be null). |
crop |
Object | Details about the crop linked to the season, including ID, name, and code. |
count_temp |
Integer | Number of temperature recordings for the season (default is 0). |
temp_from |
Integer | Starting temperature range (default is 0). |
temp_to |
Integer | Ending temperature range (default is 0). |
block_id |
Integer | ID of the block linked to the season. |
block |
Object | Details about the block linked to the season, including ID and name. |
farm_id |
Integer | ID of the farm linked to the season. |
farm |
Object | Details about the farm linked to the season, including ID, name, area, location, etc. |
amount |
Integer | Quantity related to the season (default is 0). |
area |
Integer | Area covered by the season (default is 0). |
Response
If the request is successful, the server will return a JSON response confirming the update.
The above command returns a JSON structured as follows:
[
{
"id": 936,
"name": "mùa vụ tháng 8",
"start_date": "2024-08-20",
"end_date": "2024-11-20",
"description": null,
"season_template_id": 58,
"crop_id": 5,
"status": "Pending",
"template_name": null,
"image": null,
"images": "[]",
"full_description": "<p><\/p>",
"note_private": null,
"warning_info": "",
"promotion_info": "",
"manufacturers": [],
"vendors": [],
"product_id": null,
"attach_files": null,
"code": "MV0003",
"season_custom_field1": "",
"season_custom_field2": "",
"season_custom_field3": "",
"season_custom_field4": "",
"season_custom_field5": null,
"crop": {
"id": 5,
"name": "D\u01b0a leo",
"code": "c2"
},
"count_temp": null,
"temp_from": null,
"temp_to": null,
"block_id": 187,
"block": {
"id": 187,
"name": "Khu v\u1ef1c test"
},
"farm_id": 332,
"farm": {
"id": 332,
"name": "V\u01b0\u1eddn ti\u00eau",
"surface": "1000 m2",
"lat": "21.043779",
"lng": "105.789502",
"address": "\u0110\u1eafc l\u1eafk",
"published": 1,
"ownership": "Nguy\u1ec5n V\u0103n A",
"description": "test update mo ta",
"order": 0,
"avatar": "[]",
"tenant_id": 1,
"created_by": null
},
"amount": null,
"area": null
}
]
If the token has expired or is invalid, the server will return a status code 401 with a message indicating that the token has expired.
The above command returns a JSON structured as follows:
json [ { "meta": { "message": "Token expried", "status_code": 401 }, "data": [] } ]
Upadate Season Information
To update information of a season, use this code:
curl -X 'PUT' \
'https://api.nextfarm.vn/api/crop/season/{id}' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer your_access_token' \
-d '{
"block_id": 187,
"code": "MV0003",
"crop_id": 5,
"description": None,
"end_date": "2024-11-14",
"farm_id": 332,
"full_description": "<p></p>",
"images": "[]",
"manufacturers": [],
"name": "mùa vụ tháng 8",
"note_private": None,
"promotion_info": "",
"season_custom_field1": "",
"season_custom_field2": "",
"season_custom_field3": "",
"season_custom_field4": "",
"season_template_id": 58,
"start_date": "2024-08-20",
"status": "Pending",
"vendors": [],
"warning_info": "" }'
import requests
url = "https://api.nextfarm.vn/api/crop/season/{id}"
payload = {
"block_id": 187,
"code": "MV0003",
"crop_id": 5,
"description": None,
"end_date": "2024-11-14",
"farm_id": 332,
"full_description": "<p></p>",
"images": "[]",
"manufacturers": [],
"name": "mùa vụ tháng 8",
"note_private": None,
"promotion_info": "",
"season_custom_field1": "",
"season_custom_field2": "",
"season_custom_field3": "",
"season_custom_field4": "",
"season_template_id": 58,
"start_date": "2024-08-20",
"status": "Pending",
"vendors": [],
"warning_info": ""
}
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.nextfarm.vn/api/crop/season/{id}';
const payload = {
"block_id": 187,
"code": "MV0003",
"crop_id": 5,
"description": None,
"end_date": "2024-11-14",
"farm_id": 332,
"full_description": "<p></p>",
"images": "[]",
"manufacturers": [],
"name": "mùa vụ tháng 8",
"note_private": None,
"promotion_info": "",
"season_custom_field1": "",
"season_custom_field2": "",
"season_custom_field3": "",
"season_custom_field4": "",
"season_template_id": 58,
"start_date": "2024-08-20",
"status": "Pending",
"vendors": [],
"warning_info": ""
};
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));
The above command returns a JSON structured as follows:
[
{
"status_code": 0,
"message": "Thành công"
}
]
This endpoint allows you to retrieve Upadate detail information of a season.
HTTP Request
PUT https://api.nextfarm.vn/api/crop/season/{id}
Parameters
Path Parameters
Parameters | Type | Description |
---|---|---|
id | integer | ID of the season |
Body Parameters
Parameters | Type | Description |
---|---|---|
id |
Integer | Unique identifier for the record. |
name |
String | Name of the season. |
start_date |
Date | Start date of the season. |
end_date |
Date | End date of the season. |
description |
String | Description of the season (can be empty). |
season_template_id |
Integer | ID of the season template associated with this season. |
crop_id |
Integer | ID of the crop linked to this season. |
status |
String | Current status of the season (e.g., "Pending"). |
template_name |
String | Template name, if any (can be null). |
image |
String | URL to the image of the season (can be null). |
images |
Array | JSON array containing image URLs (can be empty). |
full_description |
String | Full description of the season in HTML format. |
note_private |
String | Private notes related to the season (can be empty). |
warning_info |
String | Warning information, if any (can be empty). |
promotion_info |
String | Promotion information, if any (can be empty). |
manufacturers |
Array | List of manufacturers linked to the season (can be empty). |
vendors |
Array | List of vendors linked to the season (can be empty). |
product_id |
Integer | ID of the linked product, if any (can be null). |
attach_files |
Array | List of attached files, if any (can be null). |
code |
String | Code representing the season. |
season_custom_field1 |
String | Custom field 1 for the season (can be empty). |
season_custom_field2 |
String | Custom field 2 for the season (can be empty). |
season_custom_field3 |
String | Custom field 3 for the season (can be empty). |
season_custom_field4 |
String | Custom field 4 for the season (can be empty). |
season_custom_field5 |
String | Custom field 5 for the season (can be null). |
crop |
Object | Details about the crop linked to the season, including ID, name, and code. |
count_temp |
Integer | Number of temperature recordings for the season (default is 0). |
temp_from |
Integer | Starting temperature range (default is 0). |
temp_to |
Integer | Ending temperature range (default is 0). |
block_id |
Integer | ID of the block linked to the season. |
block |
Object | Details about the block linked to the season, including ID and name. |
farm_id |
Integer | ID of the farm linked to the season. |
farm |
Object | Details about the farm linked to the season, including ID, name, area, location, etc. |
amount |
Integer | Quantity related to the season (default is 0). |
area |
Integer | Area covered by the season (default is 0). |
Response
If the request is successful, the server will return a JSON response confirming the update.
The above command returns a JSON structured as follows:
[
{
"id": 936,
"name": "m\u00f9a v\u1ee5 th\u00e1ng 8",
"start_date": "2024-08-20",
"end_date": "2024-11-14",
"description": null,
"season_template_id": 58,
"crop_id": 5,
"status": "Pending",
"template_name": null,
"image": null,
"images": "[]",
"full_description": "<p><\/p>",
"note_private": null,
"warning_info": "",
"promotion_info": "",
"manufacturers": [],
"vendors": [],
"product_id": null,
"attach_files": null,
"code": "MV0003",
"season_custom_field1": "",
"season_custom_field2": "",
"season_custom_field3": "",
"season_custom_field4": "",
"season_custom_field5": null,
"crop": {
"id": 5,
"name": "D\u01b0a leo",
"code": "c2"
},
"count_temp": 0,
"temp_from": 0,
"temp_to": 0,
"block_id": 187,
"block": {
"id": 187,
"name": "Khu v\u1ef1c test"
},
"farm_id": 332,
"farm": {
"id": 332,
"name": "V\u01b0\u1eddn ti\u00eau",
"surface": "1000 m2",
"lat": "21.043779",
"lng": "105.789502",
"address": "\u0110\u1eafc l\u1eafk",
"published": 1,
"ownership": "Nguy\u1ec5n V\u0103n A",
"description": "test update mo ta",
"order": 0,
"avatar": "[]",
"tenant_id": 1,
"created_by": null
},
"amount": 0,
"area": 0
}
]
If the token has expired or is invalid, the server will return a status code 401 with a message indicating that the token has expired.
The above command returns a JSON structured as follows:
json [ { "meta": { "message": "Token expried", "status_code": 401 }, "data": [] } ]
Season Template
Get Season Template List
To get season template list, use this code :
import requests
url = "https://api.nextfarm.vn/api/template/season"
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer your_access_token'
}
response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
'https://api.nextfarm.vn/api/template/season' \
-H 'accept: application/json' \
-H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');
const url = 'https://api.nextfarm.vn/api/template/season';
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));
The above command returns a JSON structured as follows:
[
{
"id": 155,
"name": "1111",
"description": "111",
"crop_type": null,
"crop_id": 1,
"crop": {
"id": 1,
"name": "D\u01b0a l\u01b0\u1edbi"
},
"order": 0,
"block_id": null,
"block": null
}
]
This endpoint allows you to retrieve season template list .
HTTP Request
GET https://api.nextfarm.vn/api/template/season
Query Parameters
Parameters | Type | Description |
---|---|---|
page | integer | Page number (starting from 0) |
pageLimit | integer | Maximum number of items per page |
search[] | array[string] | Search by name, code, SKU, price |
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 a season template list.
If the token has expired or is invalid, the server will return a status code 401 with a message indicating that the token has expired.
The above command returns a JSON structured as follows:
[
{
"meta": {
"message": "Token expired",
"status_code": 401
},
"data": []
}
]
Get detail a season template
To Get detail a season template, use this code:
import requests
url = "https://api.nextfarm.vn/api/template/season/{id}"
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer your_access_token'
}
response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
'https://api.nextfarm.vn/api/template/season{id}' \
-H 'accept: application/json' \
-H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');
const url = 'https://api.nextfarm.vn/api/template/season{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 allows you to retrieve a season template detail.
HTTPS Request
GET https://api.nextfarm.vn/api/template/season{id}
Parameters
Path Parameters
Parameters | Type | Description |
---|---|---|
id | integer | ID of season template |
Body Parameters
Parameters | Type | Description |
---|---|---|
name | string | name of the season template |
description | string | description |
crop_type | string | Crop type (can be "null") |
crop_id | int | ID of the crop |
crop | object | detail of the crop |
order | int | order |
block_id | int | ID off block (can be "null") |
block | object | detail of block (can be "null") |
Response
If the request is successful, the server will return a JSON response confirming the update.
The above command returns a JSON structured as follows:
[
{
"data": {
"id": 163,
"name": "Mẫu mùa vụ tháng 8",
"description": "",
"crop_type": null,
"crop_id": 65,
"crop": {
"id": 65,
"name": "c\u00e0 chua"
},
"order": null,
"block_id": null,
"block": null
}
]
If the token has expired or is invalid, the server will return a status code 401 with a message indicating that the token has expired.
The above command returns a JSON structured as follows:
[
{
"meta": {
"message": "Token expired",
"status_code": 401
},
"data": []
}
]
Add New Season Template
To add new a season template, use this code:
import requests
import json
url = "https://api.nextfarm.vn/api/template/season"
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer your_access_token'
}
data = {
"name" : "Mẫu mùa vụ tháng 8"
"crop_id": 5,
"description": None
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
curl -X 'POST' \
'https://api.nextfarm.vn/api/template/season' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer your_access_token' \
-d '{
"name" : "Mẫu mùa vụ tháng 8"
"crop_id": 5,
"description": None
}'
const fetch = require('node-fetch');
const url = 'https://api.nextfarm.vn/api/template/season';
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer your_access_token'
},
"name" : "Mẫu mùa vụ tháng 8"
"crop_id": 5,
"description": None
})
};
fetch(url, options)
.then(response => response.json())
.then(data => console.log(data));
This endpoint allows you to retrieve Add New a season template.
HTTPS request
POST https://api.nextfarm.vn/api/template/season
Parameters
Parameters | Type | Description |
---|---|---|
id | int | ID of a season template |
name | string | name of the season template |
description | string | description |
crop_type | string | Crop type (can be "null") |
crop_id | int | ID of the crop |
crop | object | detail of the crop |
order | int | order |
block_id | int | ID off block (can be "null") |
block | object | detail of block (can be "null") |
Response
If the request is successful, the server will return a JSON response confirming the update.
The above command returns a JSON structured as follows:
[
{
"id": 163,
"name": "Mẫu mùa vụ tháng 8",
"description": "",
"crop_type": null,
"crop_id": 65,
"crop": {
"id": 65,
"name": "c\u00e0 chua"
},
"order": null,
"block_id": null,
"block": null
}
]
If the token has expired or is invalid, the server will return a status code 401 with a message indicating that the token has expired.
The above command returns a JSON structured as follows:
json [ { "meta": { "message": "Token expried", "status_code": 401 }, "data": [] } ]
Update Season template information
to upate season template information, use this code:
curl -X 'PUT' \
'https://api.nextfarm.vn/api/template/season/{id}' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer your_access_token' \
-d '{
"name" : "Mẫu mùa vụ tháng 8"
"crop_id": 5,
"description": None
import requests
url = "https://api.nextfarm.vn/api/template/season/{id}"
payload = {
"name" : "Mẫu mùa vụ tháng 8"
"crop_id": 5,
"description": None
}
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.nextfarm.vn/api/template/season/{id}';
const payload = {
"name" : "Mẫu mùa vụ tháng 8"
"crop_id": 5,
"description": None,
};
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));
The above command returns a JSON structured as follows:
[
{
"status_code": 0,
"message": "Thành công"
}
]
This endpoint allows you to retrieve update a season template information.
HTTP Request
PUT https://api.nextfarm.vn/api/template/season/{id}
Parameters
Path Parameters
Parameters | Type | Description |
---|---|---|
id | int | ID of a season template |
Body Parameters
Parameters | Type | Description |
---|---|---|
name | string | name of the season template |
description | string | description |
crop_type | string | Crop type (can be "null") |
crop_id | int | ID of the crop |
crop | object | detail of the crop |
order | int | order |
block_id | int | ID off block (can be "null") |
block | object | detail of block (can be "null") |
Response
If the request is successful, the server will return a JSON response confirming the update.
The above command returns a JSON structured as follows:
[
{
"data": {
"id": 163,
"name": "Mẫu mùa vụ tháng 8",
"description": "",
"crop_type": null,
"crop_id": 65,
"crop": {
"id": 65,
"name": "c\u00e0 chua"
},
"order": null,
"block_id": null,
"block": null
}
]
If the token has expired or is invalid, the server will return a status code 401 with a message indicating that the token has expired.
The above command returns a JSON structured as follows:
json [ { "meta": { "message": "Token expried", "status_code": 401 }, "data": [] } ]
Reports
Get Irrigation History Report
To get irrigation history report, usr this code:
import requests
url = "https://api.nextfarm.vn/api/report/plc"
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer your_access_token'
}
response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
'https://api.nextfarm.vn/api/report/plc' \
-H 'accept: application/json' \
-H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');
const url = 'https://api.nextfarm.vn/api/report/plc';
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));
The above command returns a JSON structured as follows:
[
{
"pagination": {
"total": 0,
"count": 0,
"per_page": 15,
"current_page": 1,
"total_pages": 1,
"links": []
}
]
This endpoint allows you to retrieve irrigation history report .
HTTP Request
GET https://api.nextfarm.vn/api/report/plc
Query Parameters
Parameters | Type | Description |
---|---|---|
page | integer | Page number (Start from 0) |
pageLimit | integer | Maximun items in one page |
Response
If the request is successful, the server will return a JSON response with danh sách irrigation history report.
If the token has expired or is invalid, the server will return a status code 401 with a message indicating that the token has expired.
The above command returns a JSON structured as follows:
[
{
"meta": {
"message": "Token expired",
"status_code": 401
},
"data": []
}
]
User Account Report
To get user account report, use this code:
import requests
url = "https://api.nextfarm.vn/api/ajinomoto/report/account"
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer your_access_token'
}
response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
'https://api.nextfarm.vn/api/ajinomoto/report/account' \
-H 'accept: application/json' \
-H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');
const url = 'https://api.nextfarm.vn/api/ajinomoto/report/account';
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));
The above command returns a JSON structured as follows:
[
{
"id": 858,
"name": "T2",
"start_date": "2024-02-19",
"end_date": "2024-02-29",
"area": 0,
"amount": 0,
"crop_code": "M123",
"crop_name": "D\u01b0a l\u01b0\u1edbi",
"user_name": "0973909605",
"user_full_name": "Le v\u0103n linh "
}
]
This endpoint allows you to retrieve user account report .
HTTP Request
GET https://api.nextfarm.vn/api/ajinomoto/report/account
Query Parameters
Parameters | Type | Description |
---|---|---|
id | integer | User ID |
name | string | Season name |
start_date | string | Start date of the report |
end_date | string | End date of the report |
area | float | Area allocated to the user |
amount | float | Production quantity |
crop_code | string | Crop code |
crop_name | string | Crop name |
user_name | string | Username (phone number) |
user_full_name | string | Full name of the user |
Response
If the request is successful, the server will return a JSON response with user account report.
If the token has expired or is invalid, the server will return a status code 401 with a message indicating that the token has expired.
The above command returns a JSON structured as follows:
[
{
"meta": {
"message": "Token expired",
"status_code": 401
},
"data": []
}
]
Get Season information by Zone Report
To get season information by zone report, use this code:
import requests
url = "https://api.nextfarm.vn/api/ajinomoto/report/season-by-zone"
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer your_access_token'
}
response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
'https://api.nextfarm.vn/api/ajinomoto/report/season-by-zone' \
-H 'accept: application/json' \
-H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');
const url = 'https://api.nextfarm.vn/api/ajinomoto/report/season-by-zon';
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));
The above command returns a JSON structured as follows:
[
{
"pagination": {
"total": 0,
"count": 0,
"per_page": 15,
"current_page": 1,
"total_pages": 1,
"links": []
},
"status_code": 0,
"message": "Successfully"
},
"recordsTotal": 0,
"recordsFiltered": 0,
"request": {
"page": "1",
"pageLimit": "15",
"from_date": "",
"to_date": ""
}
]
This endpoint allows you to retrieve get season information by zone report.
HTTP Request
GET https://api.nextfarm.vn/api/ajinomoto/report/season-by-zone
Query Parameters
Parameters | Type | Description |
---|---|---|
page | integer | Page number (Start from 0) |
pageLimit | integer | Maximun items in 1 page |
from_date | string | Start date |
to_date | strign | End date |
Response
If the request is successful, the server will return a JSON response with a pest information by zone report.
If the token has expired or is invalid, the server will return a status code 401 with a message indicating that the token has expired.
The above command returns a JSON structured as follows:
[
{
"meta": {
"message": "Token expired",
"status_code": 401
},
"data": []
}
]
Get Pest Information by Zone report
To get pest information by zone report, use this code:
import requests
url = "https://api.nextfarm.vn/api/ajinomoto/report/pest-by-zone"
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer your_access_token'
}
response = requests.get(url, headers=headers)
print(response.json())
curl -X 'GET' \
'https://api.nextfarm.vn/api/ajinomoto/report/pest-by-zone' \
-H 'accept: application/json' \
-H 'Authorization: Bearer your_access_token'
const fetch = require('node-fetch');
const url = 'https://api.nextfarm.vn/api/ajinomoto/report/pest-by-zone';
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));
The above command returns a JSON structured as follows:
[
{
"pagination": {
"total": 0,
"count": 0,
"per_page": 15,
"current_page": 1,
"total_pages": 1,
"links": []
},
"status_code": 0,
"message": "Successfully"
},
"recordsTotal": 0,
"recordsFiltered": 0,
"request": {
"page": "1",
"pageLimit": "15",
"from_date": "",
"to_date": ""
}
]
This endpoint allows you to retrieve pest information by zone report.
HTTP Request
GET https://api.nextfarm.vn/api/ajinomoto/report/season-by-zone
Query Parameters
Parameters | Type | Description |
---|---|---|
page | integer | Page number (Start from 0) |
pageLimit | integer | Max items in 1 page |
from_date | string | Start date |
to_date | strign | End date |
Response
If the request is successful, the server will return a JSON response with pest information by zone report.
If the token has expired or is invalid, the server will return a status code 401 with a message indicating that the token has expired.
The above command returns a JSON structured as follows:
[
{
"meta": {
"message": "Token expired",
"status_code": 401
},
"data": []
}
]
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. |