Introduction

TimesheetMobile Time Tracking Software API is a REST based set of endpoints designed to be easily accessed and used to integrate third party applications to exchange employee, customer, task, and timesheet data

Authentication

TimesheetMobile APIs uses the OAuth 2.0 protocol for authentication and authorization. OAuth2 is an authorization framework that enables applications to obtain limited access to user accounts over HTTP. This method creates a token that lasts for 1 hour to keep your account secure and connected

To begin, obtain OAuth 2.0 client credentials by enabling TimesheetMobile APIs in Add-Ons of your TimesheetMobile Account which leads to access for a link (TimesheetMobile APIs) in sidebar. This page contains OAuth 2.0 credentials such as a client id and client secret.

Define redirect URIs: Under the credentials, you can define one or more redirect URIs. These URIs handle responses from the OAuth 2.0 server and are called after the user authorizes the connection. URIs in this list are the only ones to which the authorization response can be sent from the OAuth 2.0 server. You must define at least one URI specifically for your application’s auth endpoint before you can use OAuth 2.0. For the sandbox environment, this list can include localhost.

Obtain the access token Before your application can access data using TimesheetMobile API, it must obtain an access token that grants access to the API. A single access token can grant access to multiple APIs.

Obtaining the token requires an authentication step where the user logs in with their TimesheetMobile account. After login success, the TimesheetMobile Authorization Server sends your application an authorization code at the callback endpoint that you defined in the Redirect URL section of your app. This authorization code can be exchanged to obtain the access token. Check below for steps to follow

Step 1: Prepare authorization request

Your first step is to create the authorization request with the parameters that identify your application.Check Authentication request api below

Step 2: Redirect to TimesheetMobile OAuth 2.0 server

Redirect the user to TimesheetMobile's OAuth 2.0 server using the URL prepared above to initiate the authentication and authorization process. This step is required when your application first needs to access user’s data.

Step 3: TimesheetMobile prompts user for login

In this step, the user decides whether to grant your application the requested access.If user successfully login, the page redirect to your redirect url with an code parameter

Step 4: Exchange authorization code for refresh and access tokens

After the app receives the authorization code, it should exchange the authorization code for refresh and access tokens. check Exchange Authorization code api below

Authentication Request

https://admin.timesheetmobile.com/TBA/oauth/connect.php

Required Parameters
client_id Required. Identifies which instance is making the request. Obtain this value from the Outh tab on the TimesheetMobile app
client_secret Required. Obtain this value from the Outh tab on the TimesheetMobile app
redirect_uri Required. Determines where the API server redirects the user after the user completes the authorization flow. The value of this parameter must exactly match with the value in the app. IP addresses are not allowed for redirect URI
response_type Required. Determines whether the TimesheetMobile OAuth 2.0 endpoint returns an authorization code. Always set this to code
state Required. Specifies any string value that your application uses to maintain state between your authorization request and the authorization server’s response
Example Request

    curl --location --request GET 'https://admin.timesheetmobile.com/TBA/oauth/connect.php?client_id=TBA&client_secret=xxxx&redirect_uri=http://localhost/tsm_client/callback.php&response_type=code&state=GSLV'
                            


Exchange Authorization code

https://admin.timesheetmobile.com/TBA/oauth/token.php

Required Parameters
grant_type Required. As defined in the OAuth 2.0 specification, this field must contain a value of authorization_code
code Required. The authorization code returned from the initial request
client_id Required
client_secret Required
redirect_uri Required
Response Data
access_token The token that must be used to access the TimesheetMobile APIs
refresh_token A token used when refreshing the access token
expires_in The remaining lifetime of the access token in seconds. The value always returned is 3600 seconds (1 hour). Use the refresh token to get a fresh one
token_type Identifies the type of token returned. At this time, this field will always have the value Bearer
Success Request

    curl --location --request POST 'https://admin.timesheetmobile.com/TBA/oauth/token.php' \
    --form 'grant_type=refresh_token' \
    --form 'refresh_token=794ef02aa53872d9b69d49ee5261xxxxxxxx' \
    --form 'client_id=TBA' \
    --form 'client_secret=xxxx' \
    --form 'redirect_uri=http://localhost/tsm_client/callback.php'
                            

Success Response

    {
        "access_token":"606f3f9fa24fd6cc9bf7c7fe2defa8e5cc9858e4",
        "expires_in":43200,
        "token_type":"Bearer",
        "refresh_token":"460267282dfbbaab06ceb78380dbbf483131ff12"
    }
                            

Tokens

Understand token expiration

