Document toolboxDocument toolbox

To learn more about Tempo products, please visit our Help Center. For support, see our Support Portal.

Timesheet approval REST API on Cloud and Servlet API on Data Center

Cloud

Due to security reasons, Servlet API on Cloud is no longer available. https://tempo-io.atlassian.net/wiki/spaces/HCA/pages/763691139 . Timesheet approvals are associated with a user and a given period, the approval status is not directly linked to individual worklogs.

There is a workaround to get the Timesheet approval status through Export Report.

Or, to get the Timesheet approval status through REST API’s , there are some endpoints needed to get the complete approval info in the script.

There are 2 ways to retrieve approval data - one by team and another by user.

By Team:

To get approval by Team - https://api.tempo.io/4/timesheet-approvals/team/{teamId} with “from” and “to” period parameters: This returns you each team member’s approval details such as period, status, worklogs, etc.

{     "self": "https://api.tempo.io/4/timesheet-approvals/team/6?from=2021-06-01&to=2021-06-30",     "metadata": {         "count": 4     },     "results": [         {             "self": "https://api.tempo.io/4/timesheet-approvals/user/5a39928628e65137bf83702e?from=2021-06-01&to=2021-06-30",             "period": {                 "from": "2021-06-01",                 "to": "2021-06-30"             },             "requiredSeconds": 576000,             "timeSpentSeconds": 0,             "status": {                 "key": "OPEN"             },             "user": {                 "self": "https://tempo-support-1.atlassian.net/rest/api/2/user?accountId=5a39928628e65137bf83702e",                 "accountId": "5a39928628e65137bf83702e",                 "displayName": "Sofie-Anh Duranceau"             },             "actions": {                 "submit": {                     "self": "https://api.tempo.io/4/timesheet-approvals/user/5a39928628e65137bf83702e/submit?from=2021-06-01&to=2021-06-30"                 }             },             "worklogs": {                 "self": "https://api.tempo.io/4/worklogs/user/5a39928628e65137bf83702e?from=2021-06-01&to=2021-06-30"             }         },         {             "self": "https://api.tempo.io/4/timesheet-approvals/user/557058:b2a212da-88e7-4012-a6b8-9874025b63ae?from=2021-06-01&to=2021-06-30",             "period": {                 "from": "2021-06-01",                 "to": "2021-06-30"             },             "requiredSeconds": 576000,             "timeSpentSeconds": 0,             "status": {                 "key": "OPEN",                 "comment": "",                 "actor": {                     "self": "https://tempo-support-1.atlassian.net/rest/api/2/user?accountId=557058:cc8b3ba1-1268-446e-87e0-89a0692080fd",                     "accountId": "557058:cc8b3ba1-1268-446e-87e0-89a0692080fd",                     "displayName": "Tempo Support"                 },                 "requiredSecondsAtSubmit": 576000,                 "timeSpentSecondsAtSubmit": 0,                 "updatedAt": "2021-06-11T14:55:23Z"             },             "user": {                 "self": "https://tempo-support-1.atlassian.net/rest/api/2/user?accountId=557058:b2a212da-88e7-4012-a6b8-9874025b63ae",                 "accountId": "557058:b2a212da-88e7-4012-a6b8-9874025b63ae",                 "displayName": "Taylor"             },             "reviewer": {                 "self": "https://tempo-support-1.atlassian.net/rest/api/2/user?accountId=557058:cc8b3ba1-1268-446e-87e0-89a0692080fd",                 "accountId": "557058:cc8b3ba1-1268-446e-87e0-89a0692080fd",                 "displayName": "Tempo Support"             },             "actions": {                 "submit": {                     "self": "https://api.tempo.io/4/timesheet-approvals/user/557058:b2a212da-88e7-4012-a6b8-9874025b63ae/submit?from=2021-06-01&to=2021-06-30"                 }             },             "worklogs": {                 "self": "https://api.tempo.io/4/worklogs/user/557058:b2a212da-88e7-4012-a6b8-9874025b63ae?from=2021-06-01&to=2021-06-30"             }         },         {             "self": "https://api.tempo.io/4/timesheet-approvals/user/557058:27b3cecc-b58f-4aa7-95d2-85684501993a?from=2021-06-01&to=2021-06-30",             "period": {                 "from": "2021-06-01",                 "to": "2021-06-30"             },             "requiredSeconds": 806400,             "timeSpentSeconds": 0,             "status": {                 "key": "OPEN"             },             "user": {                 "self": "https://tempo-support-1.atlassian.net/rest/api/2/user?accountId=557058:27b3cecc-b58f-4aa7-95d2-85684501993a",                 "accountId": "557058:27b3cecc-b58f-4aa7-95d2-85684501993a",                 "displayName": "Helga María Jónsdóttir"             },             "actions": {                 "submit": {                     "self": "https://api.tempo.io/4/timesheet-approvals/user/557058:27b3cecc-b58f-4aa7-95d2-85684501993a/submit?from=2021-06-01&to=2021-06-30"                 }             },             "worklogs": {                 "self": "https://api.tempo.io/4/worklogs/user/557058:27b3cecc-b58f-4aa7-95d2-85684501993a?from=2021-06-01&to=2021-06-30"             }         },         {             "self": "https://api.tempo.io/4/timesheet-approvals/user/557058:cc8b3ba1-1268-446e-87e0-89a0692080fd?from=2021-06-01&to=2021-06-30",             "period": {                 "from": "2021-06-01",                 "to": "2021-06-30"             },             "requiredSeconds": 576000,             "timeSpentSeconds": 174600,             "status": {                 "key": "IN_REVIEW",                 "comment": "",                 "actor": {                     "self": "https://tempo-support-1.atlassian.net/rest/api/2/user?accountId=557058:cc8b3ba1-1268-446e-87e0-89a0692080fd",                     "accountId": "557058:cc8b3ba1-1268-446e-87e0-89a0692080fd",                     "displayName": "Tempo Support"                 },                 "requiredSecondsAtSubmit": 576000,                 "timeSpentSecondsAtSubmit": 138600,                 "updatedAt": "2021-06-11T16:18:43Z"             },             "user": {                 "self": "https://tempo-support-1.atlassian.net/rest/api/2/user?accountId=557058:cc8b3ba1-1268-446e-87e0-89a0692080fd",                 "accountId": "557058:cc8b3ba1-1268-446e-87e0-89a0692080fd",                 "displayName": "Tempo Support"             },             "reviewer": {                 "self": "https://tempo-support-1.atlassian.net/rest/api/2/user?accountId=5d9208b085a58b0dd530bb74",                 "accountId": "5d9208b085a58b0dd530bb74",                 "displayName": "Andrew Ramsay"             },             "actions": {                 "approve": {                     "self": "https://api.tempo.io/4/timesheet-approvals/user/557058:cc8b3ba1-1268-446e-87e0-89a0692080fd/approve?from=2021-06-01&to=2021-06-30"                 },                 "reject": {                     "self": "https://api.tempo.io/4/timesheet-approvals/user/557058:cc8b3ba1-1268-446e-87e0-89a0692080fd/reject?from=2021-06-01&to=2021-06-30"                 }             },             "worklogs": {                 "self": "https://api.tempo.io/4/worklogs/user/557058:cc8b3ba1-1268-446e-87e0-89a0692080fd?from=2021-06-01&to=2021-06-30"             }         }     ] }

 

