Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

The code examples provided below are for curl and you will need to adapt them to your preferred means of dealing with REST APIs. All information provided in curly brackets “{}” need to be replaced with the variables from your instance.

Timesheet approvals

Timesheets can be submitted, approved and rejected from the REST API. If a users timesheets has been submitted or the period for the timesheet is closed you have the option to reopen a timesheet from the API as well (/timesheet-approvals/user/{accountId}/reopen). 

Since you cannot preserve the timesheet logs (due to the fact that all timesheet actions are stored with the timestamp when the submit/approve/reject/reopen action has been called) you should only restore the timesheet data with its current state.

The example below can be used similarly for all 4 endpoints (reopen/reject/approve/submit).

curl --location --request POST 'https://api.tempo.io/core/3/timesheet-approvals/user/{AtlassianID}/{reopen/reject/approve/submit}?from={periodStartdate}&to={periodEnddate}' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {TempoAuthorisationToken}'
 -d '{"comment":"well done"}'

Worklog approval information

Retrieving the approval information can only be done by checking the timesheet approval status for the user who has tracked the time for the worklog date. In order to retrieve all approved worklogs for a user you will need to call:

curl --location --request GET 'https://api.tempo.io/core/3/timesheet-approvals/user/{AtlassianAccountId}?from={periodStartdate}&to={periodEnddate}' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {TempoAuthorisationToken}' 

You must follow these steps for every single user whose approval status you need to check.

You can also do this on a team by team basis, like this:

curl --location --request GET 'https://api.tempo.io/core/3/timesheet-approvals/team/{TeamId}?from={periodStartdate}&to={periodEnddate}' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {TempoAuthorisationToken}' 

The response will include the approval status for each team member. Each approval status object also includes a URI to retrieve all worklogs within the requested approval period. This enables you to programmatically retrieve all worklogs for the approval period in question.

  • No labels