Access tokens are valid for 1 hour, after which you need to get a new one using the latest refresh_token returned to you from the previous request. You must write your code to anticipate the possibility that a granted access token might no longer work.

As a reminder, you pass the 1-hour access token in the Authorization header with every API request, such as when you query Test API. You only use the refresh token to mint a new 1-hour access token when the prior access token expires. The refresh token itself can last up to 100 days before it expires, and then the user needs to sign in again or you can get a new one programmatically using the Refresh Token API before the 100-day refresh token expires. Keep in mind that a refresh token is only for getting new (i.e., “refreshing”) access tokens; you can’t pass a refresh token for requests.

Note

Even though the refresh token is valid for 100 days, the value of refresh token can change in around a day. Hence, you might encounter a situation where the request token that you received first is different than the latest one. As a best practice, always store the latest refresh token received from the API response and use that to make subsequent calls to obtain a new pair of tokens.

An access token might stop working for one of these reasons:

The user has revoked your app’s access: If a user revokes connection to the TimesheetMobile, the access token and refresh token are invalidated. When this happens, your app must ask the user to reauthorize the connection as in Step 1.

The access token has been expired: If the access token is past one hour you will receive a error while making a TimesheetMobile API call. When this happens, you must request for new token using the refresh token that you received last.

The refresh token has not been used for 100 days: The lifetime of refresh token is 100 days. When this happens, your app must ask the user to reauthorize the connection as in Step 1.

Refresh Token

https://admin.timesheetmobile.com/TBA/oauth/token.php

Access tokens periodically expire. You can refresh an access token without prompting the user for permission.

To refresh an access token, your application sends an HTTPS POST request to TimesheetMobile's authorization server that includes the following parameters

Request Parameters
grant_type Required. As defined in the OAuth 2.0 specification, this field must contain a value of refresh_token
refresh_token Required. The refresh token returned from the authorization code exchange / lastly generated refresh token
client_id Required
client_secret Required
redirect_uri Required
Response Data
access_token The token that must be used to access the TimesheetMobile APIs
refresh_token A token used when refreshing the access token
expires_in The remaining lifetime of the access token in seconds. The value always returned is 43200 seconds (12 hours). Use the refresh token to get a fresh one
token_type Identifies the type of token returned. At this time, this field will always have the value Bearer
Success Request

    curl --location --request POST 'https://admin.timesheetmobile.com/TBA/oauth/token.php' \
    --form 'grant_type=refresh_token' \
    --form 'refresh_token=794ef02aa53872d9b69d49ee5261xxxxxxxx' \
    --form 'client_id=TBA' \
    --form 'client_secret=xxxx' \
    --form 'redirect_uri=http://localhost/tsm_client/callback.php'
                                

Success Response

    {
        "access_token": "c8a469ee31c8a0503b89616f89472f5xxxxxx",
        "expires_in": 3600,
        "token_type": "Bearer",
        "scope": null,
        "refresh_token": "7d4584da664766d6841ab77d57219exxxxxxxa"
    }
                                


Revoke Token / Disconnect

https://admin.timesheetmobile.com/TBA/oauth/disconnect

Use the revoke api to request permissions granted to the application to be removed

Request Parameter
refresh_token Required. The refresh token returned from the authorization code exchange / lastly generated refresh token

Note

Once disconnected, your app must ask the user to reauthorize the connection as in Step 1

Success Request

    curl --location --request POST 'https://admin.timesheetmobile.com/TBA/oauth/disconnect' \
    --header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258' \
    --form 'refresh_token=d1af20d2440b7d09dd6606c94cd6185acd8c654b'
                                

Success Response

    {
        "code": 200,
        "status": "success",
        "message": "Disconnected"
    }
                                

Http Response Codes

Success Code

200 “OK”

Returned when a operation is successful. Operation may be GET, POST & DELETE.

Error Codes

400 “Bad Request”

Returned when providing input during a GET / POST operation which would leave the resource in an incomplete or inconsistent state. The provided input is nonsensical or corrupt.

Example: Providing an alphabetic value of “abcd” for an integer parameter, such as “offset”.

401 “Unauthorized”

Returned when trying to operate on a protected resource without providing the proper authorization token.

404 “Not Found”

The server can not find the requested resource.

Example: Trying to retrieve a non-existing user.

405 “Method Not Allowed”

Returned when the client tries to use an Invalid HTTP method or Invalid request.

Example: Trying to PUT a read-only resource or invalid Api request.

409 “Conflict”

Returned when providing input during a GET / POST operation which would cause the resource state to conflict with some other resource.

