Skip to content

Users

This module is used to manage the master data of users.

INFO

Make sure to add /api prefix in the API endpoint.

Get Users Index Endpoint

http
GET /users
GET /users

Headers

  • Content-Type: application/json
  • Authorization: Bearer {token}

Query Parameters

NameTypeDescriptionNullable
pageintPage numberfalse
search_namestringSearch by nametrue
search_roleintSearch by role IDtrue
search_globalstringSearch by global filtertrue
order_columnstringOrder by columntrue
order_directionstringOrder by directiontrue

Response

200 OK
json
{
    "data": [
        {
            "id": 36,
            "name": "Dwi Cahyo Utomo,...",
            "email": "[email protected]",
            "role": {
                "id": 7,
                "name": "Owner"
            },
            "nik": "3129031092321321",
            "workstart": "08 Oktober 2023",
            "workleave": "08 Oktober 2023"
        },
        {
            "id": 37,
            "name": "Vedo Yustinevan,...",
            "email": "[email protected]",
            "role": {
                "id": 3,
                "name": "Admin Keuangan"
            },
            "nik": "3374152103920001",
            "workstart": "31 Januari 2023",
            "workleave": "31 Januari 2023"
        },
        {
            "id": 34,
            "name": "Auditor",
            "email": "[email protected]",
            "role": {
                "id": 6,
                "name": "Auditor"
            },
            "nik": "3310106357011231",
            "workstart": "07 November 2022",
            "workleave": "07 November 2022"
        },
        {
            "id": 35,
            "name": "Muhammad Galih P...",
            "email": "[email protected]",
            "role": {
                "id": 5,
                "name": "Operator"
            },
            "nik": "3374101706040003",
            "workstart": "07 Oktober 2022",
            "workleave": "06 Februari 2023"
        },
        {
            "id": 30,
            "name": "Sobirin",
            "email": "[email protected]",
            "role": {
                "id": 4,
                "name": "Kepala Shift"
            },
            "nik": "3314170904880003",
            "workstart": "30 Agustus 2022",
            "workleave": "30 Agustus 2022"
        },
        // and so on...
    ],
    "links": {
        "first": "http://espbu.test/api/users?page=1",
        "last": "http://espbu.test/api/users?page=4",
        "prev": null,
        "next": "http://espbu.test/api/users?page=2"
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 4,
        "links": [
            {
                "url": null,
                "label": "« Sebelumnya",
                "active": false
            },
            {
                "url": "http://espbu.test/api/users?page=1",
                "label": "1",
                "active": true
            },
            {
                "url": "http://espbu.test/api/users?page=2",
                "label": "2",
                "active": false
            },
            {
                "url": "http://espbu.test/api/users?page=3",
                "label": "3",
                "active": false
            },
            {
                "url": "http://espbu.test/api/users?page=4",
                "label": "4",
                "active": false
            },
            {
                "url": "http://espbu.test/api/users?page=2",
                "label": "Berikutnya »",
                "active": false
            }
        ],
        "path": "http://espbu.test/api/users",
        "per_page": 10,
        "to": 10,
        "total": 31
    }
}
{
    "data": [
        {
            "id": 36,
            "name": "Dwi Cahyo Utomo,...",
            "email": "[email protected]",
            "role": {
                "id": 7,
                "name": "Owner"
            },
            "nik": "3129031092321321",
            "workstart": "08 Oktober 2023",
            "workleave": "08 Oktober 2023"
        },
        {
            "id": 37,
            "name": "Vedo Yustinevan,...",
            "email": "[email protected]",
            "role": {
                "id": 3,
                "name": "Admin Keuangan"
            },
            "nik": "3374152103920001",
            "workstart": "31 Januari 2023",
            "workleave": "31 Januari 2023"
        },
        {
            "id": 34,
            "name": "Auditor",
            "email": "[email protected]",
            "role": {
                "id": 6,
                "name": "Auditor"
            },
            "nik": "3310106357011231",
            "workstart": "07 November 2022",
            "workleave": "07 November 2022"
        },
        {
            "id": 35,
            "name": "Muhammad Galih P...",
            "email": "[email protected]",
            "role": {
                "id": 5,
                "name": "Operator"
            },
            "nik": "3374101706040003",
            "workstart": "07 Oktober 2022",
            "workleave": "06 Februari 2023"
        },
        {
            "id": 30,
            "name": "Sobirin",
            "email": "[email protected]",
            "role": {
                "id": 4,
                "name": "Kepala Shift"
            },
            "nik": "3314170904880003",
            "workstart": "30 Agustus 2022",
            "workleave": "30 Agustus 2022"
        },
        // and so on...
    ],
    "links": {
        "first": "http://espbu.test/api/users?page=1",
        "last": "http://espbu.test/api/users?page=4",
        "prev": null,
        "next": "http://espbu.test/api/users?page=2"
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 4,
        "links": [
            {
                "url": null,
                "label": "« Sebelumnya",
                "active": false
            },
            {
                "url": "http://espbu.test/api/users?page=1",
                "label": "1",
                "active": true
            },
            {
                "url": "http://espbu.test/api/users?page=2",
                "label": "2",
                "active": false
            },
            {
                "url": "http://espbu.test/api/users?page=3",
                "label": "3",
                "active": false
            },
            {
                "url": "http://espbu.test/api/users?page=4",
                "label": "4",
                "active": false
            },
            {
                "url": "http://espbu.test/api/users?page=2",
                "label": "Berikutnya »",
                "active": false
            }
        ],
        "path": "http://espbu.test/api/users",
        "per_page": 10,
        "to": 10,
        "total": 31
    }
}
403 Forbidden
json
{
    "message": "Unauthorized"
}
{
    "message": "Unauthorized"
}
404 Not Found
json
{
    "message": "Data tidak ditemukan",
    "data": []
}
{
    "message": "Data tidak ditemukan",
    "data": []
}

