Use this REST API to manage and administer timesheets. With this resource, you can retrieve timesheet lists, approve, reject, submit, and unsubmit timesheets in your WebWork account.
Below we provide an example of the data which is required for each scenario.
You can get all the timesheets in your workspace with the following URL request
Copy code GET https://www.webwork-tracker.com/rest-api/timesheets
Retrieves a list of timesheets in your workspace. By default, results are paginated (50 rows per page), and you can also filter timesheets using various query parameters.
Copy code GET https://www.webwork-tracker.com/rest-api/timesheets?status={open | submitted | rejected | approved}&date_from={date_from}&date_to={date_to}&page={page}
The response returns a json format. Below you can see an example of response structure.
Copy code max_rows: "{max_rows}" current_page: "{current_page}" total_pages: "{total_pages}" data: [ { "id": "{id}" "user_id": "{user_id}" "date_from": "{date_from}" "date_to": "{date_to}" "total_hours": "{total_hours}" "submitted_on": {submitted_on} "reject_reason": {reject_reason} "status": {status} }, {...} ]
If you need to approve a specific timesheet, append the {id} at the end of the URL
Copy code PUT https://www.webwork-tracker.com/rest-api/timesheets/approve/{id}
The returned response includes a success property which contains your request success value.
{ "success": "{success_of_the_request}" }
You can reject a submitted timesheet using the
Copy code PUT https://www.webwork-tracker.com/rest-api/timesheets/reject/{id}
You should add the following header in your request
Copy code Content-Type: application/x-www-form-urlencoded
The list of parameters you can give to body
Property name | Type | Is required |
---|---|---|
reason | string | YES |
The returned response includes a success
property which contains your request
success value.
Copy code { "success": "{success_of_the_request}" }
You can submit a timesheet using
Copy code PUT https://www.webwork-tracker.com/rest-api/timesheet/submit/{id}
The returned response includes a success
property which contains your request
success value.
Copy code { "success": "{success_of_the_request}" }
You can unsubmit a submitted timesheet using
Copy code PUT https://www.webwork-tracker.com/rest-api/timesheet/unsubmit/{id}
The returned response includes a success
property which contains your request
success value.
Copy code { "success": "{success_of_the_request}" }