Subpage Data from Content Representation API

Hi there,

I’m looking to retrieve the data from a subpage of one of my site’s parent pages.

The page in question is one of two subpages, specifically created to act as two subpages of a parent page. The URL structure is as follows.

Parent page: siteurl/shows
Child page 1: siteurl/shows/featured
Child page 2: siteurl/shows/latest

All pages are working fine, the problem occurs when I want to attach/retrieve data from a specific subpage. I don’t know I need to create a .json.php file to serve JSON data from subpages? When I do this as I would for a single show page ( siteurl/shows/showname this works fine with show.json.php) nothing comes out in siteurl/shows/featured.json expect for the following:

{
title: "Featured",
text: {
html: ""
}
}

Any direction on this would be much appreciated.

Many thanks

George

If you want to retrieve content from a subpage on the parent page, you have to set up the content representation to return this data, just as you would in a standard html template.

Do you know what I would name the template? I tired featured.json.php and that doesn’t pick up on it.

If you mean that I would have to send all the desired field through the parent page then that’s what I’m doing currently. The problem with that is that the two sub pages both use pagination, so I need each sub page to generate its own unique pagination url. If the data for both subpages are tied to the parent then the pagination URL only works properly for one of the subpages…

It must have the template name + json

1 Like

Ah, it makes total sense now. I have to have a blueprint for each individual sub page. Thanks!