Cannot Create Issue via rest api after tokenAPI adoption

Alex Z. July 23, 2019

I have integrated ServiceNow with JIRA.

I have defined an integration dedicated JIRA user (SN_SI_USER) that call JIRA via rest API.

After the adoption of TokenApi when create an issue with SN_SI_USER via rest API  I am reciving this error:

HTTP/1.1 400 Bad Request

{"errorMessages":[],"errors":{"summary":"Field 'summary' cannot be set. It is not on the appropriate screen, o
r unknown.","customfield_10600":"Field 'customfield_10600' cannot be set. It is not on the appropriate screen,
or unknown.","customfield_10900":"Field 'customfield_10900' cannot be set. It is not on the appropriate scree
n, or unknown.","description":"Field 'description' cannot be set. It is not on the appropriate screen, or unkn
own.","assignee":"Field 'assignee' cannot be set. It is not on the appropriate screen, or unknown.","customfie
ld_11100":"Field 'customfield_11100' cannot be set. It is not on the appropriate screen, or unknown.","priorit
y":"Field 'priority' cannot be set. It is not on the appropriate screen, or unknown."}}

 

To bypass all software layer i do the test with curl.

If I use an admin user account with the same Token and the same request I have no error, issue is created.

If I grant admin permissions/role to SN_SI_USER i have an error (400 Bad Request).

 

Any idea?

 

POST request:

{

"fields": {

"project":

{

"key": "PROJECT00"

},

"assignee": {

"name": "USER2"

},

"summary": "REST EXAMPLE - DO NOT CARE - IT WILL BE DELETED BEFORE U CAN READ IT",

"description": "Creating an issue via REST API",

"issuetype": {

"name": "Bug"

},

"priority": {

"id": "1"

},

"customfield_11100": "Service_me_id",

"customfield_10600": {

"id" : "10301"

},

"customfield_10900": "USER1"

}

}

 

 

Solved:

Log in to Jira with the same user (SN_SI_USER) with which you want to execute the REST API request, then generate the TOKEN key and use this key with that user (SN_SI_USER) to execute the REQUEST API.

Jira software must generate a TOKEN key per user, not per application, so a key generated by userA does not work with userB.

0 answers

Suggest an answer

Log in or Sign up to answer