Example: Trying to change the employee number to a number that’s already taken.

500 “Internal Server Error”

There is a problem on the server side.

Account Apis

Employee Api

An Employee object represents a person working for the company. The full complement of read, create, delete operations are available


List Employees

https://admin.timesheetmobile.com/TBA/oauth/employee/list

Success Request

    curl --location --request GET 'https://admin.timesheetmobile.com/TBA/oauth/employee/list' \
    --header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258'
                            

Success Response

    {
        "code": 200,
        "status": "success",
        "message": "OK",
        "data": [
            {
            "employee_number": "1",
            "employee_first_name": "Bob",
            "employee_last_name": "Drainville",
            "employee_phone": "123456789",
            "location_option": "Log in 2020-04-01 10:00:00",
            "payroll_item": "Sick",
            "ot_payroll_item": "",
            "workgroup": [
                "Admin",
                "Owner"
            ],
            "manager": "Manager",
            "email": "[email protected]"
            },
            {
            "employee_number": "2",
            "employee_first_name": "Eric",
            "employee_last_name": "reed",
            "employee_phone": "123456789",
            "location_option": "Log out 2020-04-01 07:12:00",
            "payroll_item": "",
            "ot_payroll_item": "",
            "workgroup": "admin",
            "manager": "Manager",
            "email": "[email protected]"
            },
            {
            "employee_number": "3",
            "employee_first_name": "Uday",
            "employee_last_name": "Kiran",
            "employee_phone": "123456789",
            "location_option": "Log out 2020-04-01 15:00:00",
            "payroll_item": "",
            "ot_payroll_item": "",
            "workgroup": [
                "Developer"
            ],
            "manager": "NO",
            "email": "[email protected]"
            },
            {
            "employee_number": "4",
            "employee_first_name": "Syed",
            "employee_last_name": "Mohiddin",
            "employee_phone": "123456789",
            "location_option": "Log out 2020-04--07 15:54:00",
            "payroll_item": "",
            "ot_payroll_item": "",
            "workgroup": [
                "Developer"
            ],
            "manager": "NO",
            "email": "[email protected]"
            }
        ]
    }
                            


Get Single Employee

https://admin.timesheetmobile.com/TBA/oauth/employee/4(employee number)

Success Request

    curl --location --request GET 'https://admin.timesheetmobile.com/TBA/oauth/employee/4' \
    --header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258'
                            

Success Response

    {
        "code": 200,
        "status": "success",
        "message": "OK",
        "data": {
            "employee_number": "4",
            "employee_first_name": "Syed",
            "employee_last_name": "Mohiddin",
            "employee_phone": "123456789",
            "location_option": "Log out 2020-04-01 4:12 pm",
            "payroll_item": "",
            "ot_payroll_item": "",
            "workgroup": "Developer",
            "manager": "No",
            "email": "[email protected]"
        }
    }
                            


Create Single Employee

https://admin.timesheetmobile.com/TBA/oauth/employee/add

The elements to create an Employee object are listed here

Arguments
Request Parameters Description Example
emp_id   ID of the Employee 2 (if not provided, automatically takes next employee id)
first_name *   First Name of the Employee John
last_name Last Name of the Employee Doe
phone_num Phone number of the Employee 8866541559
code Country code of the phone number 96
manager  Whether employee is manager or non-manager 1 or 0
email * Email of the Employee [email protected]
workgroup * Work group of the Employee Single: Construction Multiple: painting,testing
payrollitem Payroll of Employee Hourly
otpayrollitem Overtime payroll of Employee OTHourly
job_assign Assign emp for all or none or multiple jobs Default : all Multiple : 314, 315, 564 None : none

* required fields      *Conditional required fields when manager value is 1

Success Request

    curl --location --request POST 'https://admin.timesheetmobile.com/TBA/oauth/employee/add' \
    --header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258' \
    --form 'first_name=Shawn' \
    --form 'last_name=Micheals' \
    --form 'phone_num=123456789' \
    --form '[email protected]' \
    --form 'workgroup=Developer'
                            

Success Response

    {
        "code": 200,
        "status": "success",
        "message": "Employee added"
    }
                            


Update Single Employee

https://admin.timesheetmobile.com/TBA/oauth/employee/update/1(employee number)

