Send custom parameters to wp-json

We are trying to add custom URL params to the wp-json request similar to this post that got abandoned. It does not look like there was ever a solution.

The goal is to include variable parameters like industry=healthcare or industry=construction in the request to Wordpress.

We found this github repo that is potentially what we need - using handlers

We have adopted it as such:
const project = {
priority: 10,
pattern: “/project/:slug”,
func: async ({ route, params, state, libraries }) => {
// 1. get page with that slug.
const response = await libraries.source.api.get({
endpoint: “project”,
params: { test: ‘test parameter’ }

// 2. add it to the state.
const [project] = await libraries.source.populate({ response, state });

// 3. add info to data
Object.assign([route], {
  type: project.type,


const before = async ({ libraries, actions }) => {
// Add handlers for both /project/:name.

// Fetch all the projects.
await actions.source.fetch("/project");

and the “before” function is set in the actions → theme as:
beforeSSR: before,
beforeCSR: before

But this does not seem to do anything. Can we get some clarification?
Like the other forum post mentioned, it is very unclear in documentation what needs to be done here. We’re spinning our wheels on something that should be easy, I think.

We don’t have a public site/repo yet since the project is just getting started.

Thank you.