Copied to clipboard

Flag this post as spam?

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


  • Edgar Rasquin 326 posts 925 karma points
    May 03, 2021 @ 09:03
    Edgar Rasquin
    0

    How to get orders via webservice

    Hi there,

    has anyone an example of how to get all vendr orders via a webservice?

    I found an example by Matt how to get all orders by a customer

    https://gist.github.com/mattbrailsford/a9cc7768756ec87e30fa4494820bec27

    But I cannot adapt this to my webservice.

    Main problem is how to instantiate orderservice. In Umbraco v7 to instantiate ContentService I would just do it like so:

    var contentService = ApplicationContext.Current.Services.ContentService;
    

    Is there a similar way for the IOrderService?

    Thanks

  • Joep 96 posts 698 karma points
    May 03, 2021 @ 09:17
    Joep
    2

    Hi,

    The best way is to inject the IOrderService into your controller, if you are using one. Else you can do something like this:

    var orderService = Umbraco.Core.Composing.Current.Factory.GetInstance(typeof(IOrderService)) as IOrderService;
    

    Let me know if it worked!

    -Joep

  • Edgar Rasquin 326 posts 925 karma points
    May 03, 2021 @ 09:50
    Edgar Rasquin
    0

    Hi Joep,

    it works! Thank you very much for your help!

    Edi

Please Sign in or register to post replies

Write your reply to:

Draft