Forums

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

How do I get Insight/Asset mapping set up via API?

Chris Thomas
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.
October 7, 2022

Let me start off by saying that I consider myself an advanced amateur with both API and JSON.

Where I am now

By importing CSV files I have a good handle on Insight and have a good idea of how I want to use it. Now I need to automate the import using PowerShell, but I am doing all testing in Postman as the PowerShell Insight module is no longer working.

I have a basic Insight Scheme set up:

Insight Scheme.PNG

I also have the import set up, key generated and working:

API Import.PNG

I am following along with this document: Insight external imports workflow (atlassian.com)

I am at the point where I am trying to set up mapping.

{
    "status""MISSING_MAPPING"
}

My current block:

My problem is that I can't get Insight to import any scheme I try, and I have tried a lot of variations and tried to search all over. I tried the two default schema files and get "

jsonValidationErrors" and when I tried to map my own very simple schema using those as templates, I get the same error.

{"jsonValidationErrors":[{"type":"required","code":"1028","path":"$","sc
hemaPath":"#/required","arguments":["schema"],"details":null,"message":"$.schema: is
missing but it is required"},{"type":"required","code":"1028","path":"$","schemaPath":"#/req
uired","arguments":["mapping"],"details":null,"message":"$.mapping: is missing but it is
required"}],"dataValidationErrors":[],"status":"error"}

If I can get the right format I could take it from there if anyone can help. However if I'm way off base in what I'm doing I would appreciate a pointer.

Right now I don't know what I need or how to format it and the examples are not explained and are very advanced at the moment with no context.

Any help?

Thanks for reading!

1 answer

0 votes
Boswell, Richard
Contributor
October 12, 2022

Here's a skeleton external imports schema and mapping payload:

{
  "$schema": "https://api.atlassian.com/jsm/insight/imports/external/schema/versions/2021_09_15",
  "schema": {
    "objectSchema": {
      "name": "My schema name",
      "description": "",
      "objectTypes": [
        {
          "name": "My object name",
          "description": "",
          "attributes": [
            {
              "name": "Name",
              "description": "",
              "type": "text",
              "label": true
            }, {
              "name": "Some other attribute",
              "description": "",
              "type": "text",
              "label": true
            }
          ]
        }
      ]
    }
  },
  "mapping": {
      "objectTypeMappings": [
        {
            "objectTypeName": "My object name",
            "description": "",
            "selector": "",
            "attributesMapping": [
              {
                "attributeName": "Name",
                "attributeLocators": [
                  "name"
                ],
                "externalIdPart": true
              },
              {
                "attributeName": "Some other attribute",
                "attributeLocators": [
                  "some_other_attribute"
                ],
                "externalIdPart": true
              }
            ]
        }
      ]
  }
}

Looking at your error message it seems like you don't have the schema and mapping keys defined.

I'm with you on the docs - I opened a FR asking for better ones ==> https://jira.atlassian.com/browse/JSDCLOUD-11886?filter=-2

Suggest an answer

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

Atlassian Community Events