How to import Assets object schema using REST API




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

Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles 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 provides REST API endpoint that can be used to run object schema import in the background (thus avoids 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 - Getting issue details... STATUS

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). Export file name is the exported .zip file containing object schema, already present in $JIRA_HOME/import/insight directory.

    {
      "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.

    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:

    $ 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






Last modified on Feb 1, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.