- [Home page](https://www.brimit.com/)
- [Blog](https://www.brimit.com/blog)

# GraphQL Extensibility: A “SelectSingleItem” Query

[#How-to](https://www.brimit.com/blog?categories=#How-to) [DXP](https://www.brimit.com/blog?platforms=DXP)
[Artsem Prashkovich](https://www.brimit.com/blog/author?authors=Artsem%20Prashkovich) on August 10, 2020

The Sitecore GraphQL API is an implementation of a GraphQL server on top of Sitecore. It is designed to be a generic GraphQL service platform, i.e. it's designed to host your API and present it via GraphQL queries. The API also supports real-time data using GraphQL subscriptions.

Last year we worked on building sites based on Sitecore JSS architecture. As usual, all of our pages had a datasource that are located in an item in the PageComponents folder:

![](https://www.brimit.com/-/media/project/brimit/blog/2020/datasources.png)

For example, we want to have a component that renders all banners from the Banners folder. We use the Component GraphQL Query to define a structure of data that comes from the Layout Service. By default, GraphQL doesn’t support the Sitecore item queries, such as query:./\*[@@name='Page Components']. But sometimes it would be great to have more flexibility than requesting an item only by item path or its ID. To make it possible, we decided to build a custom query. You can find the code below.

![](https://www.brimit.com/-/media/project/brimit/blog/2020/article-single-sample1.png)

The complete code is available by the [link](https://github.com/ampach/Sitecore/blob/master/GraphQL%20Queries/SelectSingleItemQuery.cs).

Then we need to register our query:

![](https://www.brimit.com/-/media/project/brimit/blog/2020/article-single-sample2.png)

The config file is available [here](https://github.com/ampach/Sitecore/blob/master/GraphQL%20Queries/SelectSingleItemQuery.config).

When the query is deployed to the website root, we can build the following query:

![](https://www.brimit.com/-/media/project/brimit/blog/2020/sitecore-item-query.png)

![](https://www.brimit.com/-/media/project/brimit/blog/article-single-sample3.png)

Also, using this extension, we can can rebuild the query mentioned in [GraphQL Extensibility: SiteRelativeItem Query](https://www.brimit.com/blog/graphql-extensibility-siterelativeitem-query) by building the query like below.

![](https://www.brimit.com/-/media/project/brimit/blog/article-single-sample4.png)

The result will be the same as in the case of using the [SiteRelativeItem Query](https://www.brimit.com/blog/graphql-extensibility-siterelativeitem-query).

###### More from author

##### Deploy custom headless Sitecore solution in Sitecore XM Cloud
November 10, 2022[Deploy custom headless Sitecore solution in Sitecore XM Cloud](https://www.brimit.com/blog/deploy-custom-headless-sitecore-solution-in-sitecore-xm-cloud)

##### Running custom next.js editing host in Sitecore XM Cloud
September 29, 2022[Running custom next.js editing host in Sitecore XM Cloud](https://www.brimit.com/blog/running-custom-next-js-editing-host-in-sitecore-xm-cloud)

##### Running node.js based rendering host in Sitecore Managed Cloud
August 3, 2022[Running node.js based rendering host in Sitecore Managed Cloud](https://www.brimit.com/blog/running-node-js-based-rendering-host-in-sitecore-managed-cloud)

###### Author

![artsiom-photo](https://www.brimit.com/-/jssmedia/feature/blogs/authors/artsiom-200.jpg?h=202&iar=0&w=200&hash=41797D2540DF6EB6FDF558360F6F62B8)

Artsem Prashkovich

Sitecore MVP/ Solution Architect
[Artsem Prashkovich](https://www.brimit.com/blog/author?authors=Artsem%20Prashkovich)

###### More by category

[#Events](https://www.brimit.com/blog?categories=#Events) [#How-to](https://www.brimit.com/blog?categories=#How-to) [#News](https://www.brimit.com/blog?categories=#News) [#Guides](https://www.brimit.com/blog?categories=#Guides)

###### More by platform

[DXP](https://www.brimit.com/blog?platforms=DXP) [Sales and marketing automation](https://www.brimit.com/blog?platforms=Sales%20and%20marketing%20automation) [Application innovation](https://www.brimit.com/blog?platforms=Application%20innovation)

#### More on Sitecore

![How Vercel Will Help You Save Effort When Deploying Sophisticated Sitecore Projects](https://www.brimit.com/-/jssmedia/project/brimit/blog/2024/vercel_cover-image.png)
#Guides #How-to DXP E-commerce

##### How Vercel Will Help You Save Effort When Deploying Sophisticated Sitecore Projects

Optimize and accelerate the development and deployment of complex multisite Sitecore projects.

Alexei Vershalovich on July 17, 2024
[How Vercel Will Help You Save Effort When Deploying Sophisticated Sitecore Projects](https://www.brimit.com/blog/how-vercel-will-help-you-save-effort-when-deploying-sophisticated-sitecore-projects)

![Training Up Tomorrow's Sitecore MVPs: a Mentoring Success Story](https://www.brimit.com/-/jssmedia/project/brimit/blog/2023/sitecore-mentoring---cover-image.png)
#How-to DXP

##### Training Up Tomorrow's Sitecore MVPs: a Mentoring Success Story

How to participate in the Sitecore Mentor program and help younger colleagues jump-start a career in Sitecore development.

Sergey Baranov on October 2, 2023
[Training Up Tomorrow's Sitecore MVPs: a Mentoring Success Story](https://www.brimit.com/blog/training-up-tomorrows-sitecore-mvps)

![Going Headless. Part 2: When a Headless CMS Is Your Best Bet (if you have Sitecore)](https://www.brimit.com/-/jssmedia/project/brimit/blog/2022/headless/adobestock_456986731.jpg)
#How-to DXP E-commerce

##### Going Headless. Part 2: When a Headless CMS Is Your Best Bet (if you have Sitecore)

Discover how a headless CMS can benefit organizations that use Sitecore.

Daniil Raschupkin, Palina Trokhautsava on September 15, 2022
[Going Headless. Part 2: When a Headless CMS Is Your Best Bet (if you have Sitecore)](https://www.brimit.com/blog/going-headless-part-2-when-a-headless-cms-is-your-best-bet-if-you-have-sitecore)
