Search code examples
dotnetnuke-module2sxc

display 2sxc application api data over browser without knowing moduleId


I know how to use 2sxc api data from 2sxc api with:

$2sxc(moduleId).webApi.get("AppName/MethodName",...

but how about to call this data for some Anonymous user from another domain or web browser?

What is the url for method and what headers I must provide when calling, and is it posible that I call this method without special headers direc from browser?


Solution

  • This is possible, but at the moment the only easy way is when using visual queries. There you can set permissions to anonymous, and then use a schema a bit like

    /desktopmodules/2sxc/api/app-query/[app-name]/[query-name]

    see also https://github.com/2sic/2sxc/blob/master/WebApi/RouteMapper.cs#L34

    for other uses - own api etc. we would need to implement it first, or you could contribute that :)