Forums

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

Always getting attribute unique error when updating an insight object directly after creation

zhang
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!
July 19, 2022

Hi, I am trying to update an insight object using the rest api. But then I find if I use the put api to update directly after creation of this object, it throws unique error, while I am pretty much sure that I didn't create duplicate objects. And the strangest part is that some of my folks doesn't meet this problem, while some others does. REST API documentation (riada.io)

My object type in insight looks like this: 

Name: text  unique

attr: text

And what I did is to run:

data={"attributes":[

          {"objectTypeAttributeId":xxx,

           "objectTypeValues":[{"value:"name1"}]

            }

]

path=host/xxx/xxx/object/create

requests.post(path,json=data,headers=headers)

path=host/xxx/xxx/object/objectid

(objectid is the id created in the post request)

requests.put(path,json=data,headers=headers)  (data here is the same as I use in the creation above)

So I first create an object called 'name1', then I update this object with the same name. Then it throws an error telling the name is an unique attribute. I tested the two rest api and they both work independently. And I also test with only update api with the data above, and it works. 

Then I found that if I add a time.sleep(1) in the middle of two requests, then it works again. Has anyone met this before? Or anyone has other ideas on solving this?

Thank you

1 answer

0 votes
Miriam_Fernandez September 27, 2024

I have similar problema qhen i update an object with CSV, i put the name and 2 atributtes to update and the system fail and return an error "Name duplicate exist".

The Name is unique atribute and label , i dont know how update the 400 object, if i cant only one..

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events