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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Automated Import of Project Entities

MikeMurray
9-Granite

Automated Import of Project Entities

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.

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

5 REPLIES 5
PaiChung
22-Sapphire I
(To:MikeMurray)

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

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

PaiChung
22-Sapphire I
(To:MikeMurray)

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

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
PaiChung
22-Sapphire I
(To:MikeMurray)

So the Upload and Import get a little tricky.

I believe you can see the API calls if you have the dev tools open and perform the function in composer (import source control entities) and if you put a file upload widget on a mashup and execute an upload it will show you that call.

Ideally your CD/CI puts the files directly into a TWX Repo

Top Tags