Why does the server response 400 occur when you try to call [POST] /api/users?
Request URL
https://IPaddress/api/users
Relevant Server Reponse:
Response body | 800 Failed to execute Database query |
Response headers | 400 Bad Request |
This is because that you refer to the "Example Value" of BioStar 2 Users API and body data is not proper information.
This is an example value and it does not include full data of the user fingerprint template and the face template.
[Example Value in Swagger UI]
{
"User": {
"name": "test123",
"email": "test123@suprema.co.kr",
"photo": "binaryDatas;dfkas;dfjasdfwqerqwerzxc",
"phone": "010-1111-2222",
"user_id": "9",
"user_group_id": {
"id": "1"
},
"disabled": "false",
"start_datetime": "2001-01-01T00:00:00.00Z",
"expiry_datetime": "2030-12-31T23:59:00.00Z",
"permission": {
"id": "4",
"name": "Test",
"description": "string",
"operators": [
{
"name": "test2",
"owner_id": "255",
"user_id": "3"
}
]
},
"access_groups": {
"name": "test_access",
"id": 1
},
"password": "Test4315",
"pin": "1234",
"login_id": "test123",
"user_ip": "127.0.0.1",
"fingerprint_templates": [
{
"template0": "Base64: RDQQFJYAVUYvFXsEIzIQC1QYbodkHe...", // Please update your fingerprint template information.
"template1": "Base64: RDQQFJYAVUYvFXsEIzIQC1QYbodkHe...", // Please update your fingerprint template information.
"finger_mask": false,
"isNew": true
}
],
"credentials": {
"faces": [
{
"raw_image": "Base64: RDQQFJYAVUYvFXsEIzIQC1QYbodkHe...", // Please update your Face template information.
"templates": [
{
"template": "Base64: RDQQFJYAVUYvFXsEIzIQC1QYbodkHe..." // Please update your Face template information.
}
],
"flag": "0",
"useProfile": "false",
"index": 0
}
]
},
"cards": [
{
"card_type": {
"id": "0",
"name": "",
"type": "1",
"mode": "C"
},
"card_id": "1154754208683904",
"display_card_id": "1154754208683904",
"id": "4",
"cardId": "43209719883",
"wiegand_format_id": {
"id": "4"
},
"wiegand_format_name": "HID Corporate 1000 48bit"
}
]
}
}
Please update your fingerprint template completely or, use the below simple example body.
You can refer to the below simpe example for [POST] api/users.