Pages

16 October, 2024

Introducing Sitecore XM (Cloud) Apps REST API

While XM Cloud Deploy APIs are useful to manage Deploy Apps related activities, Sitecore XM Cloud team has released a new set of APIs to manage XM Cloud Apps. This newly introduced APIs can help us to manage the XM Apps collections, sites, analytics, and languages. The online API console released by Sitecore works more like a postman (like in OrderCloud API console) and enables us to use the browser to send the request the environment. 

In order to use this API, JWT token needs to be created. In order to do that, we need to create the automation client in Deploy App and then /oauth/token endpoint is used to get the JWT token along with client id and client secret. Please note that to create client credentials in Deploy App, we need to have Organization Admin or Organization Owner access to Cloud Portal. 

XM Apps API:

  • Sites
    • List sites
    • Create a site
    • Retrieve a site
    • Update a site
    • Delete a site
    • Duplicate a site
    • Rename a site
    • List sites that use an analytics identifier
    • Unassign analytics identifiers from sites
    • Retrieve the hierarchy of a site's main page
    • Retrieve the hierarchy of a page
    • List ancestors for a page
    • List children for a page
    • List hosts for a site
    • Create a site host
    • Retrieve a site host by host ID
    • Update a host by host ID
    • Delete a site host by host ID
    • List site templates
    • Upload a thumbnail for a site
  • Collections
    • List site collections
    • Create a site collection
    • Retrieve a site collection
    • Update a site collection
    • Delete a site collection
    • Rename a site collection
    • List sites in a site collection
  • Jobs
    • List site job statuses
    • Retrieve a job status
  • Languages
    • List languages
    • Add a language
    • List supported languages
    • Update a language
    • Delete a language

API Console Features:

  • Try it functionality to test the API via browser itself. 
  • Provides a request payload with explanation of each attributes.
  • Ability to set the environment variables
  • Ability to set the authorization token.
Try it here. 



10 October, 2024

Coveo for Sitecore - Using Advanced Field Queries

In Coveo for Sitecore, there are scenarios where we need to create advanced complex queries to get specific results. Though we can achieve most of the search queries using basic queries, advanced queries helps us to narrow the search results. 


When dealing with Coveo Advanced field queries, 
  • queries are performed against field values directly and not through the index. 
  • can search for special characters in field values. In basic query (which is through index), special characters are not searchable. 
  • can be only searched 'with special characters' against fields that have Facet options or Free text search options enabled. 
  • drawback with advanced query is that response increases if the number of fields increases, field values and complexity of the query expression. 

Advanced Field Query Syntax



Advanced Query Field Operators


Wildcard Match (*=)

  • Handles any wildcard characters (?, *).
  • Can use one or more wildcard characters. 
Example: Intel processor containing I9

@processor *= "*I9"

Fuzzy Match (~=)

  • Expands search results by permitting slight difference between search query and results. 
  • Matches 20% difference from the search query.
Example: "Gigestive Capsules" results in "Digestive Capsules"

@medicine ~= "Gigestive Capsules"

Phonetic Match (%=)

  • Transforms query into Phonetic codes, then results that shares similar phonetic code. 
Example: Flour results in Flour and Flower

@type %= "Flour"

Regular Expression Match

  • Matches with the regular expression to get accurate results.
Example: Field containing URL with a subdomain URL. - https://prod1-cm.examples.com/product

@clickableuri /= "^https:\/\/[a-zA-Z0-9.-]*\.examples\.com\/.*$"

Scenarios


01 October, 2024

Sitecore Commerce - Refresh Commerce Cache - This operation is not available unless admin mode is enabled: FLUSHDB

In one of the eCommerce application, Sitecore Commerce 10.1.1 is being used. After few infrastructure consolidation, testing out Refresh Commerce Cache option in CM resulted in the below error. 

Based on the exception, we found that we can add AllowAdmin option to the Sitecore Commerce Redis Connection string. All Commerce related settings are available in this folder - \App_Config\Include\Y.Commerce.Engine.

In Sitecore.Commerce.Engine.Connect.config, allowAdmin=true configuration is added to the Redis Connection string. Refreshing the commerce cache worked without an error. 



blockquote { margin: 0; } blockquote p { padding: 15px; background: #eee; border-radius: 5px; } blockquote p::before { content: '\201C'; } blockquote p::after { content: '\201D'; }