Copied to clipboard

Flag this post as spam?

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


  • zib95b 14 posts 93 karma points
    Mar 28, 2018 @ 11:45
    zib95b
    0

    Using the API examples

    Hi,

    I have successfully connected to an external API using Postman, and I want to incorporate it into Umbraco. Is there an example anywhere on how to:

    • set up the API connection
    • pass API objects into a list view
    • pass each object into another detailed view

    Let me explain with an example. I want to pass all events into a list view, and then have a view for each individual event.

    Are there any tutorials/starting pointers to achieve this?

  • Nik 1614 posts 7260 karma points MVP 7x c-trib
    Mar 28, 2018 @ 13:02
    Nik
    0

    Hi Kamil,

    Are you trying to access the 3rd party API in the Umbraco back office, or are you trying to use it for part of the front end of the website?

    In either scenario, how do you want to use the data from the 3rd party?

    Thanks,

    Nik

  • zib95b 14 posts 93 karma points
    Mar 28, 2018 @ 13:05
    zib95b
    0

    Hi Nik,

    To clarify; by event, I meant an event in the sense of a thing that happens (a concert, a show), and not an Umbraco event. I'm trying to bring data from external API into front end of the website.

    I want to use JSON values in an object like image, description etc, to generate an event.

  • Nik 1614 posts 7260 karma points MVP 7x c-trib
    Mar 28, 2018 @ 13:11
    Nik
    0

    Okay, so I would start by looking into Umbraco Routing and rendering. Specifically, I would look at Custom MVC routes and Render MVC Controllers

    Using these you could create an "Events" node in Umbraco which stores your details of your API you need to call, plus any intro text etc for your listing page.

    Then by hijacking the routes and the rendering you could allow artificial pages to exist that display event specific information.

    For example,

    Your node might be /Events, then each individual one could be /Events/EventName.

    Your custom controller could then make the required API calls to get the event details and return a typed model to a custom view.

  • zib95b 14 posts 93 karma points
    Mar 29, 2018 @ 08:41
    zib95b
    0

    How could I do this on a uSkinned installation with ModelsBuilder enabled? Would it be largely the same?

    Could I create a content page in the back office, and then somehow store API data in the created template?

  • Nik 1614 posts 7260 karma points MVP 7x c-trib
    Mar 29, 2018 @ 08:48
    Nik
    0

    Hi Kamil,

    I don't know anything about uSkinned I'm afraid, however, yes, I would imagine it would be largely the same.

    If you don't want editors setting the API settings, you could look at storing them in webconfig instead and accessing them from there.

    I'm also making the assumption that you are using Visual Studio, or similar IDE to help with the creation of your site.

    Thanks,

    Nik

Please Sign in or register to post replies

Write your reply to:

Draft