You can get a list of Team Id’s with - https://api.tempo.io/4/teams

{     "self": "https://api.tempo.io/4/teams",     "metadata": {         "count": 4     },     "results": [         {             "self": "https://api.tempo.io/4/teams/6",             "id": 6,             "name": "Tempo",             "summary": "",             "lead": {                 "self": "https://tempo-support-1.atlassian.net/rest/api/2/user?accountId=557058:cc8b3ba1-1268-446e-87e0-89a0692080fd",                 "accountId": "557058:cc8b3ba1-1268-446e-87e0-89a0692080fd",                 "displayName": "Tempo Support"             },             "program": null,             "links": {                 "self": "https://api.tempo.io/4/teams/6/links"             },             "members": {                 "self": "https://api.tempo.io/4/teams/6/members"             },             "permissions": {                 "self": "https://api.tempo.io/4/teams/6/permissions"             }         },         {             "self": "https://api.tempo.io/4/teams/12",             "id": 12,             "name": "BlueJay",             "summary": "",             "lead": {                 "self": "https://tempo-support-1.atlassian.net/rest/api/2/user?accountId=557058:cc8b3ba1-1268-446e-87e0-89a0692080fd",                 "accountId": "557058:cc8b3ba1-1268-446e-87e0-89a0692080fd",                 "displayName": "Tempo Support"             },             "program": {                 "self": "https://api.tempo.io/4/programs/7",                 "id": 7,                 "name": "Drinking Contest"             },             "links": {                 "self": "https://api.tempo.io/4/teams/12/links"             },             "members": {                 "self": "https://api.tempo.io/4/teams/12/members"             },             "permissions": {                 "self": "https://api.tempo.io/4/teams/12/permissions"             }         },         {             "self": "https://api.tempo.io/4/teams/16",             "id": 16,             "name": "SWU",             "summary": "",             "lead": {                 "self": "https://tempo-support-1.atlassian.net/rest/api/2/user?accountId=5b198320e249415c02f69600",                 "accountId": "5b198320e249415c02f69600",                 "displayName": "Susan Wu"             },             "program": {                 "self": "https://api.tempo.io/4/programs/39",                 "id": 39,                 "name": "Allied World"             },             "links": {                 "self": "https://api.tempo.io/4/teams/16/links"             },             "members": {                 "self": "https://api.tempo.io/4/teams/16/members"             },             "permissions": {                 "self": "https://api.tempo.io/4/teams/16/permissions"             }         },         {             "self": "https://api.tempo.io/4/teams/27",             "id": 27,             "name": "TestSupTeam",             "summary": "",             "lead": {                 "self": "https://tempo-support-1.atlassian.net/rest/api/2/user?accountId=5b3cc15524f7612e7d4b4743",                 "accountId": "5b3cc15524f7612e7d4b4743",                 "displayName": "Richie Zhu"             },             "program": {                 "self": "https://api.tempo.io/4/programs/37",                 "id": 37,                 "name": "skan program"             },             "links": {                 "self": "https://api.tempo.io/4/teams/27/links"             },             "members": {                 "self": "https://api.tempo.io/4/teams/27/members"             },             "permissions": {                 "self": "https://api.tempo.io/4/teams/27/permissions"             }         }     ]

 

and a list of Periods for the year - https://api.tempo.io/4/periods depending on how you have setup the approval periods (weekly or monthly) in Period Configuration.

{     "periods": [         {             "from": "2021-01-01",             "to": "2021-01-31"         },         {             "from": "2021-02-01",             "to": "2021-02-28"         },         {             "from": "2021-03-01",             "to": "2021-03-31"         },         {             "from": "2021-04-01",             "to": "2021-04-30"         },         {             "from": "2021-05-01",             "to": "2021-05-31"         },         {             "from": "2021-06-01",             "to": "2021-06-30"         },         {             "from": "2021-07-01",             "to": "2021-07-31"         },         {             "from": "2021-08-01",             "to": "2021-08-31"         },         {             "from": "2021-09-01",             "to": "2021-09-30"         },         {             "from": "2021-10-01",             "to": "2021-10-31"         },         {             "from": "2021-11-01",             "to": "2021-11-30"         },         {             "from": "2021-12-01",             "to": "2021-12-31"         }     ] }

 

If there are users who work in multiple teams at the same time, you will get duplicate records for the same users.

By User:

To get approval by User - https://api.tempo.io/4/timesheet-approvals/user/{accountId} with “from” and “to” parameters (see Periods above). You can get a list of user accountId’s from Jira REST API .

 

Data Center

With Data Center Servlet API, it’s much easier to get timesheet approval status for worklogs within a selected period in XML, Excel, or test data format, as per our Data Center API documentation. There are more parameters in the documentation to include in the call.

To get approval by Worklogs - http://{datacenter}/plugins/servlet/tempo-getWorklog/ with tempoApiToken, format, addApprovalStatus, dateFrom, dateTo, etc..