Wrong macroId comes through context params when macro renders in macro borwser preview

I have dynamicContentMacro:

"dynamicContentMacros": [
        "name": {
          "value": "My Macro Name"
        "key": "my-macro-key",
        "url": "/macro?pageId={content.id}&pageVersion={content.version}&macroId={macro.id}",
        "width": "1px",
        "height": "1px",
        "renderModes": {
          "default": {
            "url": "/macro-static?pageId={content.id}&pageVersion={content.version}&macroId={macro.id}"
        "description": {
          "value": "Description for my macro"
        "icon": {
          "width": 16,
          "height": 16,
          "url": "/images/macro.png"
        "documentation": {
          "url": "https://docs.my-macro.com"
        "categories": [
        "outputType": "block",
        "bodyType": "rich-text",
        "parameters": [
            "identifier": "type",
            "name": {"value": "type"},
            "type": "enum",
            "required": true,
            "defaultValue": "easy",
            "values": [

On the server side i make rest call to “/rest/api/content/” + pageId + “/history/” + pageVersion + “/macro/id/” + macroId" for getting macro content.

When I create page(without any restrictions) with this macro through “rest/api/content”, then go to editor and open macrobrowser in preview section i get this:

{"statusCode":404,"data":{"authorized":false,"valid":true,"errors":[],"successful":false},"message":"No macro found on content id : ContentId{id=418578433} with version: 1 and macroId: d3e43d661cd16d4e0864f4cab3cbc57f"}

As i can see in editor markup macroId param contains other hash(call to “/rest/api/content/” + pageId + “/history/” + pageVersion + “/macro/id/” + macroId" returns the right content).

But, if i save content(press “publish” in editor) and come to editor again preview works fine.

Any suggestions?

@ykleshchenok I don’t know if I’m getting it right, but I think the behaviour you’re getting is expected. Until you actually save the page (macro included), the macro does not have an id yet.
According to the documentation:

Preview Mode: If you use the {macro.id} in your URL, the REST api will not return the macro body during a preview request, because the page has not been saved yet.

For that reason, after you publish the page and the macro, when you get back to the page editor you can see the preview as expected.


@lfcgomes hi! It was an issue with macrobrowser, that, i beleive, was fixed 2 years ago :smiley: And it’s totally not connected with macro body, sorry :smiley:

1 Like