Forums

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

Jira Assets : Import data via API : use existing objects/mapping?

thomas
Contributor
January 18, 2024

Hi,

I am trying to import lots of cloud assets into Jira Assets Cloud via script / automation.

Can we simply import data using the existing objects/schema and even mapping?

It seems not...

I have followed this guide and I came to realise that an import always requires an object (schema) to be created. You cannot use your existing schema objects you've created via the GUI despite this information in that same guide.

jira-import-inaccurate-blurb.png

It can't be right because when you look at the latest JSON schema from 2023-10-19, it states that `schema` is a required attribute and (empty is no go either).

When you omit schema or set it to `{}` then you'll end-up with this error

< PUT /jsm/assets/workspace/.../v1/importsource/.../mapping HTTP/1.1
< Host: api.atlassian.com
< User-Agent: python-requests/2.31.0
{"jsonValidationErrors":[{"type":"required","code":"1028","path":"$","schemaPath":"#/required","arguments":["schema"],"details":null,"message":"$.schema: is missing but it is required"}],"dataValidationErrors":[],"status":"error"}
o # OR if you use "schema": {}, then you end up having sub object requirement issues
{"jsonValidationErrors":[{"type":"required","code":"1028","path":"$.schema","schemaPath":"#/properties/schema/required","arguments":["objectSchema"],"details":null,"message":"$.schema.objectSchema: is missing but it is required"}],"dataValidationErrors":[],"status":"error"}

So what's the go? How do people bulk import/update assets in Jira Assets?

Does it mean you can only drive assets using the API if you also drive the objects themselves? (greenfield)

1 answer

1 vote
Pedro Arroyo May 24, 2024

Hi,

You cannot use your existing schema objects you've created via the GUI despite this information in that same guide.

Actually, you can. You can create and configure you Assets schema as you need, and then create your external import as the guide explains. Use the baseUrl from the Imports Links and call GET /schema-and-mapping and you'll get the JSON where you can add the objectTypeMappings.

Andrea Robbins
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!
November 21, 2024

this tip is a lifesaver, thank you soooo much! I was so curious where those external ids were coming from!

Suggest an answer

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

Atlassian Community Events