Copied to clipboard

Flag this post as spam?

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


  • Alex Gill 26 posts 61 karma points
    Nov 29, 2013 @ 14:54
    Alex Gill
    0

    Use the Umbraco API to interact with existing site from standalone app?

    So far with Umbraco my team have been using Courier to perform migrations from our Dev environment to Test, and then to Staging and then to Live. However, this process is a little time-consuming and prone to human error. What I would like to do is to write a small app for one-time use (or one-time-per-environment) each time we do a release.

    This is for tasks like creating new Document Types, adding Properties, setting Property values on particular nodes - etc, etc.

    I would like this to be a standalone app that can utilise the Umbraco API to connect to our DB on different environments.

    Is this possible?

  • julius 107 posts 289 karma points
    Dec 02, 2013 @ 01:59
    julius
    0

    I think you would have to expose the Umbraco API's through a web service and have your external app call those, because I don't think it's possible to call Umbraco APIs directly from an external application.

    It sounds like a pretty fun idea though. It might be faster and less error prone than doing it by hand. You could make the process more robust by creating web service methods for both creating and reading stuff like Document types.  Then you could create a new Document type and check if creation succeeded before you move to the next step.

     

  • julius 107 posts 289 karma points
    Dec 02, 2013 @ 02:02
    julius
    0

    Bear in mind though that you might be dealing with different node ids for the same documents, templates and doctypes on different environments. So if you are going to set node properties for example, don't select them by id, but by something like parent node + name + type.

  • Alex Gill 26 posts 61 karma points
    Dec 02, 2013 @ 10:22
    Alex Gill
    0

    Thanks for your reply, and I think you are right - I can't find any way to use the API from an external app. I think that for now what I will do is build a small wrapper around the Content and ContentType services, and expose that maybe through a web service or through a scripting shell. And thanks for your advice on node ids, you are correct there too. I believe that the node name must be unique (at least this seems to be the case from my testing) so yes, I will expose a GetByName function instead of GetById.

  • Biagio Arobba 16 posts 36 karma points
    Oct 17, 2014 @ 21:55
    Biagio Arobba
    0

    Hi, I am working on something similar, hoping to migrate from a console application. I saw something about Umbraco.Web.Standalone to provide context, but it looks like this is currently internal to the library. http://our.umbraco.org/forum/developers/api-questions/45458-WinForm-Using-Umbraco-ApplicationContextCurrent

    So, I might just need to expose a service. Were you able to figure out a way to accomplish a migration without exposing a service?

  • Alex Gill 26 posts 61 karma points
    Oct 20, 2014 @ 10:41
    Alex Gill
    0

    No, I never figured it out, we are still doing manual migrations :'(

    That's an interesting link, did you have a look at the console project? https://github.com/sitereactor/umbraco-console-example

Please Sign in or register to post replies

Write your reply to:

Draft