Used on pages

  • /users

Get Show User Endpoint

http
GET /users/{id}
GET /users/{id}

Headers

  • Content-Type: application/json
  • Authorization: Bearer {token}

Path Variable

NameTypeDescription
idintUser ID

Response

200 OK
json
{
    "message": "User ditemukan",
    "data": {
        "id": 8,
        "name": "Noviana setyoningrum",
        "email": "[email protected]",
        "roles": [
            {
                "id": 5,
                "text": "Operator"
            }
        ],
        "nip": "1997 12 23 005",
        "nik": "3321016312970002",
        "address": "Jamus",
        "sign": "http://espbu.test/images/1677738721-RK4wXXRYI2AQWqvBZr8JtzNpfmwl71wW.png",
        "workstart": "2022-05-21",
        "workleave": "2022-08-22",
        "workstart_idn": "21 Mei 2022",
        "workleave_idn": "22 Agustus 2022",
        "created_at_idn": "19 Agustus 2022 15:41",
        "updated_at_idn": "02 Maret 2023 13:32"
    }
}
{
    "message": "User ditemukan",
    "data": {
        "id": 8,
        "name": "Noviana setyoningrum",
        "email": "[email protected]",
        "roles": [
            {
                "id": 5,
                "text": "Operator"
            }
        ],
        "nip": "1997 12 23 005",
        "nik": "3321016312970002",
        "address": "Jamus",
        "sign": "http://espbu.test/images/1677738721-RK4wXXRYI2AQWqvBZr8JtzNpfmwl71wW.png",
        "workstart": "2022-05-21",
        "workleave": "2022-08-22",
        "workstart_idn": "21 Mei 2022",
        "workleave_idn": "22 Agustus 2022",
        "created_at_idn": "19 Agustus 2022 15:41",
        "updated_at_idn": "02 Maret 2023 13:32"
    }
}
403 Forbidden
json
{
    "message": "Unauthorized"
}
{
    "message": "Unauthorized"
}
404 Not Found
json
{
    "message": "User tidak ditemukan",
    "data": []
}
{
    "message": "User tidak ditemukan",
    "data": []
}

