How to import Assets object schema using REST API

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Assets provide a REST API endpoint that can be used to run object schema import in the background (thus avoiding the need to import object schema through a browser). This can be beneficial if browser timeout occurs in case the user is importing a large schema, or if the user runs into the following bug: 

JSDSERVER-15086 - Importing Object Schema ends up in error and does not import any objects

Environment

Assets standalone / JSM-bundled version

Solution

  1. Prepare a payload file called "data.txt", with the following content (replace <export file name>, <object schema key>, and <object schema name> with real values from your instance). The export file name is the exported .zip file containing object schema, already present in$JIRA_HOME/import/insightdirectory.

    1 2 3 4 5 6 7 8 { "fileName": "<export file name>.zip", "importAttachments": true, "importObjectAvatars": true, "includeObjects": true, "objectSchemaKey": "<object schema key>", "objectSchemaName": "<object schema name>" }
  2. Send two POST requests against the following endpoints, and pass the payload file while sending both requests (replace <Jira base url> with your Jira base URL). You can use Postman or some other REST client to send those requests.

    1 2 https://<Jira base url>/rest/insight/1.0/objectschemaimport/import/server/nowarning https://<Jira base url>/rest/insight/1.0/objectschemaimport/import/server

    Example - triggering both calls with curl:

    1 2 $ curl -d "@data.txt" -H "Content-Type: application/json" -u <username>:<password> -X POST https://<Jira base url>/rest/insight/1.0/objectschemaimport/import/server/nowarning $ curl -d "@data.txt" -H "Content-Type: application/json" -u <username>:<password> -X POST https://<Jira base url>/rest/insight/1.0/objectschemaimport/import/server

Updated on March 21, 2025

Still need help?

The Atlassian Community is here for you.