Start a siteSync programatically - General Discussions - General Discussions - Progress Community
 General Discussions

Start a siteSync programatically

  • Start a siteSync programatically
  • I want to start a siteSync programatically when some other event happens.

    I am working on version 6.3

     I've been trying to make it work by use of the /sitefinity/services/sitesync/sitesyncservice.svc

    I initially tried to use the class that the service itself uses, but could not find it...

      Service="Telerik.Sitefinity.Modules.SiteSync.Web.SiteSyncService"  (where is this ???)

    so my next attempt was to make an http post to sitesyncservice.svc/StartSync with the json object that I got from a manual sync thru chrome's developer tools

    it goes something like this:

    "Types":["Telerik.Sitefinity.Events.Model.Calendar","Telerik.Sitefinity.Events.Model.Event","Telerik.Sitefinity.Taxonomies.Model.Taxonomy","Telerik.Sitefinity.Taxonomies.Model.Taxon","Telerik.Sitefinity.GenericContent.Model.ContentItem","Telerik.Sitefinity.Libraries.Model.DocumentLibrary","Telerik.Sitefinity.Libraries.Model.Document","Telerik.Sitefinity.Forms.Model.FormDescription","Telerik.Sitefinity.Libraries.Model.Album","Telerik.Sitefinity.Libraries.Model.Image","Telerik.Sitefinity.Lists.Model.List","Telerik.Sitefinity.Lists.Model.ListItem","Telerik.Sitefinity.News.Model.NewsItem","Telerik.Sitefinity.Pages.Model.PageTemplate","Telerik.Sitefinity.Pages.Model.PageNode","Telerik.Sitefinity.Libraries.Model.VideoLibrary","Telerik.Sitefinity.Libraries.Model.Video","Telerik.Sitefinity.Pages.Model.ControlPresentation"],
    "TypeFilters":null,
    "Schedule":null,
    "ServerId":"<receiving serverId here, from SiteSyncConfig.config>",
    "UserId":"00000000-0000-0000-0000-000000000000",
    "SummaryId":"00000000-0000-0000-0000-000000000000",
    "TotalItemsCount":0,
    "IsStopRequested":false

    this was giving me (401) unauthorized, I added basic authentication with the account that I set up at the receiving instance, and then it gives me (403) forbidden.

    I tried doing a /RequestValidation first like the backend UI does, but that call is also giving me the (403) forbidden.

    If anyone can help, it would be greatly appreciated.

  • 735ece81-88b5-4893-a709-148d4bbbf5c9_Sync-API.rar
    Hi Ernesto,

    Public SiteSync API has not been fully developed and so for the time being we do not have any documentation on it. However there are some ways you can take advantage of the already available implementations. Please find the attached archive that consists of an excerpt with an example on how you can trigger syncing through API. Please note this is still work in progress and it might be changed in future. I would also suggest to test this on a safe environment.

    Regards,
    Pavel Benov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  • Thank you Pavel,

    I tried the approach that you provided in the word document, but I could not find the SiteSync facade for App.WorkWith() ...

    Somehow on version 6.3.5000 it is done differently because the physical DLL Telerik.Sitefinity.SiteSync does not exist, so the classes must be in some other DLL but I have not been able to find them.

     

  • Hi Ernesto,

    Sorry for my previous response. I forgot to mention this is introduced in Sitefinity 7.0+ versions. You could try a test upgrade in order to try out the API. Any further feedback you can give us is highly appreciated.  

    Regards,
    Pavel Benov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  • So I upgraded to version 7.0.

    SiteSync broke, clicking on "Test Connection" did nothing, so I removed the receiving server to add it back again.

    and when clicking "Add this server"

    url http://<sending site>/Sitefinity/Services/SiteSync/SiteSyncService.svc/RequestTargetSites/?url=<receiving site>&userName=<username>&password=<password>&provider=&unv_tstmp_prn=140355555555

    comes back with a 404 not found.

    I am not sure how to go about to fix this...

  • I got it :D

    looks like it will sync, fingers crossed....

    I had to take the new SiteSyncService.svc file from a 7.0 install and copy it over the version I had in my instance (6.3), normally I just copy over everything in the bin folder for an upgrade, I'll see if any other service files are needed.

    This part changed

     Service="Telerik.Sitefinity.SiteSync.Web.SiteSyncService"

     

     

  • Hi Ernesto,

    I am glad you were able to overcome the problem. Do not hesitate to write back if any further complications may arise.

    Regards,
    Pavel Benov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  • Hello Pavel,

    I am now on version 7.0 and trying to kick a sync programatically.

    I am following the code you provided in the word document, but am getting a fatal error

     

    [7/28/2014 11:41:28 PM] Sync task 376aaf60-81b5-64c2-a3a8-ff0000665429 encountered a fatal error:<br>System.NullReferenceException: Object reference not set to an instance of an object.<br>   at Telerik.Sitefinity.SiteSync.SyncingManager.InitializeSummary(DateTime startTime, SiteSyncExportContext context)<br>   at Telerik.Sitefinity.SiteSync.SyncingManager.InitializeSync(SiteSyncExportContext context)<br>   at Telerik.Sitefinity.SiteSync.SyncingManager.Sync(SiteSyncExportContext context)<br>   at Telerik.Sitefinity.SiteSync.SiteSyncTask.ExecuteTask()

     this is the code I am calling

    string[] typesToSync = new string[] "Telerik.Sitefinity.Pages.Model.PageNode" ;
     
     
    using (var sync = App.WorkWith().SiteSync())
        sync.SelectDefaultTarget().Sync(typesToSync);

    I had all the types in the string array, with the same error.

    There are not much members I can play with on these facade objects so I do not know what to do...

    Since there is no documentation I can find, I am relying on you to solve this quickly.

    Thanks for the prompt response.

    Some other information:

    I can do a sync manually just fine. The sync throws some fails and other successes, but programatically, looks like it does not even start because of the "reference not set to an instance of an object".

    I have just one receiving server in my configuration.

     

     

  • Hi Ernesto,

    Unfortunately Pages are not synced with the current state of the SiteSync API. You will have to use the UI for syncing PageNode, PageData etc. objects.

    Regards,
    Pavel Benov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  • @Pavel, you sent me a word document (attached on earlier post in this thread) with code to start a sync programmatically...

    Was this functionality hidden/taken-off and that is why it is not available anymore ?

    Can I somehow emulate what the UI does and start a sync with some code?

     

  • Hi Ernesto,

    As I have said in my reply from 05.07.2014 this is still a work in progress. Although available as API in 7.0 it is not officially announced and therefore not supported. This is basically a Beta version of the SiteSync API and will be further developed and modified, extended etc. We will announce it officially when it is ready and fully tested. We will also provide code samples in our Documentation, but for now you can only use the calls for content such as News, Events etc.

    Regards,
    Pavel Benov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  • @Pavel, do you know if the status of this changed with version 7.2 ?

  • Hello Ernesto,

    Our dev team is putting all efforts into enhancing our core modules, so there is currently no progress on the anticipated SiteSync API official introduction.

    You can keep tracking our General Discussions thread for our latest implementations and also our Product Roadmap section.

    Regards,
    Vassil Vassilev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  • Hello Andrew,

    You cannot sync data to multiple nodes with one sync in our latest release.

    Currently you have to change the destination after each sync in order to have all up-to-date.

    Regards,
    Vassil Vassilev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items