Create User Bulk

This end point is use for create users

[POST] /ruangkerja/users/create-bulk

Information

This API is a function for create multiple users in single operation.

Headers

NameTypeExampleRequiredDescription
Authorizationstringaccess_tokenYESToken of authentication. Get from Authentication API
Acceptstringapplication/jsonYESDefines the message format that is expected by the client
Content-Typestringapplication/jsonYESDefines the message format of the request body that is sent by the client

Parameter

NameTypeRequiredLocationDescription
employeeIDstringYESbodyEmployee ID of user. Allowed format: Alphabet (a-z, A-Z), Numeric (0-9)
namestringYESbodyName of user
usernamestringOPTIONALbodyUsername is used by users to sign in. Allowed format: Alphabet (a-z,A-Z) Numerical (0-9)
emailstringOPTIONALbodyEmail of user. Email is required if phone empty
phonestringOPTIONALbodyPhone of user. Phone is required if email empty
passwordstringOPTIONALbodyPassword of user. Password will be send to email, If empty the password will be random
isActiveboolYESbodyStatus of user
tagSerials[]stringOPTIONALbodyTag serials

Note: Email and phone number can be entered both

Example cURL Request

curl --location --request POST 'https://api.ruangkerja.id/ruangkerja/users/create-bulk' \
--header 'Authorization: access_token' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
    "items": [
        {
            "employeeID": "EMPLY001",
            "name": "John Doe",
            "username": null,
            "email": "john.doe@example.com",
            "phone": "6281122334455",
            "password": null,
            "isActive": true,
            "tagSerials": ["RUKRTAG-9WHL0JGP"]
        }
    ]
}'

Example Success Response

{
    "data": {
        "failedItems": [],
        "successItems": [
            {
                "payload": {
                    "employeeID": "EMPLY001",
                    "name": "John Doe",
                    "username": null,
                    "email": "john.doe@example.com",
                    "phone": "6281122334455",
                    "password": null,
                    "isActive": true,
                    "tagSerials": ["RUKRTAG-9WHL0JGP"]
                },
                "response": {
                    "serial": "OPENAPI9Z7ZIHIFW"
                }
            }
        ]
    },
    "status": "success",
    "message": "success"
}

Example Failed Response

{
    "data": {
        "failedItems": [
            {
                "error": {
                    "detail": "employee id already been taken",
                    "errorCode": 10101,
                    "message": "USER_EMPLOYEE_ID_EXISTS"
                },
                "payload": {
                    "employeeID": "EMPLY001",
                    "name": "John Doe",
                    "username": null,
                    "email": "john.doe@example.com",
                    "phone": "6281122334455",
                    "password": null,
                    "isActive": true,
                    "tagSerials": ["RUKRTAG-9WHL0JGP"]
                }
            }
        ],
        "successItems": []
    },
    "status": "success",
    "message": "success"
}

See also: Error Dictionary.