Devices
Quản lý thiết bị đăng nhập
POST /devices
Đăng ký thiết bị
Fields
| Field | Type | Description | Required |
|---|---|---|---|
| device_unique_id | NO | ||
| device_name | NO | ||
| action | NO | ||
| location_id | NO | ||
| is_active | NO | ||
| export_einvoice | NO |
Request
Headers
| Header | Value |
|---|---|
| Accept | application/vnd.devices.v1+json
application/hal+json
application/json |
| Content-Type | application/vnd.devices.v1+json
application/json |
| Authorization | HTTP Basic, HTTP Digest, or OAuth2 Bearer token (check API provider for details) |
Body
{
"device_unique_id",
"device_name"
}
Response
Status Codes
- 406: Not Acceptable
- 415: Unsupported Media Type
- 201: Created
- 400: Client Error
- 422: Unprocessable Entity
- 401: Unauthorized
- 403: Forbidden
Headers
| Header | Value |
|---|---|
| Content-Type | application/vnd.devices.v1+json
application/hal+json
application/json |
| Allow | Comma-separated list of all HTTP methods allowed |
Body
//return ERROR
{
"result": "ERROR",
"code": "PERSON_NOT_FOUND|ERROR"
}
// return SUCCESS
{
"result": "SUCCESS",
"data: {
"device_id",
"location_id",
"is_active": "Y|N|W"
}
}
GET /devices
- Lấy danh sách thiết bị API đã đăng ký. Có thể truyền các param: request_location=Y (có yêu cầu set location), location=[location_id] (lọc theo location đã set), person=[person_id] (lọc theo person đã đăng ký), is_active=Y|N|W.
- Lấy danh sách thiết bị chung (bao gồm web, mobile và desktop): /devices?general=Y. Param: host, desktop_app = "Y|N" (thiết bị desktop), device_name (tên thiết bị), export_einvoice=Y|N (cho phép xuất HDDT)
Fields
| Field | Type | Description | Required |
|---|---|---|---|
| device_unique_id | NO | ||
| device_name | NO | ||
| action | NO | ||
| location_id | NO | ||
| is_active | NO | ||
| export_einvoice | NO |
Request
Headers
| Header | Value |
|---|---|
| Accept | application/vnd.devices.v1+json
application/hal+json
application/json |
| Authorization | HTTP Basic, HTTP Digest, or OAuth2 Bearer token (check API provider for details) |
Response
Status Codes
- 406: Not Acceptable
- 415: Unsupported Media Type
- 200: OK
- 401: Unauthorized
- 403: Forbidden
Headers
| Header | Value |
|---|---|
| Content-Type | application/vnd.devices.v1+json
application/hal+json
application/json |
| Allow | Comma-separated list of all HTTP methods allowed |
Body
- Lấy danh sách thiết bị API đã đăng ký
{
"_embedded": {
"devices": [
{
"device_id",
"device_name",
"is_active": "Y|N|W",
"request_location": "Y|N",
"created_at",
"person_name",
"location_name",
},
...
]
}
}
- Lấy danh sách thiết bị chung:
{
"_embedded": {
"devices": [
{
"device_id",
"host",
"device_name",
"export_einvoice": "Y|N",
"ticket_uuid", //uuid xuất HD gần gần nhất trong tháng
"ticketid", // ticket id xuất HD gần nhất trong tháng
"datenew", //Ngày xuất HD gần nhất trong tháng
},
...
]
}
}
GET /devices[/:device_id]
Lấy thông tin thiết bị: /[device_id]
Fields
| Field | Type | Description | Required |
|---|---|---|---|
| device_unique_id | NO | ||
| device_name | NO | ||
| action | NO | ||
| location_id | NO | ||
| is_active | NO | ||
| export_einvoice | NO |
Request
Headers
| Header | Value |
|---|---|
| Accept | application/vnd.devices.v1+json
application/hal+json
application/json |
| Authorization | HTTP Basic, HTTP Digest, or OAuth2 Bearer token (check API provider for details) |
Response
Status Codes
- 406: Not Acceptable
- 415: Unsupported Media Type
- 200: OK
- 404: Not Found
- 401: Unauthorized
- 403: Forbidden
Headers
| Header | Value |
|---|---|
| Content-Type | application/vnd.devices.v1+json
application/hal+json
application/json |
| Allow | Comma-separated list of all HTTP methods allowed |
Body
//return ERROR
{
"result": "ERROR",
"code": "DEVICE_NOT_EXIST"
}
// return SUCCESS
{
"result": "SUCCESS",
"data: {
"device_id",
"device_unique_id",
"device_name",
"location_id",
"location_name",
"request_location",
"request_location_name",
"person_name",
"is_active": "Y|N|W",
"config": null | array_config
}
}
PUT /devices[/:device_id]
- Cập nhật thông tin thiết bị. 2. Gởi yêu cầu set kho. 3. Chỉnh sửa thiết bị chung
Fields
| Field | Type | Description | Required |
|---|---|---|---|
| device_unique_id | NO | ||
| device_name | NO | ||
| action | NO | ||
| location_id | NO | ||
| is_active | NO | ||
| export_einvoice | NO |
Request
Headers
| Header | Value |
|---|---|
| Accept | application/vnd.devices.v1+json
application/hal+json
application/json |
| Content-Type | application/vnd.devices.v1+json
application/json |
| Authorization | HTTP Basic, HTTP Digest, or OAuth2 Bearer token (check API provider for details) |
Body
{
"action": "editLocation | editActive | requestLocation | editDeviceGeneral",
"location_id", //require by action editLocation and requestLocation
"is_active": "Y|N|W" //require by action editActive,
"device_name" // Với action editDeviceGeneral
"export_einvoice":"Y|N" //Required với action editDeviceGeneral
}
Response
Status Codes
- 406: Not Acceptable
- 415: Unsupported Media Type
- 200: OK
- 404: Not Found
- 400: Client Error
- 422: Unprocessable Entity
- 401: Unauthorized
- 403: Forbidden
Headers
| Header | Value |
|---|---|
| Content-Type | application/vnd.devices.v1+json
application/hal+json
application/json |
| Allow | Comma-separated list of all HTTP methods allowed |
Body
//ERROR - NOT_FOUND_DEVICE: Không tìm thấy thiết bị. - NOT_FOUND_LOCATION: Không tìm thấy location by location_id. //action editLocation and requestLocation - ERROR: Lỗi khác
Versions
GET /apps/versions[/:platform]
Lấy version app theo [/:platform]: "android | ios"
Request
Headers
| Header | Value |
|---|---|
| Accept | application/vnd.devices.v1+json
application/hal+json
application/json |
Response
Status Codes
- 406: Not Acceptable
- 415: Unsupported Media Type
- 200: OK
- 404: Not Found
Headers
| Header | Value |
|---|---|
| Content-Type | application/vnd.devices.v1+json
application/hal+json
application/json |
| Allow | Comma-separated list of all HTTP methods allowed |
Body
{
"result": "SUCCESS",
"version",
}
Lỗi có thể xảy ra:
- NOT_PLATFORM: Nền tảng không đúng
- NOT_FOUND_VERSION: Không tìm thấy version app