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
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..
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.