Cannot add field to tab via API


I have to add a custom field to ~1000 screens (or the first tab of the respective screen to be more precise) and doing this via the web interface will be taking way to long.

However, running the API call " Add screen tab field" {POST /rest/api/2/screens/{screenId}/tabs/{tabId}/fields} always returns a 200 status code but never actually adds the custom field.

In the documentation it mentioned that giving the id of the custom field in the request body is required, however, I found that the body is simply ignored in all requests and I can write whatever I want, including completely removing the whole body. The call will always return a 200 status code including the current fields in the respond body regardless…

Is this a known, undocumented bug? Looks like it does the get request instead of the post. Looking at the postman console it does show that the initial post request is redirected (301) to the same get request.

Am I overlooking something?

Hello @TobiasHttenmller

Your question relates to Jira Cloud, but your code example is making a call to the old V2 REST API.

Use the V3 REST API endpoint: /rest/api/3/screens/ , as per documentation that you’ve linked to.

I was 100% sure that this was the replies I will get. I tried them all before being desperate and trying to use this forum. :frowning:

Absolutely, zero difference in using the v2 or the v3 endpoint.

Hello @TobiasHttenmller

It’s a shame that you didn’t actually say that you had tried both the v2 and v3 endpoints and gotten the same results, but anyhow… I have just tested the v3 add screen tab field endpoint using Postman and it worked exactly as expected:

When I then used the REST API and queried that tab on that screen to see what fields were on it, the new field was listed:

When I then logged into the web UI and looked at that tab on that screen, the new field was there, as well as all the two other fields.

In your screen grab from Postman, your response body contains information about lots and lots of fields, which I did not get. I got only the expect 200 response back, confirming the request was successful, and the information about the single field I added, nothing else.

Assuming that you’ve checked that the user credentials you’re using for submitting the request via the REST API has the permission to add that field to that tab on that screen by testing those user credentials to do the same thing via the web UI first, then I don’t know why your request isn’t working.

Hi @sunnyape,

sorry for being a pain to your earlier reply and thanks alot for taking the time looking into this even more. I was quite frustrated at that point…sorry :confused:
However, seeing you got the call to work made me revisit the differences between your successful and my failed call.
And the difference was that somehow i was using http:// as protocol for my instance instead of https://
turns out only some calls work with http:// and this one is not one of them.

Script ran successfully and many screens were updated!


Hi @TobiasHttenmller

OK, that makes sense.

I’m pretty sure Jira’s REST API doesn’t support non SSL connections. What’s probably happening is Atlassian has setup a port redirection so that if anyone does accidentally attempt to connect via port 80 or 8080, they get switched to 443, but it obviously doesn’t work under all circumstances. Maybe it is only in place for v2 connections, not v3 so that is why some of your requests worked and others didn’t?

If in doubt, always use the https:// prefix to ensure you’re using SSL.