[2️] My Staff API
Retrieve data

How to retrieve data from a database

My Staff API allows you to retrieve data via HTTP requests. You can get all your registered employee data or the registered data from a specific employee record.


List all records data

Get all the registered employee data form your database.

  1. Run this GET request to list all your registered employee data.
curl --location 'https://dummy.restapiexample.com/api/v1/employees'
  1. You'll receive a response similar to this:
{
  "status": "success",
  "data": [
    {
      "id": 1,
      "employee_name": "Tiger Nixon",
      "employee_salary": 320800,
      "employee_age": 61,
      "profile_image": ""
    },
    {
      "id": 2,
      "employee_name": "Garrett Winters",
      "employee_salary": 170750,
      "employee_age": 63,
      "profile_image": ""
    },
    {
      "id": 3,
      "employee_name": "Ashton Cox",
      "employee_salary": 86000,
      "employee_age": 66,
      "profile_image": ""
    }
  ],
  "message": "Successfully! All records has been fetched."
}

Retrieve data from a record

  1. Run this GET request to list all your registered employee data.
curl --location 'https://dummy.restapiexample.com/api/v1/employees'
  1. You'll receive a response similar to this:
{
  "status": "success",
  "data": [
    {
      "id": 1,
      "employee_name": "Tiger Nixon",
      "employee_salary": 320800,
      "employee_age": 61,
      "profile_image": ""
    },
    {
      "id": 2,
      "employee_name": "Garrett Winters",
      "employee_salary": 170750,
      "employee_age": 63,
      "profile_image": ""
    },
    {
      "id": 3,
      "employee_name": "Ashton Cox",
      "employee_salary": 86000,
      "employee_age": 66,
      "profile_image": ""
    }
  ],
  "message": "Successfully! All records has been fetched."
}
  1. Copy the id for the record you want obtain the information.
  2. Run this GET request to retrieve all the registered data from a specific employee record.
curl --location 'https://dummy.restapiexample.com/api/v1/employee/<id>'

💡 Replace <id> for the ID of your employee in your database.

  1. You'll receive a response similar to this:
{
    "status": "success",
    "data": {
        "id": 3,
        "employee_name": "Ashton Cox",
        "employee_salary": 86000,
        "employee_age": 66,
        "profile_image": ""
    },
    "message": "Successfully! Record has been fetched."
}