Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Updating Behaviour mapping with rest API


I use the behaviour module of ScriptRunner on my Jira environment with 20 differents configurations.
I have two needs :

  1. I want to automate the association of a new project to a behavior according to the project category. 
    I have no idea how to do now, so if you have suggestion, you're welcome !
  2. I want to use behaviour API to add new mapping between project and configuration without erasing the current mapping

For the second subject, I saw that I can use the base-url/rest/scriptrunner/behaviours/1.0/config rest API, posting a new XML of my mapping but it's erasing the old one...

I found two other rest API but I don't find any documentation on them :


I Tried to post the following Json, but it doesn't work...


{"id" : 1,
"name": "Behavior1",
"description": "test",
"mappings": [
"type": "PROJECT",
"project": {
"id": 20000,
"name": "Project 1",
"key": "P1"
"issuetype": {
"id": "0",
"name": "All issue types",}
"type": "PROJECT",
"project": {
"id": 20002,
"name": "Project 2",
"key": "P2"
"issuetype": {
"id": 12200,
"name": "Work Item"



Any suggestions ?

Thank in advance.

Best regards,



1 answer

1 accepted

0 votes
Answer accepted

I finaly found a solution, this code works : 


def http = new HTTPBuilder("yoururl/rest/scriptrunner/behaviours/1.0/admin/mapping")
def authString = "username:password".getBytes().encodeBase64().toString();

http.request(Method.POST, ContentType.JSON) {
headers."Authorization" = "Basic ${authString}"
headers.contentType = "application/json"
body = "{ \"behaviourId\": \"1\", \"type\": \"PROJECT\", \"projectIds\": [\"${projectID}\"], \"issueTypeIds\": [\"10900\"]}"

response.success = { resp, JSON ->
log.warn("Successful = " + JSON)

response.failure = { resp, JSON ->
log.warn("Failed = " + JSON)


Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira Software

Presenting the "Best of 2020" Jira Software roundup!

Catch up with Atlassian Product Managers in our 2020 Demo Den round-up! From Advanced Roadmaps to Code in Jira to Next-Gen Workflows, check out the videos below to help up-level your work in the new ...

7,104 views 8 28
Join discussion

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