Copied to clipboard

Flag this post as spam?

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


  • German 3 posts 23 karma points
    Mar 24, 2015 @ 00:25
    German
    0

    blocked implementing api endpoint with controller

    Hi all,

    I am developing a site using Umbraco and so far it has been great. Unfortunately, I have been struggling for days with something and reading lot's of things but I can't get it to work. Also, I'm confused about the direction to take. 

    So, I thought I would ask. What I need is to have an endpoint to which I can do a GET request trough ajax and get back custom "event" data as json. The "events" are just content nodes in my umbraco installation.

    The json will then be used client side to render the specific presentation I need.

    This seems like basic stuff and that Umbraco totally supports it, but I can't get it. So, my questions:

    1. Should I use a Surface Controller or an Api Controller. What's the difference? Is Api a replacement for Surface but both are still supported for the time being?
    2. Where should I place my controller class? This isn't mentioned anywhere.
    3. Do I need to declare my controller anywhere to make it available?
    I have tried both controller types and keep getting 404's.
    I'm using Umbraco 7.1.8 on Windows 7 and IIS 7.5. VS2013 .NET4.5 and Umbraco was installed using nuget.
    Thanks in advance!

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 24, 2015 @ 05:14
    Jan Skovgaard
    0

    Hi German

    To me it sounds like you should have a look at using WebAPI, which you can read more about here https://our.umbraco.org/documentation/Reference/WebApi/

    Hope this helps.

    /Jan

  • German 3 posts 23 karma points
    Mar 24, 2015 @ 20:46
    German
    0

    Hi Jan,

    Thanks for the reply.

    I had already read that. I agree that seems the way to go, but the docuemnt doesn't give me much detail. For example, where should I create the controller? I'm working in a local installation done through nuget in VS2013. 

    Thanks,

    Germán

     

     

Please Sign in or register to post replies

Write your reply to:

Draft