The API call /rest/api/2/myself fetches a incorrect user timezone when executing from Tempo add-on

Still need help?

The Atlassian Community is here for you.

Ask the community

For Atlassian eyes only

This article is Not Validated and cannot be shared with customers.

Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.

 

Summary

The timezone of the user is fetched incorrectly when trying from the Tempo Timesheet add-on via the API call /rest/api/2/myself 

Environment

Jira Cloud

Cause

As per the document Configure Jira application options, the value for the field is explained below:

Set a default user time zone to display across all Jira applications (for example, when looking at issue comments). Users can override this default in their profile. To format your time zone display, see Configuring the look and feel of your Jira applications. Note that date fields such as due dates and release dates aren't impacted by time zone settings.

The TimeZone of the user is not set to be visible to "Anyone" because of which it is restricted to be exposed via the call /rest/api/2/myself.

Solution

Connect apps only have access to profile information that is available to the public ("Anyone"), with the exception of the following fields:

  • Timezone: The timezone can be accessed using AP.user.getTimeZone in the JavaScript API, regardless of profile visibility settings. However, you must only use this API to establish context for the user. Do not present the user's timezone in a way that can be seen by other users viewing the application.
  • Email address: Profile visibility settings restrict access to the email address, similar to the other profile fields. However, given that some apps need email addresses for key functionality, we provide an Email API that provides access to email addresses regardless of profile visibility settings. The Email API is a public API but only apps that have been approved and added to your allowlist are permitted to use it. To request access, see Requesting access to the Email API below.


Last modified on Mar 30, 2022

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.