Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to add WRITE scope to atlassian-connect.json

Chun Ho Ng
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!
February 7, 2020

I am writing a script on ScriptRunner to update the fields once an issue is created, but I receive the following:

error code: status: 403 - Forbidden

I saw on some posts mentioning that might be due to the scope object in atlassian-connect.json not including 'write'.

Can anyone tell me how to add the write scope to atlassian-connect.json?

Thank you.

1 answer

1 accepted

1 vote
Answer accepted
DPKJ
Community Champion
February 7, 2020

@Chun Ho Ng  Welcome to the community!

To add 'write' scope to atlassian-connect.json file you need to add something like this.

{
"key": "YOUR_ADDON_KEU",
"name": "ADDON_NAME",
"description": "ADDON_DESCRIPTION",
"scopes": ["READ", "WRITE"], # HERE I HAVE ADDED A WRITE SCOPE
"modules": {
...
}
}

 

But, I don't think with ScriptRunner you need to do this. ScriptRunner itself is addon and you don't need to write 'atlassian-connect.json' file for this.

You might be getting error because of permission issues with field. So please validate this first.

Chun Ho Ng
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!
February 8, 2020

I was able to change the fields through sending the following PUT request on Postman:

/rest/api/2/issue/[issueKey]

body:

{
"fields": {
"customfield_10039": "US",
"customfield_10040": "NF",
"customfield_10041": "KP"
    }
}

 But it failed when I used ScriptRunner

put("/rest/api/2/issue/${issue.key}")
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.body([
fields: [
customfield_10039: region,
customfield_10040: mainProgram,
customfield_10041: subProgram
]
]).asString()

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events