Locations
GET /locations
Lấy danh sách kho hàng. Có 2 chế độ:
Lấy danh sách kho hàng chung.
- Quyền:
location.view_list. - Tham số lọc:
active=Y(chỉ lấy các kho đang hoạt động).
- Quyền:
Lấy danh sách kho hàng theo quyền của chức năng khác.
- Tham số:
other_role_view=[role]
- Tham số:
Fields
| Field | Type | Description | Required |
|---|---|---|---|
| name | NO | ||
| address | NO | ||
| isactive | NO | ||
| isprimary | NO | ||
| config | NO | ||
| action | NO |
Request
Headers
| Header | Value |
|---|---|
| Accept | application/vnd.locations.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.locations.v1+json
application/hal+json
application/json |
| Allow | Comma-separated list of all HTTP methods allowed |
Body
1. Phản hồi cho danh sách chung:
{
"_embedded": {
"locations": [
{
"location_id",
"location_name",
"isactive": "Y|N"
}
]
}
}
2. Phản hồi cho `other_role_view`:
{
"_embedded": {
"locations": [
{
"location_id",
"location_name"
}
]
}
}
POST /locations
Thêm mới kho hàng. Quyền: location.create
Fields
| Field | Type | Description | Required |
|---|---|---|---|
| name | NO | ||
| address | NO | ||
| isactive | NO | ||
| isprimary | NO | ||
| config | NO | ||
| action | NO |
Request
Headers
| Header | Value |
|---|---|
| Accept | application/vnd.locations.v1+json
application/hal+json
application/json |
| Content-Type | application/vnd.locations.v1+json
application/json |
| Authorization | HTTP Basic, HTTP Digest, or OAuth2 Bearer token (check API provider for details) |
Body
{
"name", // Required
"address", // Required
"isactive": "Y|N", // Required
"isprimary": "Y|N", // Required
"config" // Required, string JSON
}
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.locations.v1+json
application/hal+json
application/json |
| Allow | Comma-separated list of all HTTP methods allowed |
Body
//Các lỗi có thể xảy ra - EXIST_NAME: Tên location đã tồn tại - ERROR: Lỗi khác
GET /locations[/:location_id]
Lấy thông tin chi tiết kho hàng. Quyền: location.view_detail
Fields
| Field | Type | Description | Required |
|---|---|---|---|
| name | NO | ||
| address | NO | ||
| isactive | NO | ||
| isprimary | NO | ||
| config | NO | ||
| action | NO |
Request
Headers
| Header | Value |
|---|---|
| Accept | application/vnd.locations.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.locations.v1+json
application/hal+json
application/json |
| Allow | Comma-separated list of all HTTP methods allowed |
Body
{
"result": "SUCCESS",
"location": {
"location_id",
"location_name",
"address",
"isactive": "Y|N",
"isprimary": "Y|N",
"config": null | array_config
}
}
//ERROR
- NOT_FOUND_LOCATION: Không tìm thấy location
PUT /locations[/:location_id]
Chỉnh sửa thông tin kho theo action:
- editName: Sửa tên. Quyền: location.edit_name.
- editAddress: Sửa địa chỉ. Quyền: location.edit_address.
- editActive: Sửa trạng thái hoạt động. Quyền: location.edit_active.
- editPrimary: Sửa trạng thái kho chính. Quyền: location.edit_primary.
- editConfig: Sửa cấu hình. Quyền: location.edit_config.
Fields
| Field | Type | Description | Required |
|---|---|---|---|
| name | NO | ||
| address | NO | ||
| isactive | NO | ||
| isprimary | NO | ||
| config | NO | ||
| action | NO |
Request
Headers
| Header | Value |
|---|---|
| Accept | application/vnd.locations.v1+json
application/hal+json
application/json |
| Content-Type | application/vnd.locations.v1+json
application/json |
| Authorization | HTTP Basic, HTTP Digest, or OAuth2 Bearer token (check API provider for details) |
Body
{
"action": "editName | editAddress | editActive | editPrimary | editConfig",
"name", // Required với action `editName`
"address", // Required với action `editAddress`
"isactive": "Y|N", // Required với action `editActive`
"isprimary": "Y|N", // Required với action `editPrimary`
"config": "string JSON" // Required với action `editConfig`
}
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.locations.v1+json
application/hal+json
application/json |
| Allow | Comma-separated list of all HTTP methods allowed |
Body
Các lỗi có thể xảy ra: - NOT_FOUND_LOCATION: Không tìm thấy location - ERROR: Lỗi khác. - EXIST_NAME: Tên kho đã tồn tại. //action editName
DELETE /locations[/:location_id]
Xóa kho. Quyền: location.delete.
Các lỗi có thể xảy ra:
- NOT_FOUND_LOCATION: Không tìm thấy kho;
- ERROR: Lỗi khác
Fields
| Field | Type | Description | Required |
|---|---|---|---|
| name | NO | ||
| address | NO | ||
| isactive | NO | ||
| isprimary | NO | ||
| config | NO | ||
| action | NO |
Request
Headers
| Header | Value |
|---|---|
| Accept | application/vnd.locations.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
- 204: No Content
- 404: Not Found
- 401: Unauthorized
- 403: Forbidden
Headers
| Header | Value |
|---|---|
| Content-Type | application/vnd.locations.v1+json
application/hal+json
application/json |
| Allow | Comma-separated list of all HTTP methods allowed |