Used on pages

  • /users/show/{id}
  • /users/edit/{id}

Create User Endpoint

http
POST /users
POST /users

Headers

  • Content-Type: application/json
  • Authorization: Bearer {token}

Body

JSON Body
json
{
        "name": "Aw",
        "email": "[email protected]",
        "roles": 4,
        "nip": "20913809123",
        "nik": 3310160212389,
        "address": "Tembalang",
        "password": "Aa0Aa0",
        "roles": 4
}
{
        "name": "Aw",
        "email": "[email protected]",
        "roles": 4,
        "nip": "20913809123",
        "nik": 3310160212389,
        "address": "Tembalang",
        "password": "Aa0Aa0",
        "roles": 4
}
NameTypeDescriptionNullable
namestringUser Namefalse
emailstringUser Emailfalse
nipstringUser NIPtrue
nikstringUser NIKtrue
addressstringUser Addresstrue
workstartstringUser Work Start Datetrue
workleavestringUser Work Leave Datetrue
passwordstringUser Passwordfalse
rolesintUser Role IDfalse

Response

200 OK
json
{
  "message": "Berhasil menambahkan User"
}
{
  "message": "Berhasil menambahkan User"
}
403 Forbidden
json
{
    "message": "Unauthorized"
}
{
    "message": "Unauthorized"
}
422 Unprocessable Entity
json
{
    "message": "The given data was invalid.",
    "errors": {
        "email": [
            "The email has already been taken."
        ]
    }
}
{
    "message": "The given data was invalid.",
    "errors": {
        "email": [
            "The email has already been taken."
        ]
    }
}

Used on pages

  • /users/create

Update User Endpoint

http
PUT /users/{id}
PUT /users/{id}

Headers

  • Content-Type: application/json
  • Authorization: Bearer {token}

Path Variable

NameTypeDescription
idintUser ID

Body

JSON Body
json
{
  "name": "Awi",
  "email": "[email protected]",
  "roles": 4,
  "nip": "20913809123",
  "nik": 3310160212389,
  "address": "Tembalang",
  "password": "Aa0Aa0",
  "roles": 4
}
{
  "name": "Awi",
  "email": "[email protected]",
  "roles": 4,
  "nip": "20913809123",
  "nik": 3310160212389,
  "address": "Tembalang",
  "password": "Aa0Aa0",
  "roles": 4
}
NameTypeDescriptionNullable
namestringUser Namefalse
emailstringUser Emailfalse
nipstringUser NIPtrue
nikstringUser NIKtrue
addressstringUser Addresstrue
workstartstringUser Work Start Datetrue
workleavestringUser Work Leave Datetrue
passwordstringUser Passwordfalse
rolesintUser Role IDfalse

Response

200 OK
json
{
  "message": "Berhasil mengubah User"
}
{
  "message": "Berhasil mengubah User"
}
403 Forbidden
json
{
    "message": "Unauthorized"
}
{
    "message": "Unauthorized"
}
422 Unprocessable Entity
json
{
    "message": "The given data was invalid.",
    "errors": {
        "email": [
            "The email has already been taken."
        ]
    }
}
{
    "message": "The given data was invalid.",
    "errors": {
        "email": [
            "The email has already been taken."
        ]
    }
}

Used on pages

  • /users/edit/{id}

Delete User Endpoint

http
DELETE /users/{id}
DELETE /users/{id}

Headers

  • Content-Type: application/json
  • Authorization: Bearer {token}

Path Variable

NameTypeDescription
idintUser ID

Response

200 OK
json
{
  "message": "User berhasil diarsipkan"
}
{
  "message": "User berhasil diarsipkan"
}
403 Forbidden
json
{
    "message": "Unauthorized"
}
{
    "message": "Unauthorized"
}

