{"errorMessages":[],"errors":{"add":"Field 'add' cannot be set. It is not on the appropriate screen,

poovaraj July 23, 2019

{"errorMessages":[],"errors":{"add":"Field 'add' cannot be set. It is not on the appropriate screen, or unknown."}} - error message is displayed while adding fixVersion data in JIRA using Rest API ? Please let me know what is issue ?

 

JSON:-

{

  "fields": {

    "project": {

      "id": "244026"

    },

    "summary": " TestDemo",

    "description": "Testing",

    "issuetype": {

      "name": "Test"

    },

    "add": {

      "fixVersions": [

        {

          "set": {

            "name": "testing"

          }

        }

      ]

    }

  }

}

2 answers

0 votes
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 23, 2019

Hello,

Make sure that the fixversion(s) is present on the Create issue screen for the Test issue type (project settings -> screens).

poovaraj July 23, 2019

It is showing below error message after removing square brackets [ ]. Fix version field is displayed in create issue screen. Please find the below screenshot.

Error Message:  

{"errorMessages":[],"errors":{"add":"Field 'add' cannot be set. It is not on the appropriate screen, or unknown."}}

JSON

{"fields":{"project":{"id":"244026"},"summary":" Demo","description":"Testing","issuetype":{"name":"Test"},"add":{"fixVersions":{"set":{"name":"tttt"}}}}}

 

Screenshot

Fix Version.png

poovaraj July 24, 2019

I unable to add transition type filed also. It is showing same error message and it is available in create issue filed.  Please let me know why is it showing error message while adding FixVersion & Transition field ?

 

Error Message : 

 

{"errorMessages":[],"errors":{"transition":"Field 'transition' cannot be set. It is not on the appropriate screen, or unknown."}}

 

Adding transition field :

 

{

  "fields": {

    "project": {

      "id": "244026"

    },

    "summary": "Demo",

    "description": "Testing",

    "transition": {

      "id": "5"

    },

    "issuetype": {

      "name": "Test"

    }

  }

}

 

 

Transition_Status_Update.png

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 24, 2019

Transition is not a field, it is an action, you need to give it a transition id to perform, with fields to be updated inside that.

Please have a look at https://developer.atlassian.com/cloud/jira/platform/rest/v3/?utm_source=%2Fcloud%2Fjira%2Fplatform%2Frest%2F&utm_medium=302#api-rest-api-3-issue-issueIdOrKey-transitions-post and see how a transition JSON is built properly.

poovaraj July 25, 2019

 

  • I  have used below command to update transition field and it is updating in JIRA status but it is throwing some error message. Please let me know why is it showing error message ?curl -D- -u kgresf@company.com:fZPwga3cWDBWSAb13ppp5VhD16B -X POST --data '{"transition":{"id":"71"}}' -H "Content-Type: application/json" https://company.atlassian.net/rest/api/2/issue/FTMU-1434/transitions?expand=transitions.fields

 

  • Please let me know how to update fixversion filed ?
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 25, 2019

Again, transition is not a field, it is an action.  Your data needs to tell Jira which action to take if you want to transition an issue, not try to poke data into a field that is not there.

Your latest comment is about a post that asks a valid question about fields that might be available during a transition, but you've not told us what the error message you get is, so there's not a lot we can do beyond tell you that the post looks fine.

poovaraj July 26, 2019

@Nic Brough -Adaptavist- 

Transitions Query

I got it that transition is a an action. I have query about poke data. JIRA status was updated by using poke data but API response is "204 No Content". So I asked this query.  Currently, I am updating JIRA status using poke data and am ignoring 204 No Content response message. 

Response message : 

POST https://company/rest/api/2/issue/FTMS-1457/transitions?expand=transitions.fields returned a response status of 204 No Content

@Alexey Matveev @Warren 

Fix Version Query :

I have tried to update fixVersions after removing array but it is showing below error message. Please correct me if it is anything wrong in syntax. 

curl -D- -u user:f55ZPwga3cWDBWSAb135VhD16B  -H "Content-Type: application/json" --data '{"update":{"fixVersions": {"set": {"name": "Autom"}}}}' -X PUT https://company.atlassian.net/rest/api/2/issue/FTMS-1419

HTTP/1.1 400

Server: AtlassianProxy/1.15.8.1

Cache-Control: no-cache, no-store, no-transform

Content-Type: application/json;charset=UTF-8

Strict-Transport-Security: max-age=315360000; includeSubDomains; preload

Date: Fri, 26 Jul 2019 07:14:37 GMT

ATL-TraceId: 43c87f57c99aab35

X-AACCOUNTID: 5c90c7ef2a28712decf8ac755433

X-AREQUESTID: a764e3c2-a646-4642-8cd7-3f116eca9887634db

X-XSS-Protection: 1; mode=block

Transfer-Encoding: chunked

Timing-Allow-Origin: *

X-Content-Type-Options: nosniff

Connection: close

Set-Cookie: atlassian.xsrf.token=BKA2-A1P7-HQV6-K032_43e3a04e888395979876548f907ada30033e58c2f68368d16_lin; Path=/; Secure

{"errorMessages":["Can not deserialize instance of java.util.ArrayList out of START_OBJECT token\n at [Source: org.apache.catalina.connector.CoyoteInputStream@294c22d; line: 1, column: 12] (through reference chain: com.atlassian.jira.rest.v2.issue.IssueUpdateBean[\"update\"])"]}

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 28, 2019

A 204 means the server processed your post, but sent nothing back.  No error, but no confirmation either, which doesn't sound right to me.  Did your issue go through the transition with the data you added/updated ok?

poovaraj July 28, 2019

@Nic Brough -Adaptavist-  Thanks for your reply.

I have tried to update JIRA status in 2 ways (CURL & HTTP Client). CURL is not showing any error message after updating in JIRA Status (Pass / Fail) but http client is showing 202 error message while updating JIRA status. Status is changed successfully using both methods.  The below code is working fine and it is showing 202 response code.  Please correct me if it anything wrong in the syntax? 

Client client = Client.create();

client.addFilter(new HTTPBasicAuthFilter(JIRA_USERNAME, JIRA_API_TOKEN));

String input = "{\"transition\":{\"id\":\"" + jiraTransitionId + "\"}}".trim();

WebResource webResource = client.resource(JIRA_URL + "/rest/api/2/issue/"+issueKey+"/transitions?expand=transitions.fields");

ClientResponse response = webResource.type("application/json").post(ClientResponse.class, input);

String output = response.getEntity(String.class);

0 votes
Warren
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 23, 2019

Hi @poovaraj 

Try removing the square brackets [ ] from

"add": {

      "fixVersions": [

        {

          "set": {

            "name": "testing"

          }

        }

      ]

 

i.e. the fixVersions isn't in an array

Suggest an answer

Log in or Sign up to answer