How to create Asset schema structure for External Import

Frederic Wolf
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 7, 2023

Hi,

i havean existing Schema in Assets and i would like to create an External Importer, but ONLY for one partof the structure.

I createda basic structure but it did not work as expected, asit created a complete new object type in the schema.

Is there any possibility to get the current schema. I think it will be very difficult to create the Schema as JSON format description and it takes much much time to do it, because it is very big.

My Structure is like this:

2023-12-08 00_52_19-Object Schema - Jira und 16 weitere Seiten - Geschäftlich – Microsoft​ Edge.png

 

I have added the MDE ObjectType. MDEs are Handhelds. In this case mostly ZEBRA Devices.

We have a Device Management for this and we want to import and update the devices into Assets. 

I have created the following mappingstructure:

 

{
  "$schema""https://api.atlassian.com/jsm/assets/imports/external/schema/versions/2021_09_15",
  "schema": {
    "objectSchema": {
      "name""Inventory",
      "description""Data imported from Script by ***",
      "objectTypes": [
        {
          "externalId""object-type/MDE",
          "name""MDE",
          "description""MDE GerAEt von ",
          "attributes": [
            {
              "externalId""object-type-attribute/name",
              "name""Name",
              "description""Device Unique Identifier",
              "type""text",
              "label"true
            }
          ]
        }
      ]
    }
  },
  "mapping": {
    "objectTypeMappings": [
      {
        "objectTypeExternalId""object-type/MDE",
        "objectTypeName""MDE",
        "selector""MDE",
        "description""Mapping for MDE",
        "attributesMapping": [
          {
            "attributeExternalId""object-type-attribute/name",
            "attributeName""Name",
            "attributeLocators": [
              "Name"
            ],
            "externalIdPart"true
          }
        ]
      }
    ]
  }
}
AND the following date import
{
  "data": {
    "MDE": [
      {
        "Name""Imported MDE"
      }
    ]
  },
  "completed"true
}

2023-12-08 01_03_03-Object Schema - Jira und 16 weitere Seiten - Geschäftlich – Microsoft​ Edge.png

But as you can see it created the new objectType and imported the object.

But i want to import into Company Assets/Hardware/MDE..
How can i do this?

There are many references and inherited attributes and the first look into the json schema structure looked like much much work.

Thank you for your help

2 answers

0 votes
Pedro Arroyo May 24, 2024

Hi,

I've played a little bit now with Assets to actually answer your question :)

> Is there any possibility to get the current schema

Yes. Do `GET /schem-and-mapping` this will return the full JSON representing the schema and mapping configurations.

> But i want to import into Company Assets/Hardware/MDE..

Your schema JSON would need to describe the whole tree down to where you want to add MDE. The mapping, though, does not need the hierarchy. There you only need to say how you want the import to map the attributes tying it all together by  means of the externalId.

0 votes
Pedro Arroyo March 25, 2024

Hi,

I'm new to Jira Assets, but as I've been reading documentation and seeing your screenshots, could it be that your `externalId` is wrong and points to the root of the classification instead of Company Assets/Hardware/MDE? 

Let me know, as I'm embarking on a quest like yours ;) 

Best,

Pedro

Suggest an answer

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

Atlassian Community Events