Forums

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

Insight REST API fails to update object attribute values

Justin Pulsipher July 6, 2022

Hello, 

I'm using powershell to interact with the Insight REST API. 

I'm currently trying to update the values of some object attributes and hitting a roadblock. If i send the following CURL command, I get a JSON response back with the current contents of the correct object, but no updates are being posted to the object. Please help me figure out what I'm missing. 

 

c:\windows\system32\curl.exe -u [REDACTED] -X PUT -H Accept:application/json -H Content-Type:application/json https://api.atlassian.com/jsm/insight/workspace/[REDACTED]/v1/object/20145 -s -d '{
\"attributes\": [
{
\"objectTypeAttributeID\": \"126\",
\"objectTypeAttributeValues\": [
{
\"displayValue\": \"ABC123\",
\"value\": \"ABC123\",
\"searchValue\": \"ABC123\"
}
]
},
{
\"objectTypeAttributeID\": \"121\",
\"objectTypeAttributeValues\": [
{
\"displayValue\": \"IT-20145\",
\"value\": \"IT-20145\",
\"searchValue\": \"IT-20145\"
}
]
},
{
\"objectTypeAttributeID\": \"114\",
\"objectTypeAttributeValues\": [
{
\"displayValue\": \"123456\",
\"value\": \"123456\",
\"searchValue\": \"123456\"
}
]
},
{
\"objectTypeAttributeID\": \"166\",
\"objectTypeAttributeValues\": [
{
\"displayValue\": \"test123\",
\"value\": \"test123\",
\"searchValue\": \"test123\"
}
]
}
],
\"objectTypeID\": \"23\"
}'

sample response (converted from JSON)

workspaceId : [REDACTED]
globalId : [REDACTED]:20145
id : 20145
label : CP-8845 - S000013
objectKey : IT-20145
avatar : @{workspaceId=[REDACTED]; url16=https:/
/api.atlassian.com/jsm/insight/workspace/[REDACTED]/v1/objecttype/23/icon.png?size=16; url48=https://api
.atlassian.com/jsm/insight/workspace/[REDACTED]/v1/objecttype/23/icon.png?size=48; url72=https://api.atl
assian.com/jsm/insight/workspace/[REDACTED]/v1/objecttype/23/icon.png?size=72; url144=https://api.atlass
ian.com/jsm/insight/workspace/[REDACTED]/v1/objecttype/23/icon.png?size=144; url288=https://api.atlassia
n.com/jsm/insight/workspace/[REDACTED]/
v1/objecttype/23/icon.png?size=288; objectId=20145;
mediaClientConfig=}
objectType : @{workspaceId=[REDACTED];
globalId=[REDACTED]:23; id=23;
name=Phone; type=0; icon=; position=2;
created=2022-04-29T20:28:26.193Z;
updated=2022-05-02T16:38:39.216Z; objectCount=0;
parentObjectTypeId=8; objectSchemaId=2; inherited=True;
abstractObjectType=False; parentObjectTypeInherited=True}
created : 2022-06-30T17:42:11.190Z
updated : 2022-07-05T18:09:17.502Z
hasAvatar : False
timestamp : 1657044557502
attributes : {@{workspaceId=[REDACTED];
globalId=[REDACTED]:270346; id=270346;
objectTypeAttribute=; objectTypeAttributeId=161;
objectAttributeValues=System.Object[]; objectId=20145},
@{workspaceId=[REDACTED];
globalId=[REDACTED]:270348; id=270348;
objectTypeAttribute=; objectTypeAttributeId=120;
objectAttributeValues=System.Object[]; objectId=20145},
@{workspaceId=[REDACTED];
globalId=0[REDACTED]:238810; id=238810;
objectTypeAttribute=; objectTypeAttributeId=44;
objectAttributeValues=System.Object[]; objectId=20145},
@{workspaceId=[REDACTED];
globalId=[REDACTED]:238809; id=238809;
objectTypeAttribute=; objectTypeAttributeId=46;
objectAttributeValues=System.Object[]; objectId=20145}...}
_links : @{self=https://api.atlassian.com/jsm/insight/workspace/[REDACTED]/v1/object/20145}
name : CP-8845 - S000013

 

2 answers

1 accepted

0 votes
Answer accepted
Justin Pulsipher July 8, 2022

After beating my head against this issue for a week now, I finally found the issue.

I was using "objectTypeAttributeID" instead of "objectTypeAttributeId" and "objectTypeID" instead of "objectTypeId" (Note the lowercase "d" in "Id") What a frustrating and easy to miss bit of code!

0 votes
Justin Pulsipher July 7, 2022

[Moved to body of OP]

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events