Skip to content

Instantly share code, notes, and snippets.

@frueda1
frueda1 / Controller.cs
Created November 25, 2024 05:44
Snippets for Webhooks and Content Translation
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Serilog;
using System.Text;
using System.Text.Json;
using WebHooks.Models;
using WebHooks.Repositories;
namespace WebHooks.Controllers
@frueda1
frueda1 / ElasticAPISamples.txt
Created September 1, 2024 06:55
Creating Elasticsearch analyzers from Sitecore
POST my_sitecore_index/_close
PUT my_sitecore_index/_settings
{
"analysis": {
"filter": {
"my_synonyms_filter": {
"type": "synonym",
"synonyms": [
"RPA,Robotic Process,Robot Process Automation,Automatic Processes",
@frueda1
frueda1 / Program.cs
Created June 1, 2024 03:54
Webhook HTTP Request
using Serilog;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Information()
.Enrich.FromLogContext()
.Enrich.WithProcessId()
.Enrich.WithProcessName()
@frueda1
frueda1 / DevTips.tsx
Created October 30, 2023 15:48
Basic code to execute GraphQL queries in XM Cloud NextJs
import {
GetStaticComponentProps,
Image,
ImageField,
Text,
TextField,
useComponentProps,
} from '@sitecore-jss/sitecore-jss-nextjs';
import { ComponentProps } from 'lib/component-props';
import { GraphQLQueryResult } from 'lib/graphql-queries/GraphQLQuery';
@frueda1
frueda1 / Layout.tsx
Created September 17, 2023 04:54
XM Cloud integration with Sitecore Personalize, and call GraphQL query with Decision Model Result as parameter.
/**
* This Layout is needed for Starter Kit.
*/
import React from 'react';
import Head from 'next/head';
import {
Placeholder,
getPublicUrl,
LayoutServiceData,
@frueda1
frueda1 / Experience.cs
Last active June 10, 2023 03:06
Personalize class to call Sitecore Personalize API
public class Experience
{
[JsonProperty("clientKey", NullValueHandling = NullValueHandling.Ignore)]
public string ClientKey { get; set; }
[JsonProperty("channel", NullValueHandling = NullValueHandling.Ignore)]
public string Channel {get; set;}
[JsonProperty("language", NullValueHandling = NullValueHandling.Ignore)]
public string Language {get; set;}
[JsonProperty("currencyCode", NullValueHandling = NullValueHandling.Ignore)]
public string CurrencyCode {get; set;}
@frueda1
frueda1 / KeyValueWithDropdownOrdered.cs
Created April 11, 2023 10:05
Keylookup Extend to add new column
using Sitecore.Data.Items;
using Sitecore.Diagnostics;
using Sitecore.Shell.Applications.ContentEditor;
using Sitecore.Text;
using Sitecore.Web.UI.Sheer;
using System;
using System.Collections.Specialized;
using System.IO;
using System.Web;
using System.Web.UI;