Timesheets


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.

GET All timesheets


You can get all the timesheets in your workspace with the following URL request

Copy codeGEThttps://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 codeGEThttps://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}
                                },
                                {...}
                            ]
                        

PUT Approve timesheet


If you need to approve a specific timesheet, append the {id} at the end of the URL

Copy codePUThttps://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}"
                                }
                        

PUT Reject timesheet


You can reject a submitted timesheet using the PUT method by appending the {id} at the end of the URL, and giving appropriate parameters.

Copy codePUThttps://www.webwork-tracker.com/rest-api/timesheets/reject/{id}

You should add the following header in your request

Copy codeContent-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}"
                            }
                        

PUT Submit timesheet


You can submit a timesheet using PUT method and, append the {id} at the end of the URL

Copy codePUThttps://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}"
                            }
                        

PUT Unsubmit timesheet


You can unsubmit a submitted timesheet using PUTmethod and, append the {id} at the end of the URL

Copy codePUThttps://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}"
                            }