Rest api rest/api/content to fetch macro content is throwing 404 from Spring service

Hi Team,

I am trying to fetch macro body in my spring boot service class using the below code

 String MACRO_API = "%s/rest/api/content/%s/history/%s/macro/id/%s";

        ResponseEntity<String> resp = atlassianHostRestClients.authenticatedAsAddon()
                .getForEntity(String.format(MACRO_API, baseURL, pageId, pageVersion, macroId), String.class);

It is throwing 404 Not Found: "{“message”:"null for uri: /wiki/rest/api/content/72679427/history/3/macro/id/c86f9728-c374-4500-bd3d-3779a094db07

I have enabled restTemplate and http wire logging .But as the request auto authenticated by connect spring framework, not sure what to look for. Can some one guide on this ?

where as the same url in browser is giving proper response. Can some one shed some light on this ?

Hi @AparnaMokkapati ,

The URL will need to be absolute - I presume it’s automatically injected by the framework and omitted from the error message, but it’s interesting that we can see ‘/wiki’ prepended.


1 Like