Arguments
Request Parameters Description Example
newempid New ID of the Employee 11
first_name First Name of the Employee Adam
last_name Last Name of the Employee Daly
phone_num Phone number of the Employee 5545412416
code Country code of the phone number 96
manager Whether employee is manager or non-manager 1 or 0
email * Email of the Employee [email protected]
workgroup * Work group of the Employee Single: Construction Multiple: painting,testing
workgroup_append If yes, Append given workgroup without deleting previous assigned workgroups. If no, Append given workgroup by deleting previous assigned workgroups. Default : yes no
payrollitem Payroll of Employee Hourly
otpayrollitem Overtime payroll of Employee Hourly1.5
job_assign Assign all jobs to Employee ALL : all Multiple : 314, 315, 564 None : none
job_append If yes, Append given job ids without deleting previous assigned jobs. If no, Append given job ids by deleting previous assigned jobs Default : yes no

* required fields      *Conditional required fields when manager value is 1

Success Request

    curl --location --request POST 'https://admin.timesheetmobile.com/TBA/oauth/employee/update/1' \
    --header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258' \
    --form 'phone_num=9999533333'
                            

Success Response

    {
        "code": 200,
        "status": "success",
        "message": "Employee updated"
    }
                            


Delete Single Employee

https://admin.timesheetmobile.com/TBA/oauth/employee/delete/6(employee number)

Success Request

    curl --location --request DELETE 'https://admin.timesheetmobile.com/TBA/oauth/employee/delete/6' \
    --header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258'
                            

Success Response

    {
        "code": 200,
        "status": "success",
        "message": "Employee deleted"
    }
                            

Job Api

List Jobs

https://admin.timesheetmobile.com/TBA/oauth/job/list

Success Request

    curl --location --request GET 'https://admin.timesheetmobile.com/TBA/oauth/job/list' \
    --header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258'
                                

Success Response

    {
        "code": 200,
        "status": "success",
        "message": "OK",
        "data": [
            {
                "job_number": "1",
                "job_name": "spgons",
                "job_phone": "123456789",
                "service_item": "Service'",
                "billable": "NO",
                "street": "& Other Stories, Broadway",
                "city": "New York",
                "zip": "Atlantic",
                "state": "NY",
                "latitude": "40.72452880",
                "longitude": "-73.99775300",
                "GEO_Fence": "322",
                "info": "& http://google.com hello  "
            },
            {
                "job_number": "2",
                "job_name": "Designing",
                "job_phone": "123456789",
                "service_item": "Design Labor",
                "billable": "NO",
                "street": "San's Boutique Hotel & Suites, Al Henderson Boulevard",
                "city": "Savannah",
                "zip": "",
                "state": "GA",
                "latitude": "32.00758160",
                "longitude": "-81.27613090",
                "GEO_Fence": "322",
                "info": "571"
            }
            ....
        ]
    }
                            


Get Single Job

https://admin.timesheetmobile.com/TBA/oauth/job/2(job number)

Success Request

    curl --location --request GET 'https://admin.timesheetmobile.com/TBA/oauth/job/2' \
    --header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258'
                            

Success Response

    {
        "code": 200,
        "status": "success",
        "message": "OK",
        "data": {
            "job_number": "2",
            "job_name": "Designing",
            "job_phone": "123456789",
            "service_item": "Design Labor",
            "billable": "NO",
            "street": "San's Boutique Hotel & Suites, Al Henderson Boulevard",
            "city": "Savannah",
            "zip": "",
            "state": "GA",
            "latitude": "32.00758160",
            "longitude": "-81.27613090",
            "GEO_Fence": "322",
            "info": "571"
        }
    }
                            


Add Single Job

https://admin.timesheetmobile.com/TBA/oauth/job/add
Request Parameters Description Example
jid ID of the Job 2 (if not provided, automatically takes next job id)
jname Name of the Job Main St. Remodeling
phone_num Phone number of the Job 9655412471
code Country code of the phone number 96
street Street of the Job 13th Ave
city City of the Job Boston
state State of the Job MA
latitude Latitude point of the Job 12.200233
longitude Longitude point of the Job 70.12121
service_item Service electrical
billable Billable YES or NO
radius Geo fence radius of the Job 321
time_zone Time zone ALASKA
emp_assign Assign job to all or none or multiple employee Default : all Multiple: 10,12,14 None: none
task_assign Assign all tasks or none or multiple tasks to job ALL : all Multiple: 3,4,5 None: none
Success Request

    curl --location --request POST 'https://admin.timesheetmobile.com/TBA/oauth/job/add' \
    --header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258' \
    --form 'jname=Api Tesing Job 3' \
    --form 'phone_num=9999999912'
                                

Success Response

    {
        "code": 200,
        "status": "success",
        "message": "Job added"
    }
                                


Update Single Job

https://admin.timesheetmobile.com/TBA/oauth/job/update/4(job number)
Request Parameters Description Example
newjid New ID of the Job 11
jname Name of the Job Lincoln School Roof
phone_num Phone number of the Job 9655412471
code Country code of the phone number 96
street Street of the Job 13th Ave
city City of the Job Boston
state State of the Job MA
latitude Latitude point of the Job 12.200233
longitude Longitude point of the Job 70.12121
service_item Service Class
billable Billable YES or NO
radius Geo fence radius of the Job 321
time_zone Time zone ALASKA
emp_assign Assign job to all or none or multiple employee Default : all Multiple: 10,12,14 None: none
emp_append If yes, Append given employee ids without deleting previous assigned employees. If no, Append given employee ids by deleting previous assigned employees. Default : yes no
task_assign Assign all or none or multiple tasks to the job ALL : all Multiple: 3,4,5 None: none
task_append If yes, Append given taks ids without deleting previous assigned tasks. If no, Append given tasks ids by deleting previous assigned tasks. Default : yes no
Success Request

    curl --location --request POST 'https://admin.timesheetmobile.com/TBA/oauth/job/update/4' \
    --header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258' \
    --form 'jname=Api test one'
                                

Success Response

    {
        "code": 200,
        "status": "success",
        "message": "Job updated"
    }
                            


Delete Single Job

https://admin.timesheetmobile.com/TBA/oauth/job/delete/5(job number)

Success Request

    curl --location --request DELETE 'https://admin.timesheetmobile.com/TBA/oauth/job/delete/5' \
    --header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258'
                            

Success Response

    {
        "code": 200,
        "status": "success",
        "message": "Job deleted"
    }
                            


Change Job Status

https://admin.timesheetmobile.com/TBA/oauth/job/change/#id/#status
#id Required. job number
#status Required. active / inactive
Success Request

    curl --location --request GET 'https://admin.timesheetmobile.com/TBA/oauth/job/change/2/inactive' \
    --header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258'
                            

Success Response

    {
        "code": 200,
        "status": "success",
        "message": "Job Inactive"
    }
                            

Task Api

List Tasks

https://admin.timesheetmobile.com/TBA/oauth/task/list

Success Request

    curl --location --request GET 'https://admin.timesheetmobile.com/TBA/oauth/task/list' \
    --header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258'
                            

Success Response

    {
        "code": 200,
        "status": "success",
        "message": "OK",
        "data": [
            {
            "task_number": "1",
            "task_name": "Maintainence",
            "service_item": "",
            "class": "",
            "payroll_item": "",
            "ot_payroll_item": "",
            "ot_payroll_item2": "",
            "ListID": null,
            "EditSequence": null
            },
            {
            "task_number": "2",
            "task_name": "Development",
            "service_item": "",
            "class": "abc",
            "payroll_item": "www",
            "ot_payroll_item": "",
            "ot_payroll_item2": "",
            "ListID": null,
            "EditSequence": null
            }
        ]
    }
                            


Get Single Task

https://admin.timesheetmobile.com/TBA/oauth/task/1(task number)

Success Request

    curl --location --request GET 'https://admin.timesheetmobile.com/TBA/oauth/task/1' \
    --header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258'
                            

Success Response

    {
        "code": 200,
        "status": "success",
        "message": "OK",
        "data": {
            "task_number": "2",
            "task_name": "Development",
            "service_item": "",
            "class": "abc",
            "payroll_item": "www",
            "ot_payroll_item": "",
            "ot_payroll_item2": "",
            "ListID": null,
            "EditSequence": null
        }
    }
                            


Add Single Task

https://admin.timesheetmobile.com/TBA/oauth/task/add
Request Parameters Description Example
tid ID of the Task 2 (if not provided, automatically takes next task id)
tname * Name of the Task roofing
service_item Name of service item roofing
class Name of Class labor contract
job_assign Assign task for all or none or multiple jobs ALL : all Multiple : 10, 12, 14 None : none

* Required fields.

Success Request

    curl --location --request POST 'https://admin.timesheetmobile.com/TBA/oauth/task/add' \
    --header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258' \
    --form 'tname=Api Security'
                            

Success Response

    {
        "code": 200,
        "status": "success",
        "message": "Task added"
    }
                            


Update Single Task

