Skip to main content
10-Marble
October 26, 2021
Solved

Automated Import of Project Entities

  • October 26, 2021
  • 1 reply
  • 2982 views

What is the best way to automate the Import step of this sequence?

  1. Export Entities (with GitBackup Extension)
  2. Commit to Git Repo
  3. Preferably: Create Zip of All Entities
  4. Import (Zip of) All Entities into Another ThingWorx Environment
    • Preferably, without first uploading to TWX Storage.

Research Findings:

  • Docs show Export offers a zip option, but Import does not appear to. ??
  • There is a little-known FileRepositoryUploader REST API, which could be used to upload a zip, but I find no way to Import a zip.
    • Is there a remote way to unzip an uploaded zip into SourceControlRepository?
  • The title of the Import and Export Entities section of Use REST API to Access ThingWorx implies it holds the answer, but then discusses ExtensionPackageUploader API. 
    • Can this be used to import zipped Entities that are not a formal Extension??

This seems like an obvious use case that would have a clear solution, but I cannot find it.  I'd prefer not to iterate though each Entity XML, calling the Importer API for each file.  I'm also concerned about dependency order issues doing that.  

 

What is the suggestion for the best solution?

 

Thanks, Mike

 

PS - Is there a REST API Reference somewhere?  This page is incomplete.

PS - I find no Solution Central API documentation indicating it could be used for this use case.

Best answer by MikeMurray

That's good to know.  I found REST API Design, and a developer showed me how to traverse the TWX App to figure out what APIs are available.  I can't find any reference to 'upload' (FileRepositoryUploader) or ImportSourceControlEntities in the Javadoc though.

 

So this would be the sequence:

  1. Export Entities (with GitBackup Extension)
  2. Commit to Git Repo
  3. Create (and Publish) Zip of All Entities
  4. FileRepositoryUploader Zip to SourceControlRepository
  5. ExtractZipArchive to SubFolder for Import
  6. Import SourceControlEntities (have to find API)
    • need to determine how to handle obsolete entities

1 reply

22-Sapphire I
October 27, 2021

There is Unzip available on 'FileRepository' and after unzip you can import from FileRepository

10-Marble
October 27, 2021

Is that available as a REST API, or only as a ThingWorx service method

 

I'm not a TWX developer, but I assume trying to use a service leads to complexity at best, and a bootstrapping wall at worst.   

 

Thanks, Mike

22-Sapphire I
October 27, 2021

All available as REST API calls, every ThingWorx service is in essence a rest api call