Used on pages

  • /users

Get User Options Endpoint

http
GET /user/select
GET /user/select

Headers

  • Content-Type: application/json
  • Authorization: Bearer {token}

Response

200 OK
json
{
    "results": [
        {
            "id": 26,
            "text": "Achmad Arifin"
        },
        {
            "id": 14,
            "text": "Anis Fufah"
        },
        {
            "id": 19,
            "text": "Antok Novianto"
        },
        // and so on
    ]
}
{
    "results": [
        {
            "id": 26,
            "text": "Achmad Arifin"
        },
        {
            "id": 14,
            "text": "Anis Fufah"
        },
        {
            "id": 19,
            "text": "Antok Novianto"
        },
        // and so on
    ]
}
403 Forbidden
json
{
    "message": "Unauthorized"
}
{
    "message": "Unauthorized"
}

Used on pages

  • /tasks/create

Get Users Archive Index Endpoint

http
GET /users/onlytrashed
GET /users/onlytrashed

Headers

  • Content-Type: application/json
  • Authorization: Bearer {token}

Query Parameters

NameTypeDescriptionNullable
pageintPage numberfalse
search_namestringSearch by nametrue
search_roleintSearch by role IDtrue
search_globalstringSearch by global filtertrue
order_columnstringOrder by columntrue
order_directionstringOrder by directiontrue

Response

200 OK
json
{
    "data": [
        {
            "id": 40,
            "name": "operator",
            "email": "[email protected]",
            "nik": "1234567891011121",
            "workstart": "26 Februari 2023",
            "workleave": "31 Maret 2023"
        },
        {
            "id": 4,
            "name": "Mas Supet",
            "email": "[email protected]",
            "nik": "1111111111111111",
            "workstart": "19 Mei 2022",
            "workleave": "31 Agustus 2022"
        },
        // and so on
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "links": [
            {
                "url": null,
                "label": "« Sebelumnya",
                "active": false
            },
            {
                "url": "http://espbu.test/api/user/onlytrashed?page=1",
                "label": "1",
                "active": true
            },
            {
                "url": null,
                "label": "Berikutnya »",
                "active": false
            }
        ],
        "path": "http://espbu.test/api/user/onlytrashed",
        "per_page": 5,
        "to": 3,
        "total": 3
    }
}
{
    "data": [
        {
            "id": 40,
            "name": "operator",
            "email": "[email protected]",
            "nik": "1234567891011121",
            "workstart": "26 Februari 2023",
            "workleave": "31 Maret 2023"
        },
        {
            "id": 4,
            "name": "Mas Supet",
            "email": "[email protected]",
            "nik": "1111111111111111",
            "workstart": "19 Mei 2022",
            "workleave": "31 Agustus 2022"
        },
        // and so on
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "links": [
            {
                "url": null,
                "label": "« Sebelumnya",
                "active": false
            },
            {
                "url": "http://espbu.test/api/user/onlytrashed?page=1",
                "label": "1",
                "active": true
            },
            {
                "url": null,
                "label": "Berikutnya »",
                "active": false
            }
        ],
        "path": "http://espbu.test/api/user/onlytrashed",
        "per_page": 5,
        "to": 3,
        "total": 3
    }
}
403 Forbidden
json
{
    "message": "Unauthorized"
}
{
    "message": "Unauthorized"
}

Used on pages

  • /users/archive

Restore User Endpoint

http
PUT /user/restore/one/{id}
PUT /user/restore/one/{id}

Headers

  • Content-Type: application/json
  • Authorization: Bearer {token}

Path Variable

NameTypeDescription
idintUser ID

Response

200 OK
json
{
    "message": "User berhasil dipulihkan"
}
{
    "message": "User berhasil dipulihkan"
}
403 Forbidden
json
{
    "message": "Unauthorized"
}
{
    "message": "Unauthorized"
}

Used on pages

  • /users/archive

Released under the MIT License.