It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

JIRA Rest API Create Issue with Time Tracking

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!

 

2 answers

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":{}}

Hi @Alexander Kay

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

BR, Tomasz

0 votes

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

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

The add-in you’ve been waiting for: Jira Cloud for Excel 🙌

Introducing Jira Cloud for Excel Here at the product integrations team at Atlassian, we are thrilled to announce the new Jira Cloud for Excel add-in! This add-in lets you export Jira data directly ...

838 views 5 22
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you