Is it possible to fetch the targeting parameters?

Topic name says it all: can I get the targeting parameters of a content item as part of the content API response?

My use case is that I have a drawer section model that represents a menu that slides out from the left or the right. Left/right are distinguished using a drawerOrientation custom targeting parameter.

This setup works fine for fetching my drawer content in my layout, because I can specify whether I want a left or right drawer.

But for editing purposes, I have a dedicated editing page that just fetches whichever drawer content item has been opened in the Visual Editor. There’s no knowledge beforehand of whether it’s left or right, but various CSS stylings on my Next.js page depend on knowing this, so I’d like to parse it out of the targeting attributes for that content item if possible.

Hey @ersin currently there is not a set value in the content object that shows the targeting attributes for a given content entry.

That being said, the query for the content entry will show in the content object, so for example this call to the content api:

includes the user attributes locale=en-US and urlPath=/parent-symbol and you can see them in the query object inside the response:

"results": [
   "query": [
           "@type": "",
           "operator": "is",
           "property": "urlPath",
           "value": "/parent-symbol"
           "@type": "",
           "operator": "is",
           "property": "locale",
           "value": [

So the content object includes the query that fetched it. So if you have that available you can pass to state as a data prop.

Do you think this would be sufficient for your use case?

Yup that works, thanks @TimG!

Argh actually, I answered too soon. The problem is that my query doesn’t have the targeting parameter to begin with, it’s just simply saying “load this content model.”

Looking over the use case, is there a reason this would be based off of targeting parameters? It almost sounds like left and right could just as easily be passed in as values on the data prop to state?

Why does this need to be a targeting parameter?

The main reason is that there’s one drawer model and there needs to be a way to select which kind of drawer content item should be rendered, either left or right. I need some kind of targeting parameter for that.

A simple, no-nonsense fix would involve splitting my drawer model into a left-drawer and right-drawer model and creating content items for them separately. That’s what I had originally, but I found that solution unsatisfying and inelegant. Drawer content should just be drawer content. Otherwise, I end up having to write left-drawer and right-drawer all over my codebase.

Do you have a link to an example content entry? How do the left and right drawers differ? If it is just a CSS thing, then you could just have it be conditional based on state passed through data prop.

Without seeing in practice I might be missing some major components of the implementation though