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

How to create Assets objects via REST API based on JIRA Project attribute type?

백재현/DevOps May 21, 2024

I'm using JSM Asset and trying to create object via REST API

 

My object has 'Project' type attribute.

When I get this object via REST API, it looks like below :

```

{
"workspaceId": "blahblah",
"globalId": "foo:3127",
"id": "3127",
"objectTypeAttribute": {
"workspaceId": "blahblah",
"globalId": "foo:151",
"id": "151",
"name": "project",
"label": false,
"type": 6,
"description": "JIRA Project",
"editable": true,
"system": false,
"sortable": true,
"summable": false,
"indexed": true,
"minimumCardinality": 0,
"maximumCardinality": 1,
"removable": true,
"hidden": false,
"includeChildObjectTypes": false,
"uniqueAttribute": false,
"options": "",
"position": 4
},
"objectTypeAttributeId": "151",
"objectAttributeValues": [
{
"project": {
"avatarUrl": "https://bar.atlassian.net/rest/api/3/universal_avatar/view/type/project/avatar/10414",
"id": "10224",
"name": "Log Archive Project",
"key": "LOGARC"
},
"displayValue": "Log Archive Project",
"searchValue": "Log Archive Project",
"referencedType": false
}
],
"objectId": "648"
},

```

 

and I tried to create an object with every possible way

```

{
"objectTypeAttributeId": "151",
"objectAttributeValues": [
{
"value": "LOGARC"
}
]
}

```

 

```

{
"objectTypeAttributeId": "151",
"objectAttributeValues": [
{
"project":{"key": "LOGARC"}
}
]
},

```

 

```

{
"objectTypeAttributeId": "151",
"objectAttributeValues": [
{
"searchValue":"Log Archive Project"
}
]
},

```

 

etc..,

 

 

All my attempts were failed.

And I read this article

https://confluence.atlassian.com/jirakb/how-to-create-assets-objects-via-rest-api-based-on-different-attribute-type-1157475506.html

 

And I found it didn't mention 'Project' type attribute.

So I wonder how to create the object with 'Project' type attribute via REST API.

 

Thanks

1 answer

0 votes
백재현/DevOps May 21, 2024

Wow, I put 'project.id' into the 'objectAttributeValues[].value' then it's succeeded.

Suggest an answer

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

Atlassian Community Events