JIRA Rest API Create Issue with Time Tracking

Alexander Kay June 5, 2018

Hi Everybody,

 

I'm working on server JIRA add-on, which can create projects and issues with time tracking properties.

I'm using jwt token to sign all my requests. Create project, Get Project, Create Issue and others work completely fine. No questions about it.

However, I cannot create an issue with timetracking field. When I do create a new project via API, it creates a default screen for this project. This default screen doesn't have timetracking fields added. Here is where all the fun begins.

 

Using Create Issue End-Point is not an option, because it's returning an error because "timetracking" field is not visible on the screen.

 

First thing came to my mind is to edit default screen for the project, however for some reason Apps are not allowed to use Get Screens End-Point.

quote: "Apps cannot access this REST resource."

Nonetheless, Apps are allowed to modify screens by providing screenId. But how can I get screenId if I cannot query screens? Quite silly, right?

 

Anyway, since modifying screen is not an option with Rest API, I've started to dig deeper and have found out that Update Issue End-Point has "overrideScreenSecurity" parameter:

 

quote: "Allows update of the fields that are hidden from the issue’s Edit screen. Only Connect add-on users with admin scope permission are allowed to use this flag."

 

Nevertheless, each time I'm sending put request with overrideScreenSecurity parameter set to true, I'm getting 401 - Unauthorized. Without this param everything is working fine. The most interesting thing is that I do have admin scope permission in my atlassian-connect.json file.

 

Details:

Url: https://{instance}.atlassian.net/rest/api/2/issue/{id}?overrideScreenSecurity=true

Method: PUT

Body: 

{
    "update": {
        "timetracking":[
            {
                "edit": {
                    "originalEstimate":"10d",
                    "remainingEstimate":"10d"
                }
            }
        ]
    }
}

I'm signing every request with Authorization header and JWT. It works fine for other requests, so I don't think it makes sense to share my JWT here.

Response:

Status: 401 Unauthorized

 

 

My atlassian-connect.json file:

{
  "name": "App Name",
  "description": "App Description",
  "key": "com.estimatish.io",
  "baseUrl": "https://88fd8d35.ngrok.io/",
  "vendor": {
    "name": "App, Inc.",
    "url": "http://app.io"
  },
  "authentication": {
    "type": "jwt"
  },
  "lifecycle": {
    "installed": "/callback/installed",
    "uninstalled": "/callback/uninstalled",
    "enabled": "/callback/enabled",
    "disabled": "/callback/disabled"
  },
  "apiVersion": 1,
  "scopes": [
    "admin",
    "read",
    "write",
    "project_admin",
    "act_as_user"
  ],
  "modules": {}
}

 

Do you have any idea how I can create issue with filled timetracking field using JIRA Rest API or at least point me to the right direction? 

 

Appreciate it, thanks!

 

4 answers

1 vote
Juan de Toro
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 10, 2019

Using JIRA Mac App appears the same problem.image.png

0 votes
Rick Beemsterboer
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 27, 2022

Am very curious what you have learned since 2018 regarding time tracking...

0 votes
Oleh Metelskyi November 28, 2019

I have the same problem. Please help

0 votes
Alexander Kay June 5, 2018

Quick Update:

I was able to generate OAuth2 access token for my user and tried to update issue with timetracking values. Same error: 

{"errorMessages":["Only Connect add-on users with admin scope permission are allowed to override screen security."],"errors":{}}

Tomasz Staniewicz
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 19, 2018

Hi @Alexander Kay

Can you please tell me whether you found solution for this problem?

BR, Tomasz

Suggest an answer

Log in or Sign up to answer