https://admin.timesheetmobile.com/TBA/oauth/task/update/4(task number)
Request Parameters Description Example
tname Name of the Task security guard
newtid New ID of the task 6
class Name of Class security
service_item Name of service item servicetest
job_assign Assign task to all jobs ALL : all Multiple : 10, 12, 14 None : none
job_append If yes, Append given job ids without deleting previous assigned jobs. If no, Append given job ids by deleting previous assigned jobs Default : yes no
Success Request

    curl --location --request POST 'https://admin.timesheetmobile.com/TBA/oauth/task/update/4' \
    --header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258' \
    --form 'tname=Api Maintenance'
                            

Success Response

    {
        "code": 200,
        "status": "success",
        "message": "Task updated"
}
                            


Delete Single Task

https://admin.timesheetmobile.com/TBA/oauth/task/delete/2(task number)

Success Request

    curl --location --request DELETE 'https://admin.timesheetmobile.com/TBA/oauth/task/delete/2' \
    --header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258'
                            

Success Response

    {
        "code": 200,
        "status": "success",
        "message": "Task deleted"
    }
                            

Workgroup Api

List Workgroups

https://admin.timesheetmobile.com/TBA/oauth/workgroup/list

Success Request

curl --location --request GET 'https://admin.timesheetmobile.com/TBA/oauth/workgroup/list' \
--header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258'
                            

Success Response

    {
        "code": 200,
        "status": "success",
        "message": "OK",
        "data": [
            {
            "id": "1",
            "workgroup": "developer"
            },
            {
            "id": "2",
            "workgroup": "android"
            },
            {
            "id": "3",
            "workgroup": "designer"
            },
            {
            "id": "4",
            "workgroup": "security"
            },
            {
            "id": "5",
            "workgroup": "maintenance"
            }
        ]
    }
                            


Get Single Workgroup

https://admin.timesheetmobile.com/TBA/oauth/workgroup/2(workgroup id)

Success Request

    curl --location --request GET 'https://admin.timesheetmobile.com/TBA/oauth/workgroup/2' \
    --header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258'
                            

Success Response

    {
        "code": 200,
        "status": "success",
        "message": "OK",
        "data": [
            {
            "id": "2",
            "workgroup": "android"
            }
        ]
    }
                            


Add Single Workgroup

https://admin.timesheetmobile.com/TBA/oauth/workgroup/add
Request Parameters Description Example
gid * ID of the Workgroup 2
gname * Name of the Workgroup Plumbers

* required fields

Success Request

    curl --location --request POST 'https://admin.timesheetmobile.com/TBA/oauth/workgroup/add' \
    --header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258' \
    --form 'gid=11' \
    --form 'gname=Workgroup one'
                            

Success Request

    {
        "code": 200,
        "status": "success",
        "message": "Workgroup added"
    }
                            


Update Single Workgroup

https://admin.timesheetmobile.com/TBA/oauth/workgroup/update/11(workgroup id)
Request Parameters Description Example
gname * Name of the Workgroup Electricians
new_gid New ID of the workgroup 6
Success Request

    curl --location --request POST 'https://admin.timesheetmobile.com/TBA/oauth/workgroup/update/11' \
    --header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258' \
    --form 'gname=Api Workgroup'
                            

Success Response

    {
        "code": 200,
        "status": "success",
        "message": "Workgroup updated"
    }
                            


Delete Single Workgroup

https://admin.timesheetmobile.com/TBA/oauth/workgroup/delete/11(workgroup id)

Success Request

    curl --location --request DELETE 'https://admin.timesheetmobile.com/TBA/oauth/workgroup/delete/11' \
    --header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258'
                            

Success Response

    {
        "code": 200,
        "status": "success",
        "message": "Workgroup deleted"
    }
                            


Schedule Api

List Schedules

https://admin.timesheetmobile.com/TBA/oauth/schedule/list

Success Request

    curl --location --request GET 'https://admin.timesheetmobile.com/TBA/oauth/schedule/list' \
    --header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258'
                            

Success Response

    {
        "code": 200,
        "status": "success",
        "message": "OK",
        "data": [
            {
                "schedule_id": "1",
                "emp_id": "5",
                "job_id": "0",
                "task_id": "0",
                "start_date": "",
                "end_datetime": "",
                "event_info": "",
                "status": "",
                "hours_count": "0.5",
                "created_by": "spgon",
                "created_at": "",
                "instance_id": "469",
                "publish": "1",
                "event_type": "2",
                "local_alert": "1",
                "pto_id": "0"
            },
            {
                "schedule_id": "614",
                "emp_id": "7",
                "job_id": "0",
                "task_id": "0",
                "start_date": "",
                "end_datetime": "",
                "event_info": "",
                "status": "",
                "hours_count": "0.5",
                "created_by": "spgon",
                "created_at": "",
                "instance_id": "470",
                "publish": "1",
                "event_type": "2",
                "local_alert": "1",
                "pto_id": "0"
            }
            ....
        ]
    }
                            


