Uploaded image for project: 'Confluence Cloud'
  1. Confluence Cloud
  2. CONFCLOUD-62781

Context parameters sent by the New Confluence editor is incorrect and results to 404

    XMLWordPrintable

Details

    Description

      Summary

      When defining a dynamicMacro:

      "dynamicContentMacros": [
      	{
      	  "url": "/hello-world?pageId={page.id}&pageVersion={page.version}&macroId={macro.id}&macroBody={macro.body}",
      	  "key": "anne-inspector-sketch-confluence",
      	  "name": {
      	      "value": "Anne Inspector Sketch"
      	  },
      	  "categories": ["media"],
      	  "outputType": "block",
      	  "bodyType": "rich-text",
      	  "featured": true,
      	  "width": "100%",
      	  //some more code..
      	}
      ]
      

      and using the context parameters in REST API calls:

      app.get('/hello-world', addon.authenticate(), function (req, res) {
      	    // Rendering a template is easy; the `render()` method takes two params: name of template
      	    // and a json object to pass the context in
      
      	    console.log(`pageId= ${req.query.pageId}`);
      	    console.log(`pageVersion= ${req.query.pageVersion}`);
      	    console.log(`macroId= ${req.query.macroId}`);
      
      	    let httpClient = addon.httpClient(req);
      
      	    httpClient.get({
      	        url: `rest/api/content/${req.query.pageId}/history/${req.query.pageVersion}/macro/id/${req.query.macroId}`,
      	        contentType: 'application/json',
      	        json: true,
      	        body:{"fields":{"customfield_10015":"SCRUM-4"}}
      	    }, (error, res, body) => {
      	        console.log(JSON.stringify(error, null, 2));
      	        console.log(JSON.stringify(body, null, 2));
      	        console.log(JSON.stringify(res, null, 2));
      
      	        render(JSON.stringify(body, null, 2));
      	    });
      	}
      );
      

      An error is encountered:

      {  
         "statusCode":404,
         "data":{  
            "authorized":false,
            "valid":true,
            "errors":[  
      
            ],
            "successful":false
         },
         "message":"No macro found on content id : ContentId{id=11763746} with version: 1 and macroId: 80255a80-67db-49ce-add6-eee45e4cc2cb"
      }
      

      Unlike the old editor, where a valid response is returned:

      Steps to replicate

      1. Create a fresh ACE app
      2. Define a dynamicMacro (see above)
      3. From the index.js, modify the /hello-world route and add an httpClient get call
      4. Create a blog (this is where the new editor feature is on)
      5. Add dynamic macro and enter some text and publish
      6. Notice an error is encountered. Compare these with a page content

      Workaround

      None

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              acalantog Anne Calantog
              Votes:
              2 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: