My project requires me to find some way to execute an important on an Umbraco site from a simple console app. I know that I can use the Usync API to trigger an import from the site itself:
var uSyncBackOffice = new uSyncBackOfficeContext();
var actions = uSyncBackOffice.ImportAll();
Essentially what my program will do is:
Transfer content from usync/data from site A to the corresponding folder on site B.
Trigger an import on site B.
Assuming that the program has the necessary permissions on the host server and of course the usync nuget package onboard, how would I write this?
I'm assuming the I need to initialize a uSyncBackOfficeContext but I couldn't find any methods for defining an IIS site or any other connection settings. I am also aware that Arron Powell's Chauffeur might be able to do this for me but it seems outdated or incomplete as I haven't been able to find a version I can compile.
Yes, I'm looking at the uSync.Chauffeur class library now, but I was wondering if you had some sample code or some boilerplate command line app to get started? Because, as far as I can see, uSync.Chauffuer doesn't include any executable, just class libraries.
Update
I wasn't aware that Chauffeur was to reside in the Umbraco site's bin-folder. Blaming it on poor documentation. ^^ You can disregard my answer. I will try this on my end and mark your answer as the solution if it works.
but you have to be authenticated by umbraco to do that.
if you wrote your own. you could make it unauthenticated so it could be called from somewhere else. but you would want to secure it somehow (iis restrictions or keys or something)
Triggering import/export on Umbraco-sites from external command line
My project requires me to find some way to execute an important on an Umbraco site from a simple console app. I know that I can use the Usync API to trigger an import from the site itself:
Essentially what my program will do is:
Assuming that the program has the necessary permissions on the host server and of course the usync nuget package onboard, how would I write this?
I'm assuming the I need to initialize a uSyncBackOfficeContext but I couldn't find any methods for defining an IIS site or any other connection settings. I am also aware that Arron Powell's Chauffeur might be able to do this for me but it seems outdated or incomplete as I haven't been able to find a version I can compile.
As if by magic : )
https://www.nuget.org/packages/uSync.Chauffeur/
you can trigger imports from the command line with this.
sort of docs here : https://github.com/KevinJump/uSync/blob/Dev-v7_4/Jumoo.uSync.Chauffeur/uSyncDeliverable.cs#L225
Yes, I'm looking at the uSync.Chauffeur class library now, but I was wondering if you had some sample code or some boilerplate command line app to get started? Because, as far as I can see, uSync.Chauffuer doesn't include any executable, just class libraries.
Update
I wasn't aware that Chauffeur was to reside in the Umbraco site's bin-folder. Blaming it on poor documentation. ^^ You can disregard my answer. I will try this on my end and mark your answer as the solution if it works.
if you need to trigger something across sites then you might be better putting an API end point in that you can hit remotely.
so if you look at something like https://github.com/KevinJump/uSync/blob/Dev-v7_4/Jumoo.uSync.BackOffice/Controllers/uSyncBackOfficeController.cs#L31
you can actually hit an import via the url
/umbraco/backoffice/usync/uSyncBackOffice/ImportAll
but you have to be authenticated by umbraco to do that.
if you wrote your own. you could make it unauthenticated so it could be called from somewhere else. but you would want to secure it somehow (iis restrictions or keys or something)
That was my original solution but it might not be an option due the way our production IIS is set up.
is working on a reply...