Resolving macros in REST API?

Tevin Steinke asked on December 23, 2014 20:35

I have a document type field that stores macros, and I am using the REST API to query and display this field.

Is there a way that I can set it up so that the macros are resolved? As it is now, they are displayed inside of the curly braces with the macro signature.

Recent Answers

Zdeněk Cetkovský answered on December 26, 2014 04:57


Macros are resolved in the application context, so when you receive a receive a response to REST get query, any macros in document field value are obviously not resolved. If you're doing this in the context of the Kentico (CMS) application, you can call API method for macro resolution:

MacroResolver.Resolve("string containing macro expressions")

Then it would make more sense to get the document data directly, not via REST. I suppose you would really like to resolve the macros before the document data are sent as a response to REST request. That's however not how our macros work... It might be still possible to call API and controls from outside Kentico instance, but the need to use REST is then also questionable. Another option would be to resolve macros via subsequent REST queries:




This evaluates the given macro expression and serializes the result. Only works for macros that return a serializable result.

When creating the macro expression, do NOT add the encapsulating bracket characters. Also, use URL encoding for forbidden URL characters

Again, this may not be exactly what you expect.

Should you need any additional details, please feel free to ask.

Best regards,


0 votesVote for this answer Mark as a Correct answer

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