Running Macro via REST service

Yang Wen asked on September 3, 2016 09:28

Trying to utilize the macro REST API. For example: /rest/macro/CurrentSite.SiteName

This seems to work only for a user with the Global Admin priviledge.

In the debug log, I see this security check that's associated with my request attempt with a user that is not a Global Admin.

Operation: IsGlobalAdministrator    Result: False   Context: RESTService.GetMacroResult

So is the macro REST API only accessible for the GlobalAdmin? I've tried to look through the permission module and do not see anything obvious to affect this security check. Thanks

Recent Answers


Jan Hermann answered on September 3, 2016 13:14

Well, yes. Macros are very powerful and you could workaround standard permissions by requesting something that shouldn't be available for anyone else than administrators like /rest/macro/SystemContext.WebApplicationPhysicalPath

0 votesVote for this answer Mark as a Correct answer

Yang Wen answered on September 3, 2016 15:43 (last edited on September 3, 2016 15:52)

My intend is to leverage the Macro REST API to get current user's profile information for an SPA app I'm building, which is hosted in the filesystem under Kentico_Root/CMS. Since I'm unable to use K# or .NET syntax in my SPA's markup, Is there a better alternative to get access to current user's profile?

0 votesVote for this answer Mark as a Correct answer

Jan Hermann answered on September 6, 2016 16:24

Why don't you access user object directly like:

/rest/cms.user/<userid>

0 votesVote for this answer Mark as a Correct answer

Yang Wen answered on September 6, 2016 17:02

Even with that approach I still need to know the current user's Id. I wanted to leverage the macro engine to provide the current user's info.

I ended up just injecting the current user info via a Webpart. Of course with his approach, I had to paste my spa markup into a page layout.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.