Hot answers tagged

6

I have some code to offer to start the node process(es) with custom arguments, e.g. --prof. However, I'd first like to highlight the following bits of information about GraphQL and JSS that might provide some insight. Sitecore GraphQL includes some built-in diagnostics features that can help diagnose API performance issues: https://jss.sitecore.com/docs/...


6

Find the schema configuration for the JSS app GraphQL endpoint in config files, and add the "search" query reference. <sitecore> <api> <GraphQL> <endpoints> <jss-app-nameGraphQLEndpoint> <schema hint="list:AddSchemaProvider"> <content type="Sitecore.Services.GraphQL.Content....


6

From the looks of it, the configuration was not patched correctly. The /sitecore/api/graph/items/master/… is the default JSS endpoint which has search query enabled, while the default JSS project setup does not have search query enabled (it has only Item query enabled by default). Check your configuration in http://yourdomain/sitecore/admin/showconfig....


4

The App_Config\Sitecore\Services.GraphQL\Sitecore.Services.GraphQL.Content.config is from the JSS package, no need the change there somethings. It is about your GraphQL endpoint, In your end point your configer what you need. Or you can use a predefined config like the. /sitecore/api/GraphQL/defaults/content/schemaProviders/systemContent In your react app ...


4

This is a problem that falls on the unfortunate spot in between SXA, JSS, and Sitecore Services Client. I know it doesn't help you to know that these are somewhat separate development teams inside Sitecore, but I do believe that's where this falls. Using the new SXA/JSS features in 9.2 and above, we've also found that some Api calls and GraphQL calls fail ...


4

Ok, having spent some time trying to figure out how this whole thing works in Sitecore, I can now say, that SXA-JSS does not support integrated GQL. The problem lies in the sxa-jss configuration for the LayoutService, which is selected by default when you create a new SXA JSS site. The configuration above comes from this file: \App_Config\Modules\JSS SXA\...


4

I want to make it clear that Sitecore did not invent or create GraphQL. GraphQL is a pre-existing standard: https://graphql.org/ The Sitecore GraphQL API is an implementation of that standard with some Sitecore-specific bits. As I understand it, the endpoint is running C# code on the server that is defined for schemas and extenders. It wraps around ...


4

