Ideas for Arc XP

Add Query Param to filter inactive Sections from Arc's Site Service GET Section API

Context

Our Section Resolver use a Content Source that hits Arc's GET Section endpoint. Here is what that Content Source looks like:

const resolve = ({ sectionId = "/" }) => {
   return `/site/v3/website/dallas-news/section/?_id=${sectionId}`;

};


export default {
    resolve,

    params: {
        sectionId: "text"
    }

};

Scenario

Sections are apparently never deleted, but flagged inactive: true. With our Content Source ☝️, users can get to deprecated inactive sections, which resolve with a status code 200 but are not associated with any content. When this happens, they get blank Section templates. For example:


Desired Outcome

We want to prevent users from getting to broken, deprecated, inactive Sections. We want https://www.dallasnews.com/cowboys/ and https://www.dallasnews.com/crime/ to display a 404 page instead of a Section template with no content.

What we tried

1. Using include_inactive filter with the GET ALL Section API endpoint

The GET ALL Sections has a flag include_inactive that can be used to filter out unwanted sections, but this API endpoint doesn't work for this resolver scenario. It never 404's, it just returns an empty array. Moreover, the filtering sucks– a query of /cowboy returned 100 results... not going to work.  no

2. Using fetch API + throwing a synthetic 404

You can apparently throw synthetic 404's from Content Sources. This isn't adequately documented and there are no canonical examples of doing this with fetch.

I tried it anyway. The resultant implementation is more complex and painful to debug– debugging Content Resolvers is opaque and even though it worked locally I couldn't get it to work on any other environment. I don't think this is a good solution.  no

Feature Request

Can a flag like include_inactive be added to the GET Section API endpoint? I just want to add a query param that prevents old deleted Sections from resolving.

For example:

  • /site/v3/website/dallas-news/section/?_id=/cowboys&include_inactive=false

    • returns status code 404

  • /site/v3/website/dallas-news/section/?_id=/sports/cowboys&include_inactive=false

    • returns status code 200 and Section JSON

This would make the API endpoint easier to consume via Content Sources. It prevents users from being able to get to inactive sections. It saves me from slogging through an implementation that leans on undocumented features of Content Sources.

  • Guest
  • Jan 16 2020
  • Shipped
  • Attach files
  • Megan DeLaunay commented
    April 29, 2020 18:43

    Hi Nigel -- Happy to report that the development of this feature is underway and it should be released in the next Publishing Platform release (Sandbox on 5/7/2020).