3. Uploading New Employees via API

Uploading NEW Employees to Go2Clock Instance


To upload new employees you will need to send a PUT request to the Go2Clock server.

The web address format you are going to send in is as follows...

Base URL format: app.go2clock.com/api/employees/  


Header Authentication Parameter: APIKEY=xxxxxxxxxxx  This must match the API key value in Go2Clock instance Settings > API key.

Body: Is made up of JSON. The employees_put method reads raw JSON data ($this->input->raw_input_stream) instead of URL-encoded input.

for example...

[
{
"userid": "1",
"name": "John Doe",
"email": "john.doe@example.com",
"mobilenumber": "1234567890",
"deptname": "HR",
"tradename": "Trade 1",
"payrollno": "P001",
"photo": "https://someurl/image1.jpg",
"shiftmon": "8-4",
"totalot": 5,
"totalut": 2,
"peoplehr_employeeid": "PHR001",
"start_date": "2024-01-01",
"termination_date": null
},
{
"userid": "2",
"name": "Jane Smith",
"email": "jane.smith@example.com",
"mobilenumber": "9876543210",
"deptname": "IT",
"tradename": "Trade 2",
"payrollno": "P002",
"photo": "https://someurl/image2.jpg",
"shiftfri": "6-10",
"totalot": 3,
"peoplehr_employeeid": "PHR002",
"start_date": "2023-11-15",
"termination_date": null
}
]

The allowed fields

userid - Unique identifier for the user, Required, Integer, Max Length: 20

name - Full name of the user, Required, Max Length: 255

email - Email address Valid Email, Max Length: 100

password - Password for login, Max Length: 50

login_view - Login view setting Integer, Allowed Values: 0, 1, 2, 3, 4, 5, 6

mgflag - Manager flag, Integer Allowed Values: 0, 1

mobilenumber - Mobile phone number, Max Length: 20

shiftmon - Shift for Monday, Max Length: 255

shifttue - Shift for Tuesday, Max Length: 255

shiftwed - Shift for Wednesday, Max Length: 255

shiftthu - Shift for Thursday, Max Length: 255

shiftfri - Shift for Friday, Max Length: 255

shiftsat - Shift for Saturday, Max Length: 255

shiftsun - Shift for Sunday, Max Length: 255

rotaswitch - Rota switch flag, Integer, Allowed Values: 0, 1

tagswitch - Tag switch flag, Integer Allowed Values: 0, 1

tagstateswitch - Tag state switch flag, Integer Allowed Values: 0, 1

totalot - Total overtime, Numeric

totalut - Total undertime, Numeric

deptname - Department name, Max Length: 255

tradename - Trade name, Max Length: 255

payrollno - Payroll number, Max Length: 50

photo - Photo URL, Max Length: 65535

sageref - Sage reference, Max Length: 50

sagerefot - Sage reference overtime, Max Length: 50

sagerefdt - Sage reference double-time, Max Length: 50

sagerefsick - Sage reference sick time, Max Length: 50

payrate - Pay rate, Numeric

payrateot - Pay rate overtime, Numeric

payratedt - Pay rate double-time, Numeric

payratecustom - Custom pay rate, Numeric

payratecumulative - Cumulative pay rate, Max Length: 50

hourlypay - Hourly pay , Numeric

trade - Trade details, Max Length: 100

employee_type - Type of employment, Max Length: 100

max_hours_week - Maximum weekly hours, Numeric

max_hours_day - Maximum daily hours, Numeric

peoplehr_employeeid - PeopleHR employee ID, Max Length: 50

sagehr_employeeno - SageHR employee number, Max Length: 50

holiday_total_allowed - Total allowed holiday hours, Numeric

role_manager - Manager role flag Integer, Allowed Values: 0, 1

role_supervisor - Supervisor role flag, Integer, Allowed Values: 0, 1

role_first_aider - First aider role flag, Integer, Allowed Values: 0, 1

role_safety_manager - Safety manager role flag, Integer, Allowed Values: 0, 1

role_employee - Employee role flag, Integer, Allowed Values: 0, 1

role_apprentice - Apprentice role flag, Integer, Allowed Values: 0, 1

role_agency_staff - Agency staff role flag, Integer, Allowed Values: 0, 1

role_subcontractor - Subcontractor role flag, Integer, Allowed Values: 0, 1

role_fire_warden - Fire warden role flag, Integer, Allowed Values: 0, 1

start_date - Employment start date, Valid Date (Format: YYYY-MM-DD)

termination_date - Employment termination date, Valid Date (Format: YYYY-MM-DD)

termination_reason - Reason for termination, Max Length: 65535

date_of_birth - Date of birth, Valid Date (Format: YYYY-MM-DD)

home_phone - Home phone number, Max Length: 20

home_address - Home address, Max Length: 65535

emergency_contacts - Emergency contact details, Max Length: 65535

pwd - Password for the clock device, Max Length: 20

idcard - ID Card number for clock device, Max Length: 20


Server Responses

The server will respond with an array of key values to indicate if successful or not, below are some examples...

{
"status": "success",
"results": [
{
"userid": "1",
"status": "success"
},
{
"userid": "2",
"status": "failure",
"errors": {
"email": "The Email field must contain a valid email address."
}
}
]
}
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us