RenderResultBundle
The Rendering API requests reference an object of type RenderResultBundle. The configuration of the bundle will vary depending on the provided inputs. The following properties define this object.
RenderResultBundle Properties
- message : String, Descriptive message of any errors that occur during the rendering.
- contentRemaining : Boolean, Is true when the API found more content but didn’t return them because of a limit.
- renderings : List<RenderedContent>, A list of all the rendered content. For more information see RenderedContent Properties below.
- pageRenderings : List<RenderedPage>, A list of all the rendered pages. For more information see RenderedPage Properties below.
RenderedContent Properties
The RenderResultBundle object references an object of type RenderedContent. The following properties define this object.
- originId : Id, The origin Id of the content that was rendered.
- contentId : Id, The Id of the content that was rendered.
- message : String, Content-specific rendering message.
- contentBundle : ContentBundle, A simplified content bundle for the content. Only returned if the appropriate request flags are passed.
- socialBundle : SocialBundle, The social bundle for the content. Only returned if the appropriate request flags are passed.
- renderMap : Map<String, String>, The key is the layout name and the value is the html rendering of the content.
- tagPaths : List<String>, All the tag paths associated with this content. Only applicable when rendering by tag path.
RenderedPage Properties
The RenderResultBundle object references an object of type RenderedPage. The following properties define this object.
- name : String, The name of the page.
- url : String, The URL of the page.
- rendering : String, The HTML rendering for the page.
Iterating through a RenderResultBundle
Your content rendering request may include multiple content items returned. The following Apex example can help you iterate through your RenderResultBundle response to obtain the HTML of the page or content.
Apex Example - RenderedContent
RenderResultBundle resultBundle = (RenderResultBundle) json.deserialize(apiResponse.responseObject, RenderResultBundle.class);
for (RenderResultBundle.RenderedContent renderedContent : resultBundle.renderings) {
for (String rendering : renderedContent.renderMap.values()) {
System.Debug(rendering);
}
}
Apex Example - RenderedPage
RenderResultBundle resultBundle = (RenderResultBundle) json.deserialize(apiResponse.responseObject, RenderResultBundle.class);
for (RenderResultBundle.RenderedPage renderedPage : resultBundle.pageRenderings) {
System.Debug('Name: ' + renderedPage.name);
System.Debug('URL: ' + renderedPage.url);
System.Debug('Rendering: ' + renderedPage.rendering);
}