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

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

Koczka Bence September 7, 2021

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.

3 answers

1 vote
Rudy Holtkamp
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 13, 2022

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"
}
]
}
]
}
1 vote
Neil
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 8, 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.

kbencze95 September 20, 2021

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.

Koczka Bence September 20, 2021

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

0 votes
Julia Gracia March 1, 2023

Hi Koczka
You could try the same call but using the status id instead of the name of the status, you can check the status id in the schema configuration view.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events