How to create Asset schema structure for External Import
Asked by Frederic Wolf:

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](https://community.atlassian.com/t5/image/serverpage/image-id/295851iF34F49986FDE295F/image-size/large?v=v2&px=999 "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](https://community.atlassian.com/t5/image/serverpage/image-id/295852i8F93375AD02FE734/image-size/large?v=v2&px=999 "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


Answers:
author: Pedro Arroyo
body: 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.


author: Pedro Arroyo
body: 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


Tags: cloud

jira-service-management

jira-service-management-cloud