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