Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Mike 10 posts 73 karma points
    Mar 04, 2015 @ 22:41

    Automate Import

    I have two environments A and B. I'm trying to write a script that is triggered by our continious integration servers that will uSync all content from B into A.

    So far my script copys everything in B's uSync\content folder to A's uSync\content folder but I have to manually log into A and click "import" in uSync to have it import all the content.


    Is there a way I could automate this? Even if there is a url I could have my script send a request to that would work.

  • Kevin Jump 2145 posts 13579 karma points MVP 6x c-trib
    Mar 04, 2015 @ 23:32
    Kevin Jump


    there isn't a built in remote command, but you could write an api controller that calls ImportDiskContent on the ContentImporter Class, then uSync would kick off a fill import of what is on the disk, then you could just call the URL of the APIController and that would be able to start the import ? 

    probibly along the lines of (and i am typing this here, so this is just psudo code).

    public SomeApiContoller : UmbracoAPIController 
      public bool DoUsyncImport()
        var usync = new jumoo.usync.content.ContentImporter();


    http://site/umbraco/api/SomeApi/DoUsyncImport - would kick pff the import (i think)

  • Kevin Jump 2145 posts 13579 karma points MVP 6x c-trib
    Mar 04, 2015 @ 23:39
    Kevin Jump

    HI just realised it's slightly more involved, you also need to import media, and then map id's - it's actually the code in the ui class that is behind the import button. (here

    but that just means it's three calls in the controller.

    ContentImporter ci = new ContentImporter(); 
    int contentCount = ci.ImportDiskContent();
    MediaImporter mi = new MediaImporter();
    int mediaCount = mi.ImportMedia();
    // we map ids at the end..
  • keilo 566 posts 1021 karma points
    Nov 08, 2015 @ 17:00

    I have to say this is brilliant! being able to sync two environments on demand with three calls...

Please Sign in or register to post replies

Write your reply to: