ข้อมูลชาวไร่อ้อย (Farmer)
API สำหรับเชื่อมโยงข้อมูลการส่งอ้อย จำกัดการเข้าถึงข้อมูลเฉพาะผู้ที่ได้รับอนุญาตเท่านั้น
ตัวอย่างการ authenticate และใช้ session
import requests
# create a session
sess = requests.session()
# login into the system
data = {
"jsonrpc": "2.0",
"method": "call",
"params": {
"db": "econtract",
"login": "your_username",
"password": "your_password"
}
}
sess.post('https://econtract.ocsb.go.th/web/session/authenticate', json=data)
# use this session to call your services
res = sess.get(
'https://econtract.ocsb.go.th/api/farmer/search?thai_no=1111111111111'
)
print(res.json())
/get
Parameter
| Name | Description |
|---|---|
| thai_no required string | เลขประจำตัวประชาชน |
Responses
| Code | Description |
|---|---|
| 200 | the request has succeeded.
Example Value
|
| 400 | One of the given parameter is not valid |
| 401 | The user is not authorized. Authentication is required |
| 403 | You don't have the permission to access the requested resource. |
| 404 | Requested resource not found |
/search
Parameter
| Name | Description |
|---|---|
| first_name string | ชื่อ |
| last_name string | นามสกุล |
| ocsb_no string | เลขบัตรชาวไร่อ้อย |
| offset string | Offset |
| thai_no string | เลขประจำตัวประชาชน |
Responses
| Code | Description |
|---|---|
| 200 | the request has succeeded.
Example Value
|
| 400 | One of the given parameter is not valid |
| 401 | The user is not authorized. Authentication is required |
| 403 | You don't have the permission to access the requested resource. |
| 404 | Requested resource not found |