Get Single Schedule

https://admin.timesheetmobile.com/TBA/oauth/schedule/613(schedule id)

Success Request

    curl --location --request GET 'https://admin.timesheetmobile.com/TBA/oauth/schedule/613' \
    --header 'Authorization: 2793f35033855f6cce4f397b8edf4e3306e07258'
                            

Success Response

    {
        "code": 200,
        "status": "success",
        "message": "OK",
        "data": {
            "schedule_id": "1",
            "emp_id": "5",
            "job_id": "0",
            "task_id": "0",
            "start_date": "",
            "end_datetime": "",
            "event_info": "",
            "status": "",
            "hours_count": "0.5",
            "created_by": "spgon",
            "created_at": "",
            "instance_id": "469",
            "publish": "1",
            "event_type": "2",
            "local_alert": "1",
            "pto_id": "0"
        }
    }
                            


Add Single Schedule

https://admin.timesheetmobile.com/TBA/oauth/schedule/add
Request Parameters Description Example
emp_id * Ids of the employees 12,13,14
jid Job Id 10
tid Task ID 6
start_date * Event Start date & time 2018-07-20 09:00:00
end_date * Event End date & time 2018-07-20 11:00:00

* required fields

Success Request

    curl --location --request POST 'https://admin.timesheetmobile.com/TBA/oauth/schedule/add' \
    --header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258' \
    --form 'emp_id=8' \
    --form 'start_date=2020-03-01 06:00:00' \
    --form 'end_date=2020-03-01 11:00:00'
                            

Success Request

    {
        "code": 200,
        "status": "success",
        "message": "Schedule added"
    }
                            


Update Single Schedule

https://admin.timesheetmobile.com/TBA/oauth/schedule/update/2(schedule id)
Request Parameters Description Example
emp_id* Employee ID* 11195
jid Job Id 10
tid Task ID 10
start_date * Event Start date & time 2018-07-20 09:00:00
end_date * Event End date & time 2018-07-20 11:00:00

* required fields

Success Request

    curl --location --request POST 'https://admin.timesheetmobile.com/TBA/oauth/schedule/update/2' \
    --header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258' \
    --form 'emp_id=7' \
    --form 'start_date=2020-04-02 09:00:00' \
    --form 'end_date=2020-04-02 11:00:00'
                            

Success Response

    {
        "code": 200,
        "status": "success",
        "message": "Schedule Updated"
    }
                            


Delete Single Schedule

https://admin.timesheetmobile.com/TBA/oauth/schedule/delete/#id/#emp_id
#id Required. Schedule id
#emp_id required. Employee number
Success Request

    curl --location --request DELETE 'https://admin.timesheetmobile.com/TBA/oauth/schedule/delete/24/7' \
    --header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258'
                            

Success Response

    {
        "code": 200,
        "status": "success",
        "message": "Schedule deleted"
    }
                            

Report Api

https://admin.timesheetmobile.com/TBA/oauth/report
Request Parameters Description Syntax Example
from_date * From which date you want to start the report Accepted Date Format mm/dd/yyyy 01/03/2015
to_date * To which date you want to run the report Accepted Date Format mm/dd/yyyy 10/25/2015
employees Number of the corresponding employee Employee Number If no employee number given report for all employees will be generated
Default: All
32
jobs Number of the corresponding job Job Number if report required for single job
Default: All
21
rounding_time Accepted values: * off * 15 * 30
Default : Set by Admin
15
time_format In what way you want display the time format Accepted values: * hh:mm * decimal
Default: Set by Admin
hh:mm
report_type Report type is for to split the records based on the report_type option Accepted values: * actual * day_started * day_ended
Default: Set by Admin
Actual dayended
report_data_type Report data type is the category of report (Unapproved, Approved,both) which is to be recieved as response. Accepted values: * unapproved (Default) * approved * both unapproved
checklist Checklist parameter includes the checklist items along with the logs which were checked at the time of punch-out. Only items checked will be recieved. Items which were unchecked will not be recieved in the API. Accepted values: * yes * no yes

* Required fields.

Success Request

    curl --location --request POST 'https://admin.timesheetmobile.com/TBA/oauth/report' \
    --header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258' \
    --form 'from_date=03/01/2020' \
    --form 'to_date=03/08/2020'
                            

