Posts

Steps to Generate Access Token for Authoring API Endpoint in XM Cloud

Image
Hello everyone, In this blog we will understand, how to get access token which is must for interacting with Authoring API endpoint. As we all know, to work with preview endpoint in XM Cloud, we required sc_apikey which we can get from Sitecore. But we cannot use the same when working with Authoring API endpoint. We will require an access token for the same. So follow below steps to implement the same. Step 1 : Login to you XM Cloud Instance and click on XM Cloud Deploy APP. Step 2 : Click on Credentials in left side panel. Step 3 : Click on Create Credentials.A popup will come up. Fill the details as shown in below figure. Step 4 : Another popup will come up which will show you generated client id and client secret.Copy you client secret as will not be accessible once popup us closed. Step 5 : Now we are ready with client id and client secret. It's time to get the access token.Open Powershell in administrator mode and run below command.The placeholder {0} represent the clie...

Understanding Search Query With Pagination Using GraphQL In XM Cloud

Image
Hello Everyone, In this blog we will see how we can implement search query using GraphQL and implement pagination.GraphQL uses cursor based system to handle pagination whenever we execute a search query. We will see this in action. Let's understand this with a common use-case which every developers encounters. We are having Blog pages or Article pages. We want to get all blogs or articles based on some conditions. The blogs or articles should be sorted based on published date. At first, we just want to show n number of items from the result. Then on load more, we need to show the remaining items. Let's jump quickly into action. We will open GraphQL IDE and dive into writing the query. I am using local XM Cloud. Required thing to execute query. GraphQL IDE : "https://xmcloudcm.localhost/sitecore/api/graph/edge/ide" Api Key: We can get it from Sitecore instance under mentioned path. Path: /sitecore/system/Settings/Services/API Keys. In above image, it give...

Understanding External Component in Content Hub with Use Case Using React

Image
Hello everyone, In this blog we will see how we can create external component using react in Sitecore Content Hub. In one of my old blogs, I have created a similar component using Knockout JS. We will consider the same use case to build this component but using React. Before starting our blog, I will highly encourage you to read my old blog here . Creating external component, assigning the component to Asset Details page, making it visible on the page will be exactly same as we have done in the old blog. The changes what we are going to do in Content Hub, I will add the screenshot below. Before developing the component in react, we need to setup our React front end solution. I would highly recommened to watch the youtube tutorial for setting up the front end solution here . Adding few helpful command below which is required during setup. I will provide all reference link below in reference section. // For creating new react project using Vite npm create vite@latest //Quic...

Understanding Forms in Sitecore XM Cloud

Image
Hello everyone!! In this blog we are going to see how we can create Forms in XM Cloud using Forms feature recently introduced. we will create an webhook submit action to show the posted data. We will create a sample form in XM Cloud. Follow the screenshot below as most of the things will be. I will add the notes whereever its required. Select Form from Tools tab . Create Form and Save Form Builder We need to select a layout. Select Full width layout from Layout tab and drag it to page. After that navigate to Items tab which will have fields that can be drag and drop to layout to create the form. Form Builder Drag and Drop Short Text field for Full Name and Email. Select the Individual Fields. You will get lot of properties for that selected field. Modify according to one's need. Refer below screenshot for your reference. Navigate to Settings tab in Form Builder . We will configure thank you message,error message, webhook actions. Webhook is basically an HTTP R...

How to write Solr query using SolrNet

Hello everyone, in this blog we will learn how we can write some solr query in c# backend using SolrNet . The first thing you need for this is to add the SolrNet dll reference to your project. Step 1 : Import this two namespace in your controller using SolrNet; using SolrNet.Commands.Parameters ; Step 2 : Create new instance of Solr query. Then create a list of array of fields in Solr where the search keyword will be searched. For example on title field, navigation title, description etc. See below code snippet for your reference var query = new SolrQuery("*:*"); if(!string.IsNullOrWhiteSpace(keyword)) { var q = new[] { $"(metakeywords_t_{language}:{keyword}", $"(title_t_{language}:{keyword}", $"(navigationtitle_t_{language}:{keyword}", $"(description_t_{language}:{keyword}", $"(pagecontent_t_{language}:{keyword}", }; query = new SolrQuery(string.Join(" ", q)); } Step 3 : Add filters to mak...

Facing Error With Solr Docker Service Not Healthy

Image
Hello everyone, in this blog i will discuss an error which i faced when working docker solution. Whenever i was running may up.ps1 script, sometime my Solr service was failing giving some error related to ZooKeeper and it becomes unhealthy. Because of this Sitecore instance was failing. For my case,check the below error message INFO: Solr configuration not found in 'c:\\data', copying clean configuration... 2024-04-03 05:40:49.880 INFO (main) [ ] o.e.j.u.log Logging initialized @5034ms to org.eclipse.jetty.util.log.Slf4jLog 2024-04-03 05:40:50.349 INFO (main) [ ] o.e.j.s.Server jetty-9.4.44.v20210927; built: 2021-09-27T23:02:44.612Z; git: 8da83308eeca865e495e53ef315a249d63ba9332; jvm 1.8.0_252-b09 2024-04-03 05:40:50.380 INFO (main) [ ] o.e.j.d.p.ScanningAppProvider Deployment monitor [file:///C:/solr/server/contexts/] at interval 0 2024-04-03 05:40:54.646 INFO (main) [ ] o.e.j.w.StandardDescriptorProcessor NO JSP Support for /solr, did not find org.apache.jasper....