I found 2 solution for this issue and I ended using method 1 for the "hashed url" convenience. Method 1: Using rendered(fieldRendererParameters) query ($datasource: String){ item (path:$datasource){ field (name:"Image") { rendered(fieldRendererParameters:"w=100&h=160") } } } The result of this query is... { "data": { "item":...


4

You don't need a JSS license to use the Sitecore.Services.GraphQL package, which is essentially the "core" part of using GraphQL with Sitecore. So you are free to create your own schemas, extenders, etc... or use the built-in options. There is a Sitecore.JavaScriptServices.GraphQL package as well. This package is primarily used to provide a custom JSS ...


3

You can use the below function to query a defined GraphQL endpoint. function Invoke-GraphRequest { param( [string]$query, [Sitecore.Data.Items.Item]$siteRoot, [string]$apiPath ) $apiKeyItemPath = "/sitecore/system/Settings/Services/API Keys/key-name" $apiKeyItem = Get-Item -Path "master:$...


3

You can use an index search and filter whatever, Use somethings like this: { search( fieldsEqual:[{name:"title", value:"Sit*" }] rootItem:"/sitecore/content" ) { results { items { item { id name path url field(name : "title") { title: value } } ...


2

You can easily add extra items to a query. give them a unique name for example: { item1: item(path:"/sitecore") { id name } item2: item(path:"/sitecore/content") { id path displayName } } This Query get 2 items by path and and calls them item1 and item2. See also Starting with Sitecore JSS Integrated GraphQL and Sitecore JSS ...


2

In order to easily use the field value in a <Text /> field helper component, you will need to adjust your query a bit: query { contextItem: item(path: "{22C1A19D-CEE3-5E4E-ADB5-373A0E225C91}") { id path ...on AppRoute { articleTag { jss } } } } The result of the query will give you something like this for the ...


2

Generally speaking user generated content should not be stored on a Sitecore item because: The content is subject to publishing, if stored in the master db, and subject to deletion during publishing if stored in web The master database is generally not exposed to the content delivery servers, thus making it impossible to write there in production Generally ...


2

There is an includeTemplateIDs filtering option on children: topItem: item(path: $datasource) { children(includeTemplateIDs: "{C6F6A81A-F9C9-45D8-AF4E-3E818C470F53}") { name url ... on CustomTemplate { customField { value } } } }


2

Yes you can resolve a Sitecore Droplink to an Item in one query, a Droplink has a targetItem that is the way to access the fields of the reference in GraphQL. GraphQL Example: query getArticles($item: String = "{02E9F5E2-8CDE-4A52-B260-62B628692BF8}") { item(path: $item) { ...articleFields } } fragment articleFields on ArticlePage { productarea{ ...


2

Make sure you've installed the Sitecore Management Services module. It's listed as a pre-req here: https://doc.sitecore.com/developers/100/developer-tools/en/install-sitecore-command-line-interface.html dead link on the documentation website was supposed to lead me here: https://dev.sitecore.net/Downloads/Sitecore_CLI/2x/Sitecore_CLI_200.aspx


1

Assuming you are using ReactJs, you can from your component implementation pass a value to the query. Please see below code snippet where part of it is taken from the ReactJs sample provided by JSS. import { loader as gqlLoader } from 'graphql.macro'; import GraphQLData from '../../lib/GraphQLData'; import { withSitecoreContext } from "@sitecore-jss/...


1

Try retrieve jss of date field in graphQL instead of value and render the same using . Sample graphQL call query RetDates($itemPath: String = "/sitecore/Content/TestItems") { folderItem: item(path: $itemPath) { children{ dateVal: field(name:"dateVal") { jss } } } } Sample rendering <DateField field={child....


1

You cannot get your desired query result format OOTB, but you can get template fields in a strongly-typed way by using inline fragments that select fields from specific types, as described in the Sitecore GraphQL documentation page here. This input query: { item(path: "/sitecore/content/home") { name ...on SampleItem { text { value ...


1

The short answer is no for OOTB. GraphQL is based on a schema. Your GraphQL server uses a schema to describe the shape of your data graph. This schema defines a hierarchy of types with fields that are populated from your back-end data stores. The schema also specifies exactly which queries and mutations are available for clients to execute ...


1

Using a GraphQL query with a predefined hierarchy for a breadcrumb component can be difficult to manage. This is because You will already limit the query's depth to a certain level in the content tree. So, if tomorrow you change the content tree structure, you'll need to update your GraphQL. With OOTB GraphQL query, it is difficult to remove items that ...


1

Your query looks good, I test it on Sitecore 9.1, SOLR with a Text field, that work with this adjustment. It is now facetOn "_category" looks like because the field(name: "Category") your field is named "Category" so use search(rootItem: "92B4F8E7-6324-4C01-B873-7FDC992EDDEE" facetOn:["Category"] ) It is not giving a count per facet. you can do that by ...


1

You can do it with the search, there is a little caveats with searching on an GUID, you need to use a lowercase GUID without brackets and dashes. Example: { search( fieldsEqual:[{name:"Products",value:"8826e32b70ac42aa923aff0a3a313f34"}] rootItem:"/sitecore/content/MyApp/Categories" ) { results { items { item { id ...


1

The query would not work on Sitecore 9.1 initial version. You can use somethings like this: query{ search(keyword:"smart" fieldsEqual:[{name:"_fullpath", value:"/sitecore/content/*" }]){ results{ totalCount } } } It is necessary to have a fieldsEqual. fixed in JSS 11.0.1 Below \App_Config\Sitecore\Services.GraphQL you can found a sample ...


Only top voted, non community-wiki answers of a minimum length are eligible