Forums

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

Insight-Cloud create multiple objects via API

Mathias Scheck February 8, 2022

Hey,

unfortunately, I cannot find a REST-API-endpoint for creating multiple Insight-objects (does such a endpoint exist, where you can POST a Json-Array of objects to create?).

So, I´m trying to create multiple (single) Insight-objects via sequential REST-API-calls (endpoint: POST /jsm/insight/workspace/{workspaceId}/v1/object/create), but it will only create the first item, the other REST-calls give me an error 500 (Internal Server Error).

I use Basic-Auth for authentication with Username/API-Token. Could the problem be solved with using the Session-ID instead of Basic-Auth?

Ah, before I forget ... I use Insight on Cloud.

BR,

Mathias

1 answer

1 accepted

2 votes
Answer accepted
Mathias Scheck February 8, 2022

Ok, found the issue... an Enum-Value i tried to create had a trailing space-sign.

For everyone, who has the same issue, precisely check if all uploaded Enum-Values (= Status- and Select-Fields) are identical to their in Insight-Attributes configured counterparts.

 

Issue resolved.

Rajesh Ale February 14, 2022

Hi @Mathias Scheck  can you share the sample payload for it, I'm also trying to create multiple objects in one single call. 

Mathias Scheck February 15, 2022

It´s not possible to create multiple Insight-objects in one single call afaik.

I´m sending multiple requests via POST at the Insight-endpoint: https://api.atlassian.com/jsm/insight/workspace/{workspaceId}/v1/object/create

via loop in my C#-tool that I´ve written.

 

In each request, I send a body like this:

{
"objectTypeId": "23", "attributes": [ { "objectTypeAttributeId": "135", "objectAttributeValues": [ { "value": "myValue" } ] }, { "objectTypeAttributeId": "144", "objectAttributeValues": [ { "value": "99" } ] } ] }

creating one object after another.

The request-body is described here: https://developer.atlassian.com/cloud/insight/rest/api-group-object/#api-object-create-post

 

 

Hint: If you want to update linked-objects (= referenced objects), you have to give the key of the object you want to reference as "value" like this:

"attributes": [
{
"objectTypeAttributeId": "300",
"objectAttributeValues": [
{
"value": "KEY_OF_LINKED_OBJECT"
}
]
},

as PUT on this endpoint:

https://api.atlassian.com/jsm/insight/workspace/{workspaceId}/v1/object/{id}

as described here: https://community.atlassian.com/t5/Jira-Software-questions/INSIGHT-How-to-Create-an-object-with-dependency-using-REST-API/qaq-p/1444790

 

I hope this will help you!

Like Romesh likes this
Rajesh Ale February 15, 2022

Thank you for the detailed explanation. I'm gonna do the same looping thing for now but wanted to see if there is a way to create all in one single call to jira cloud.

I'm glad you shared about linking objects (I didn't know about that earlier). Thank you !!

Mathias Scheck February 28, 2022

You´re welcome

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events