Success Response

    {
        "code": 200,
        "status": "success",
        "message": "OK",
        "log_count": 28,
        "data": [
            {
            "employee_number": "4",
            "employee_name": "Ben Strokes",
            "date_time_in": "05-03-2020 17:11:45",
            "date_time_out": "05-03-2020 18:09:18",
            "login_id": "79190123186838",
            "logout_id": "79190123186846",
            "pto_id": "",
            "time_entry_id": "",
            "workgroup_number": [
                "2"
            ],
            "workgroup_name": [
                "KNHB"
            ],
            "job_number": "7",
            "job_name": "",
            "service_item": "",
            "task_no": "0",
            "task_name": "",
            "location_acceptance_in": null,
            "location_acceptance_out": null,
            "login_notes": "",
            "logout_notes": "",
            "login_mileage": "0",
            "logout_mileage": "0",
            "login_latitude": null,
            "login_longitude": null,
            "login_radius": null,
            "logout_latitude": "",
            "logout_longitude": "",
            "logout_radius": null,
            "payroll_item": "",
            "duration": "00 : 57"
            },
            {
            "employee_number": "5",
            "employee_name": "David Villa",
            "date_time_in": "03-03-2020 14:26:00",
            "date_time_out": "03-03-2020 16:26:01",
            "login_id": "79190123186797",
            "logout_id": "79190123186798",
            "pto_id": "",
            "time_entry_id": "",
            "workgroup_number": [
                "3312"
            ],
            "workgroup_name": [
                "s and g"
            ],
            "job_number": "1",
            "job_name": "spgons",
            "service_item": "",
            "task_no": "0",
            "task_name": "",
            "location_acceptance_in": null,
            "location_acceptance_out": null,
            "login_notes": "",
            "logout_notes": "",
            "login_mileage": "0",
            "logout_mileage": "0",
            "login_latitude": null,
            "login_longitude": null,
            "login_radius": null,
            "logout_latitude": null,
            "logout_longitude": null,
            "logout_radius": null,
            "payroll_item": "",
            "duration": "02 : 00"
            }
        ]
        }
                            

Testing Api

https://admin.timesheetmobile.com/TBA/oauth/

Sample api for testing connection


Success Request

    curl --location --request GET 'https://admin.timesheetmobile.com/TBA/oauth/' \
    --header 'Authorization: Bearer 2793f35033855f6cce4f397b8edf4e3306e07258'
                            

Success Request

    {
        "code": 200,
        "status": "success",
        "message": "Hi User, Welcome to TimesheetMobile APIs."
    }
                            

States codes & their names

State Code State Name State Code State Name State Code State Name
AL ALABAMA MI MICHIGAN UT UTAH
AK ALASK, MN MINNESOTA VT VERMONT
AS AMMARIEAN SAMOA MS MISSISSIPPI VI VIRGIN ISLANDS
AZ ARIZONA MO MISSOURI VA VIRGINIA
AR ARKANSAS MT MONTANA WA WASHINGTON
CA CALIFORNIA NE NEBRASKA WV WEST VIRGINIA
CO COLORADO NV NEVADA WI WISCONSIN
CT CONNECTICUT NH NEW HAMPSHIRE WY WYOMING
DE DELAWARE NJ NEW JERSEY AE ARMED FORCES AFRICA \ CANADA \ EUROPE \ MIDDLE EAST
DC DISTRICT OF COLUMBIA NM NEW MEXICO AA ARMED FORCES AMMARIEA (EXCEPT CANADA)
FM FEDERATED STATES OF MICRONESIA NY NEW YORK AP ARMED FORCES PACIFIC
FL FLORIDA NC NORTH CAROLINA BC British Columbia
GA GEORGIA ND NORTH DAKOTA ON Ontario
GU GUAM GU MP NORTHERN MARIANA ISLANDS NL Newfoundland and Labrador
HI HAWAII OH OHIO NS Nova Scotia
ID IDAHO OK OKLAHOMA PE Prince Edward Island
IL ILLINOIS OR OREGON NB New Brunswick
IN INDIANA PW PALAU QC Quebec
IA IOWA PA PENNSYLVANIA MB Manitoba
KS KANSAS PR PUERTO RICO SK Saskatchewan
KY KENTUCKY RI RHODE ISLAND AB Alberta
LA LOUISIANA SC SOUTH CAROLINA NT Northwest Territories
ME MAINE SD SOUTH DAKOTA NU Nunavut
MH MARSHALL ISLANDS TN TENNESSEE YT Yukon Territory
MD MARYLAND MA MASSACHUSETTS PR Puerto Rico
TX TEXAS