Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,299,390
Community Members
 
Community Events
165
Community Groups

Insight API: How to change the value of an objectattribute which has the type: "Status" ?

I have an object type with a field of the status type . It has 3 available states:
Running, Stopped, Closed

 

I want to change this value through the API.
This is how I tried:

{

            "objectTypeId":698,

            "attributes"

     [

                {

                        "objectTypeAttributeId"2999,

                        "objectAttributeValues"

                            [

                               {

                                   "value""Running"

                                }

                            ]

                }

      ]

}


This returns error. Sadly the documentation for the API is no longer available ( at least not currently), so I don't know where to look up the exact method for doing this.

2 answers

1 vote
Neil Atlassian Team Sep 08, 2021

Hi @Koczka Bence So, I'll start by saying that I'm not personally familiar with the Insight API, therefore, I do not know if updating that particular objectTypeAttribute is possible; however, I believe the docs for that method are located here:

https://developer.atlassian.com/cloud/insight/rest/api-group-objecttypeattribute/#api-objecttypeattribute-objecttypeid-id-put

Hopefully that helps. Otherwise, share the exact call you're making (as many details without sensitive info), and the error responses you're getting, and we'll try to get the right folks on here to help.

Hi!


Thank you for your answer, sadly I have not mangaed to solve my problem.

I have an ObjectType called 'Server', and it has several ObjectTypeAttributes, one of them's value is what I want to change, it is called 'State'. It is a 'Status' type attribute. It has 3 available states:
Running, Stopped, Closed

 

The following is the content of a PUT request I've sent to:

https://ourjiraserver.com/rest/insight/1.0/object/255207



{

            "objectTypeId":698,

            "attributes": [

                {

                        "objectTypeAttributeId"3015,

                        "objectAttributeValues": [

                        {

                            "value""Closed"

                        }

                            ]

                }

                    ]

             }

 

The response is 500 internal server error:

{

    "errorMessages": [

        "Something went wrong. Contact administrator"

    ],

    "errors": {}

}

 

I can change any other (Text type) attributes with requests like this.

"Value": "Closed" is just a guess from my part (about how should I change an attribute which has the type 'Status'), since the old Insight documentation is sadly no longer available online.
I think it is the line which contains the error.
Please let me know if you need further information regarding my problem.

This is my reponse, accidentally posted from my other account.

Hi, 

A bit late to the party, but for anybody who is running into this issue.

You need to use the status id instead of the status name in your JSON .

You can find the status id via a 'Get https://api.atlassian.com/jsm/insight/workspace/{workspaceId}/v1/config/statustypewhich is explained here. 

If you status id for 'Running' is '5', your JSON will look something like this:

{
"objectTypeId":"698",
"attributes":[
{
"objectTypeAttributeId":"2999",
"objectAttributeValues":[
{
"value":"5"
}
]
}
]
}

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

Coming Soon: Insight Changing to Assets

The 2020 acquisition of Mindville added powerful asset and configuration management capabilities to Jira Service Management in the form of Insight. Following the completion of that integration, custo...

396 views 3 12
Read article

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