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 you are using the "Example Value" that can be found in Swagger exactly the way it is, and the body data does not have proper information.

This is an example value and it does not include the 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 the data accordingly (make sure to update the fingerprint & face data) or you can also refer to the below example that only has the mandatory fields listed. 


You can refer to the below simple example for [POST] /api/users.


{
    "User":{
    "name":"suprema",
    "user_id":"4",
    "user_group_id":{
    "id":1,
    "name":"All Users"
    },
    "disabled":"false",
    "start_datetime":"2001-01-01T00:00:00.00Z",
    "expiry_datetime":"2030-12-31T23:59:00.00Z"
    }
}