Fork me on GitHub
DNN Apps - Demo-Zone
Discover DNN-Apps - simple and elegant, easy to customize
You are here: Home  >  Apps  >  Tutorial WebApi - Basic

    Tutorial WebApi - Basics

    This is a very simple tutorial. To try/experience it, just install the App in your 2sxc. 

    This needs 2sxc 6.5 to work. 

    This is the App in the catalog.

    Very simple WebAPI calls

    A simple call returning just one value

    The folowing example will call a JavaScript function called AskForYear. That simple script will basically call the API controller SimpleDemoRequests and ask it for CurrentYear. The result will be shown in a JavaScript alert. Note that the AskForYear([Module:ModuleId]) will be parsed by the server into AskForYear(622) or something similar, so the JS call will never see the square brackets.
    Let's try it: Very simple test - ask for year

    A call returning multiple values

    This will call a Javascript called AskWebApiForModuleInfos. That simple script will basically call the API SimpleDemoRequests and ask it for GetModuleInfo. The result will be shown in a JavaScript alert.
    Let's try it: Very simple test - just get some module infos.

    Retrieve a list of something

    This will call the JS GetArrayOfDays just to get a list of something back. Try it: Get array of days

    Retrieve a list of category-entities from 2sxc

    Try it: Get categories

    2serve . 2invent . 2create is 2be.