<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>REST SDK and Sitecore</title><link>https://community.telligent.com/community/11/w/developer-training/65134/rest-sdk-and-sitecore</link><description /><dc:language>en-US</dc:language><generator>14.0.0.586 14</generator><item><title>REST SDK and Sitecore</title><link>https://community.telligent.com/community/11/w/developer-training/65134/rest-sdk-and-sitecore</link><pubDate>Tue, 04 Aug 2020 18:56:04 GMT</pubDate><guid isPermaLink="false">a28af10c-87ed-413d-b351-9ef2a11ab1e6</guid><dc:creator>Former Member</dc:creator><comments>https://community.telligent.com/community/11/w/developer-training/65134/rest-sdk-and-sitecore#comments</comments><description>Current Revision posted to Developer Training by Former Member on 08/04/2020 18:56:04&lt;br /&gt;
&lt;p&gt;Sitecore is a popular .NET based Enterprise Content Management system that when coupled with Verint Community provides a powerful platform for customer engagement.&amp;nbsp; Because they are built on the same underlying technology, the [[REST SDK|Rest SDK]] makes integrating the two systems together easier.&lt;/p&gt;
&lt;p&gt;[toc]&lt;/p&gt;
&lt;h2&gt;&lt;a id="Installation_and_Configuration" name="Installation_and_Configuration"&gt;&lt;/a&gt;Installation and Configuration&lt;/h2&gt;
&lt;p&gt;Since this is an SDK, there is an assumption that you have a Visual Studio solution that you are using to develop Sitecore components.&amp;nbsp; The easiest way to start using the SDK is to install it into this solution using NuGet. &amp;nbsp;For more detailed instructions on how to install, review the&amp;nbsp;[[REST SDK|Rest SDK]] article&amp;#39;s &amp;quot;&amp;quot;How to Get It&amp;quot; topic.&amp;nbsp; This process will install the supporting files and references needed to begin configuring the SDK for first use.&lt;/p&gt;
&lt;p&gt;Once installed, you need to decide which [[Hosts|Host]] you wish to use.&amp;nbsp; You should take some time to review the [[Hosts]] topic to understand what they are and how they work.&amp;nbsp; The configuration of the SDK depends on the choice you make.&amp;nbsp; Here is a quick overview of the 2 available hosts that may help you choose the best path to continue researching:&lt;/p&gt;
&lt;p&gt;[[Default REST Host]] -&amp;nbsp; This is by the far the most feature-rich of the 2 hosts. &amp;nbsp;It also requires the most configuration, all of which is covered in more detail in the [[Default REST Host]] topic. &amp;nbsp; This host is capable of:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Performing all the [[Basic Requests]] of the SDK&lt;/li&gt;
&lt;li&gt;Optional Single Sign-On that automatically handles user creation and&amp;nbsp;synchronization in the community&lt;/li&gt;
&lt;li&gt;Url proxying- You can create a special code handler &amp;nbsp;the allows you to replace the urls returned in REST with urls you define in Sitecore.&lt;/li&gt;
&lt;li&gt;Multiple Host support if &amp;nbsp;you needed&amp;nbsp;to manage different hosts for different reasons, such as for multi-tenancy.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;[[Client Credentials REST Host]] - &amp;nbsp;If you just want to surface some information your Sitecore site, like a list of blogs or forum threads and don&amp;#39;t need all the&amp;nbsp;additional functionality, or you want more granular control over how everything works then this host may be appropriate.&amp;nbsp; This host is the simplest of the hosts as it allows you to just make REST calls using Oauth and not have to worry about managing OAuth tokens or add additional complex configuration. &amp;nbsp;With this host you can:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Perform all the [[Basic Requests]] of the SDK&lt;/li&gt;
&lt;li&gt;Act as a single user or impersonate other users in the community&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;&lt;a id="Default_REST_Host_and_Sitecore" name="Default_REST_Host_and_Sitecore"&gt;&lt;/a&gt;Default REST Host and Sitecore&lt;/h2&gt;
&lt;p&gt;Unlike the [[Client Credentials REST Host]], the [[Default REST Host]]&amp;nbsp;needs to be initialized and configured in code depending on the features you use.&amp;nbsp; It is recommended that this all be done in the application start or as close to it as possible.&amp;nbsp; &amp;nbsp;One proven way to do this in Sitecore is to use a pipeline. Now if you do not wish to use any of the options that require code based configuration such as using local user accounts or url proxying, then you do not need to do this.&amp;nbsp; The host will self initialize the&amp;nbsp;first time&amp;nbsp;you retrieve it. &amp;nbsp;Here is an example of initializing the host in a pipeline:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;using Sitecore;
using Sitecore.Pipelines;
using Telligent.Evolution.Extensibility.Rest.Version1;

namespace Telligent.Rest.SDK.Sitecore.Pipelines
{
    public class InitializeHost
    {
        public virtual void Process(PipelineArgs args)
        {
            Host.Get(&amp;quot;default&amp;quot;);
        }
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Then using the Sitecore configuration files you insert it into the &amp;lt;initialize /&amp;gt; pipeline:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="xml"&gt;&amp;lt;configuration xmlns:patch=&amp;quot;http://www.sitecore.net/xmlconfig/&amp;quot;&amp;gt;
  &amp;lt;sitecore&amp;gt;
    &amp;lt;pipelines&amp;gt;
      &amp;lt;initialize&amp;gt;
        &amp;lt;processor type=&amp;quot;Telligent.Rest.SDK.Sitecore.Pipelines.InitializeHost, Telligent.SitecoreSDK&amp;quot; /&amp;gt;
      &amp;lt;/initialize&amp;gt;
    &amp;lt;/pipelines&amp;gt;
  &amp;lt;/sitecore&amp;gt;
&amp;lt;/configuration&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Now that you have this in place, you can use this host reference to set up additional features described in the [[Default REST Host]] topic such as local user detection and url proxying.&lt;/p&gt;
&lt;p&gt;If you choose to use Sitecore accounts as the basis for your community, you can use this pipeline to configure how the host gets your authenticated user:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;using Sitecore;
using Sitecore.Pipelines;
using Telligent.Evolution.Extensibility.Rest.Version1;

namespace Telligent.Rest.SDK.Sitecore.Pipelines
{
    public class InitializeHost
    {
        public virtual void Process(PipelineArgs args)
        {
            Host.Get(&amp;quot;default&amp;quot;).ResolveLocalUser = (host, resolveArgs) =&amp;gt;
            {
                if (Context.User == null || !Context.User.IsAuthenticated)
                {
                    return null; 
                }
                return new LocalUser(Context.User.Name, Context.User.Profile.Email);
            };

            //If you do not wish to use domain accounts
            //Host.Get(&amp;quot;default&amp;quot;).ResolveLocalUser = (host, resolveArgs) =&amp;gt;
            //{
            //    if (Context.User == null || !Context.User.IsAuthenticated)
            //        return null;

            //    return new LocalUser(Context.User.LocalName, Context.User.Profile.Email);
            //};
        }
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;For more information in this topic see the &amp;quot;Use Your Existing Accounts&amp;quot; topic in the [[Default REST Host]] article. Additionally, you can also add your delegates forUrl proxying.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;using Sitecore;
using Sitecore.Pipelines;
using Telligent.Evolution.Extensibility.Rest.Version1;

namespace Telligent.Rest.SDK.Sitecore.Pipelines
{
    public class InitializeHost
    {
        public virtual void Process(PipelineArgs args)
        {
            var host = Host.Get(&amp;quot;default&amp;quot;);
            host.ResolveLocalUser = (host, resolveArgs) =&amp;gt;
            {
                if (Context.User == null || !Context.User.IsAuthenticated)
                {
                    return null; 
                }
                return new LocalUser(Context.User.Name, Context.User.Profile.Email);
            };
            
            host..GetRedirectUrl = (host, url, urlArgs) =&amp;gt;
            {
               //The url parameter is the you can use it to evaluate if you need to redirect it.
               //Return the Url you wish to redirect to
               return url;
            };
        }
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;h2&gt;&lt;a id="Using_The_SDK" name="Using_The_SDK"&gt;&lt;/a&gt;Using The SDK&lt;/h2&gt;
&lt;p&gt;Other than the above mentioned areas for the [[Default REST Host]], you can use the SDK like you would in any .NET application. This includes writing special side code to do special non-interface tasks, or you can write code to power your ASPX pages or MVC powered views. &amp;nbsp;You can learn more about the usage and configuration of the SDK by reading the [REST SDK]] topic and its sub topics.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: sdk, sitecore, REST&lt;/div&gt;
</description></item><item><title>REST SDK and Sitecore</title><link>https://community.telligent.com/community/11/w/developer-training/65134/rest-sdk-and-sitecore/revision/4</link><pubDate>Tue, 04 Aug 2020 18:55:41 GMT</pubDate><guid isPermaLink="false">a28af10c-87ed-413d-b351-9ef2a11ab1e6</guid><dc:creator>Former Member</dc:creator><comments>https://community.telligent.com/community/11/w/developer-training/65134/rest-sdk-and-sitecore#comments</comments><description>Revision 4 posted to Developer Training by Former Member on 08/04/2020 18:55:41&lt;br /&gt;
&lt;p&gt;Sitecore is a popular .NET based Enterprise Content Management system that when coupled with Verint Community provides a powerful platform for customer engagement.&amp;nbsp; Because they are built on the same underlying technology, the [[REST SDK|Rest SDK]] makes integrating the two systems together easier.&lt;/p&gt;
&lt;p&gt;[toc]&lt;/p&gt;
&lt;h2&gt;&lt;a id="Installation_and_Configuration" name="Installation_and_Configuration"&gt;&lt;/a&gt;Installation and Configuration&lt;/h2&gt;
&lt;p&gt;Since this is an SDK, there is an assumption that you have a Visual Studio solution that you are using to develop Sitecore components.&amp;nbsp; The easiest way to start using the SDK is to install it into this solution using NuGet. &amp;nbsp;For more detailed instructions on how to install, review the&amp;nbsp;[[REST SDK|Rest SDK]] article&amp;#39;s &amp;quot;&amp;quot;How to Get It&amp;quot; topic.&amp;nbsp; This process will install the supporting files and references needed to begin configuring the SDK for first use.&lt;/p&gt;
&lt;p&gt;Once installed, you need to decide which [[Hosts|Host]] you wish to use.&amp;nbsp; You should take some time to review the [[Hosts]] topic to understand what they are and how they work.&amp;nbsp; The configuration of the SDK depends on the choice you make.&amp;nbsp; Here is a quick overview of the 2 available hosts that may help you choose the best path to continue researching:&lt;/p&gt;
&lt;p&gt;[[Default REST Host]] -&amp;nbsp; This is by the far the most feature-rich of the 2 hosts. &amp;nbsp;It also requires the most configuration, all of which is covered in more detail in the [[Default REST Host]] topic. &amp;nbsp; This host is capable of:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Performing all the [[Basic Requests]] of the SDK&lt;/li&gt;
&lt;li&gt;Optional Single Sign-On that automatically handles user creation and&amp;nbsp;synchronization in the community&lt;/li&gt;
&lt;li&gt;Url proxying- You can create a special code handler &amp;nbsp;the allows you to replace the urls returned in REST with urls you define in Sitecore.&lt;/li&gt;
&lt;li&gt;Multiple Host support if &amp;nbsp;you needed&amp;nbsp;to manage different hosts for different reasons, such as for multi-tenancy.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;[[Client Credentials REST Host]] - &amp;nbsp;If you just want to surface some information your Sitecore site, like a list of blogs or forum threads and don&amp;#39;t need all the&amp;nbsp;additional functionality, or you want more granular control over how everything works then this host may be appropriate.&amp;nbsp; This host is the simplest of the hosts as it allows you to just make REST calls using Oauth and not have to worry about managing OAuth tokens or add additional complex configuration. &amp;nbsp;With this host you can:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Perform all the [[Basic Requests]] of the SDK&lt;/li&gt;
&lt;li&gt;Act as a single user or impersonate other users in the community&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;&lt;a id="Default_REST_Host_and_Sitecore" name="Default_REST_Host_and_Sitecore"&gt;&lt;/a&gt;Default REST Host and Sitecore&lt;/h2&gt;
&lt;p&gt;Unlike the [[Client Credentials REST Host]], the [[Default REST Host]]&amp;nbsp;needs to be initialized and configured in code depending on the features you use.&amp;nbsp; It is recommended that this all be done in the application start or as close to it as possible.&amp;nbsp; &amp;nbsp;One proven way to do this in Sitecore is to use a pipeline. Now if you do not wish to use any of the options that require code based configuration such as using local user accounts or url proxying, then you do not need to do this.&amp;nbsp; The host will self initialize the&amp;nbsp;first time&amp;nbsp;you retrieve it. &amp;nbsp;Here is an example of initializing the host in a pipeline:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;using Sitecore;
using Sitecore.Pipelines;
using Telligent.Evolution.Extensibility.Rest.Version1;

namespace Telligent.Rest.SDK.Sitecore.Pipelines
{
    public class InitializeHost
    {
        public virtual void Process(PipelineArgs args)
        {
            Host.Get(&amp;quot;default&amp;quot;);
        }
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Then using the Sitecore configuration files you insert it into the &amp;lt;initialize /&amp;gt; pipeline:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="xml"&gt;&amp;lt;configuration xmlns:patch=&amp;quot;http://www.sitecore.net/xmlconfig/&amp;quot;&amp;gt;
  &amp;lt;sitecore&amp;gt;
    &amp;lt;pipelines&amp;gt;
      &amp;lt;initialize&amp;gt;
        &amp;lt;processor type=&amp;quot;Telligent.Rest.SDK.Sitecore.Pipelines.InitializeHost, Telligent.SitecoreSDK&amp;quot; /&amp;gt;
      &amp;lt;/initialize&amp;gt;
    &amp;lt;/pipelines&amp;gt;
  &amp;lt;/sitecore&amp;gt;
&amp;lt;/configuration&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Now that you have this in place, you can use this host reference to set up additional features described in the [[Default REST Host]] topic such as local user detection and url proxying.&lt;/p&gt;
&lt;p&gt;If you choose to use Sitecore accounts as the basis for your community, you can use this pipeline to configure how the host gets your authenticated user:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;using Sitecore;
using Sitecore.Pipelines;
using Telligent.Evolution.Extensibility.Rest.Version1;

namespace Telligent.Rest.SDK.Sitecore.Pipelines
{
    public class InitializeHost
    {
        public virtual void Process(PipelineArgs args)
        {
            Host.Get(&amp;quot;default&amp;quot;).ResolveLocalUser = (host, resolveArgs) =&amp;gt;
            {
                if (Context.User == null || !Context.User.IsAuthenticated)
                {
                    return null; 
                }
                return new LocalUser(Context.User.Name, Context.User.Profile.Email);
            };

            //If you do not wish to use domain accounts
            //Host.Get(&amp;quot;default&amp;quot;).ResolveLocalUser = (host, resolveArgs) =&amp;gt;
            //{
            //    if (Context.User == null || !Context.User.IsAuthenticated)
            //        return null;

            //    return new LocalUser(Context.User.LocalName, Context.User.Profile.Email);
            //};
        }
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;For more information in this topic see the &amp;quot;Use Your Existing Accounts&amp;quot; topic in the [[Default REST Host]] article. Additionally, you can also add your delegates forUrl proxying.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;using Sitecore;
using Sitecore.Pipelines;
using Telligent.Evolution.Extensibility.Rest.Version1;

namespace Telligent.Rest.SDK.Sitecore.Pipelines
{
    public class InitializeHost
    {
        public virtual void Process(PipelineArgs args)
        {
            var host = Host.Get(&amp;quot;default&amp;quot;);
            host.ResolveLocalUser = (host, resolveArgs) =&amp;gt;
            {
                if (Context.User == null || !Context.User.IsAuthenticated)
                {
                    return null; 
                }
                return new LocalUser(Context.User.Name, Context.User.Profile.Email);
            };
            
            host..GetRedirectUrl = (host, url, urlArgs) =&amp;gt;
            {
               //The url parameter is the you can use it to evaluate if you need to redirect it.
               //Return the Url you wish to redirect to
               return url;
            };
        }
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;h2&gt;&lt;a id="Using_The_SDK" name="Using_The_SDK"&gt;&lt;/a&gt;Using The SDK&lt;/h2&gt;
&lt;p&gt;Other than the above mentioned areas for the [[Default REST Host]], you can use the SDK like you would in any .NET application. This includes writing special side code to do special non-interface tasks, or you can write code to power your ASPX pages or MVC powered views. &amp;nbsp;You can learn more about the usage and configuration of the SDK by reading the [REST SDK]] topic and its sub topics.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item><item><title>REST SDK and Sitecore</title><link>https://community.telligent.com/community/11/w/developer-training/65134/rest-sdk-and-sitecore/revision/3</link><pubDate>Mon, 03 Aug 2020 21:07:41 GMT</pubDate><guid isPermaLink="false">a28af10c-87ed-413d-b351-9ef2a11ab1e6</guid><dc:creator>Former Member</dc:creator><comments>https://community.telligent.com/community/11/w/developer-training/65134/rest-sdk-and-sitecore#comments</comments><description>Revision 3 posted to Developer Training by Former Member on 08/03/2020 21:07:41&lt;br /&gt;
&lt;p&gt;Sitecore is a popular .NET based Enterprise Content Management system that when coupled with Telligent Community provides a powerful platform for customer engagement.&amp;nbsp; Because they are built on the same underlying technology, the [[REST SDK|Rest SDK]] makes integrating the two systems together easier.&lt;/p&gt;
&lt;p&gt;[toc]&lt;/p&gt;
&lt;h2&gt;&lt;a id="Installation_and_Configuration" name="Installation_and_Configuration"&gt;&lt;/a&gt;Installation and Configuration&lt;/h2&gt;
&lt;p&gt;Since this is an SDK, there is an assumption that you have a Visual Studio solution that you are using to develop Sitecore components.&amp;nbsp; The easiest way to start using the SDK is to install it into this solution using NuGet. &amp;nbsp;For more detailed instructions on how to install, review the&amp;nbsp;[[REST SDK|Rest SDK]] article&amp;#39;s &amp;quot;&amp;quot;How to Get It&amp;quot; topic.&amp;nbsp; This process will install the supporting files and references needed to begin configuring the SDK for first use.&lt;/p&gt;
&lt;p&gt;Once installed, you need to decide which [[Hosts|Host]] you wish to use.&amp;nbsp; You should take some time to review the [[Hosts]] topic to understand what they are and how they work.&amp;nbsp; The configuration of the SDK depends on the choice you make.&amp;nbsp; Here is a quick overview of the 2 available hosts that may help you choose the best path to continue researching:&lt;/p&gt;
&lt;p&gt;[[Default REST Host]] -&amp;nbsp; This is by the far the most feature-rich of the 2 hosts. &amp;nbsp;It also requires the most configuration, all of which is covered in more detail in the [[Default REST Host]] topic. &amp;nbsp; This host is capable of:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Performing all the [[Basic Requests]] of the SDK&lt;/li&gt;
&lt;li&gt;Optional Single Sign-On that automatically handles user creation and&amp;nbsp;synchronization in the community&lt;/li&gt;
&lt;li&gt;Url proxying- You can create a special code handler &amp;nbsp;the allows you to replace the urls returned in REST with urls you define in Sitecore.&lt;/li&gt;
&lt;li&gt;Multiple Host support if &amp;nbsp;you needed&amp;nbsp;to manage different hosts for different reasons, such as for multi-tenancy.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;[[Client Credentials REST Host]] - &amp;nbsp;If you just want to surface some information your Sitecore site, like a list of blogs or forum threads and don&amp;#39;t need all the&amp;nbsp;additional functionality, or you want more granular control over how everything works then this host may be appropriate.&amp;nbsp; This host is the simplest of the hosts as it allows you to just make REST calls using Oauth and not have to worry about managing OAuth tokens or add additional complex configuration. &amp;nbsp;With this host you can:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Perform all the [[Basic Requests]] of the SDK&lt;/li&gt;
&lt;li&gt;Act as a single user or impersonate other users in the community&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;&lt;a id="Default_REST_Host_and_Sitecore" name="Default_REST_Host_and_Sitecore"&gt;&lt;/a&gt;Default REST Host and Sitecore&lt;/h2&gt;
&lt;p&gt;Unlike the [[Client Credentials REST Host]], the [[Default REST Host]]&amp;nbsp;needs to be initialized and configured in code depending on the features you use.&amp;nbsp; It is recommended that this all be done in the application start or as close to it as possible.&amp;nbsp; &amp;nbsp;One proven way to do this in Sitecore is to use a pipeline. Now if you do not wish to use any of the options that require code based configuration such as using local user accounts or url proxying, then you do not need to do this.&amp;nbsp; The host will self initialize the&amp;nbsp;first time&amp;nbsp;you retrieve it. &amp;nbsp;Here is an example of initializing the host in a pipeline:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;using Sitecore;
using Sitecore.Pipelines;
using Telligent.Evolution.Extensibility.Rest.Version1;

namespace Telligent.Rest.SDK.Sitecore.Pipelines
{
    public class InitializeHost
    {
        public virtual void Process(PipelineArgs args)
        {
            Host.Get(&amp;quot;default&amp;quot;);
        }
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Then using the Sitecore configuration files you insert it into the &amp;lt;initialize /&amp;gt; pipeline:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="xml"&gt;&amp;lt;configuration xmlns:patch=&amp;quot;http://www.sitecore.net/xmlconfig/&amp;quot;&amp;gt;
  &amp;lt;sitecore&amp;gt;
    &amp;lt;pipelines&amp;gt;
      &amp;lt;initialize&amp;gt;
        &amp;lt;processor type=&amp;quot;Telligent.Rest.SDK.Sitecore.Pipelines.InitializeHost, Telligent.SitecoreSDK&amp;quot; /&amp;gt;
      &amp;lt;/initialize&amp;gt;
    &amp;lt;/pipelines&amp;gt;
  &amp;lt;/sitecore&amp;gt;
&amp;lt;/configuration&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Now that you have this in place, you can use this host reference to set up additional features described in the [[Default REST Host]] topic such as local user detection and url proxying.&lt;/p&gt;
&lt;p&gt;If you choose to use Sitecore accounts as the basis for your community, you can use this pipeline to configure how the host gets your authenticated user:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;using Sitecore;
using Sitecore.Pipelines;
using Telligent.Evolution.Extensibility.Rest.Version1;

namespace Telligent.Rest.SDK.Sitecore.Pipelines
{
    public class InitializeHost
    {
        public virtual void Process(PipelineArgs args)
        {
            Host.Get(&amp;quot;default&amp;quot;).ResolveLocalUser = (host, resolveArgs) =&amp;gt;
            {
                if (Context.User == null || !Context.User.IsAuthenticated)
                {
                    return null; 
                }
                return new LocalUser(Context.User.Name, Context.User.Profile.Email);
            };

            //If you do not wish to use domain accounts
            //Host.Get(&amp;quot;default&amp;quot;).ResolveLocalUser = (host, resolveArgs) =&amp;gt;
            //{
            //    if (Context.User == null || !Context.User.IsAuthenticated)
            //        return null;

            //    return new LocalUser(Context.User.LocalName, Context.User.Profile.Email);
            //};
        }
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;For more information in this topic see the &amp;quot;Use Your Existing Accounts&amp;quot; topic in the [[Default REST Host]] article. Additionally, you can also add your delegates forUrl proxying.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;using Sitecore;
using Sitecore.Pipelines;
using Telligent.Evolution.Extensibility.Rest.Version1;

namespace Telligent.Rest.SDK.Sitecore.Pipelines
{
    public class InitializeHost
    {
        public virtual void Process(PipelineArgs args)
        {
            var host = Host.Get(&amp;quot;default&amp;quot;);
            host.ResolveLocalUser = (host, resolveArgs) =&amp;gt;
            {
                if (Context.User == null || !Context.User.IsAuthenticated)
                {
                    return null; 
                }
                return new LocalUser(Context.User.Name, Context.User.Profile.Email);
            };
            
            host..GetRedirectUrl = (host, url, urlArgs) =&amp;gt;
            {
               //The url parameter is the you can use it to evaluate if you need to redirect it.
               //Return the Url you wish to redirect to
               return url;
            };
        }
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;h2&gt;&lt;a id="Using_The_SDK" name="Using_The_SDK"&gt;&lt;/a&gt;Using The SDK&lt;/h2&gt;
&lt;p&gt;Other than the above mentioned areas for the [[Default REST Host]], you can use the SDK like you would in any .NET application. This includes writing special side code to do special non-interface tasks, or you can write code to power your ASPX pages or MVC powered views. &amp;nbsp;You can learn more about the usage and configuration of the SDK by reading the [REST SDK]] topic and its sub topics.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item><item><title>REST SDK and Sitecore</title><link>https://community.telligent.com/community/11/w/developer-training/65134/rest-sdk-and-sitecore/revision/1</link><pubDate>Thu, 13 Jun 2019 19:32:54 GMT</pubDate><guid isPermaLink="false">a28af10c-87ed-413d-b351-9ef2a11ab1e6</guid><dc:creator>Ben Tiedt</dc:creator><comments>https://community.telligent.com/community/11/w/developer-training/65134/rest-sdk-and-sitecore#comments</comments><description>Revision 1 posted to Developer Training by Ben Tiedt on 06/13/2019 19:32:54&lt;br /&gt;
&lt;p&gt;Sitecore is a popular .NET based Enterprise Content Management system that when coupled with Telligent Community provides a powerful platform for customer engagement. &amp;nbsp; Because they are built on the same underlying technology, the [[REST SDK|Rest SDK]] makes integrating the 2 systems together easier.&lt;/p&gt;
&lt;p&gt;[toc]&lt;/p&gt;
&lt;h2&gt;&lt;a id="Installation_and_Configuration" name="Installation_and_Configuration"&gt;&lt;/a&gt;Installation and Configuration&lt;/h2&gt;
&lt;p&gt;Since this is an SDK, there is an assumption that you have a Visual Studio solution that you are using to develop Sitecore components. &amp;nbsp; The easiest way to start using the SDK is to install it into this solution using NuGet. &amp;nbsp;For more detailed instructions on how to install, review the&amp;nbsp;[[REST SDK|Rest SDK]] article&amp;#39;s &amp;quot;&amp;quot;How to Get It&amp;quot; topic. &amp;nbsp; This process will install the supporting files and references needed to begin configuring the SDK for first use.&lt;/p&gt;
&lt;p&gt;Once installed, you need to decide which [[Hosts|Host]] you wish to use. &amp;nbsp; You should take some time to review the [[Hosts]] topic to understand what they are and how they work. &amp;nbsp; The configuration of the SDK depends on the choice you make. &amp;nbsp; Here is a quick overview of the 2 available hosts that may help you choose the best path to continue researching:&lt;/p&gt;
&lt;p&gt;[[Default REST Host]] - &amp;nbsp; This is by the far the most feature-rich of the 2 hosts. &amp;nbsp;It also requires the most configuration, all of which is covered in more detail in the [[Default REST Host]] topic. &amp;nbsp; This host is capable of:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Performing all the [[Basic Requests]] of the SDK&lt;/li&gt;
&lt;li&gt;Optional Single Sign-On that automatically handles user creation and&amp;nbsp;synchronization in the community&lt;/li&gt;
&lt;li&gt;Url proxying- You can create a special code handler &amp;nbsp;the allows you to replace the urls returned in REST with urls you define in Sitecore.&lt;/li&gt;
&lt;li&gt;Multiple Host support if &amp;nbsp;you needed&amp;nbsp;to manage different hosts for different reasons, such as for multi-tenancy.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;[[Client Credentials REST Host]] - &amp;nbsp;If you just want to surface some information your Sitecore site, like a list of blogs or forum threads and don&amp;#39;t need all the&amp;nbsp;additional functionality, or you want more granular control over how everything works then this host may be appropriate. &amp;nbsp; This host is the simplest of the hosts as it allows you to just make REST calls using Oauth and not have to worry about managing OAuth tokens or add additional complex configuration. &amp;nbsp;With this host you can:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Perform all the [[Basic Requests]] of the SDK&lt;/li&gt;
&lt;li&gt;Act as a single user or impersonate other users in the community&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;&lt;a id="Default_REST_Host_and_Sitecore" name="Default_REST_Host_and_Sitecore"&gt;&lt;/a&gt;Default REST Host and Sitecore&lt;/h2&gt;
&lt;p&gt;Unlike the [[Client Credentials REST Host]], the [[Default REST Host]]&amp;nbsp;needs to be initialized and configured in code depending on the features you use. &amp;nbsp; &amp;nbsp;It is recommended that this all be done in the application start or as close to it as possible. &amp;nbsp; &amp;nbsp;One proven way to do this in Sitecore is to use a pipeline. Now if you do not wish to use any of the options that require code based configuration such as using local user accounts or url proxying, then you do not need to do this. &amp;nbsp; The host will self initialize the&amp;nbsp;first time&amp;nbsp;you retrieve it. &amp;nbsp;Here is an example of initializing the host in a pipeline:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;using Sitecore;
using Sitecore.Pipelines;
using Telligent.Evolution.Extensibility.Rest.Version1;

namespace Telligent.Rest.SDK.Sitecore.Pipelines
{
    public class InitializeHost
    {
        public virtual void Process(PipelineArgs args)
        {
            Host.Get(&amp;quot;default&amp;quot;);
        }
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Then using the Sitecore configuration files you insert it into the &amp;lt;initialize /&amp;gt; pipeline:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="xml"&gt;&amp;lt;configuration xmlns:patch=&amp;quot;http://www.sitecore.net/xmlconfig/&amp;quot;&amp;gt;
  &amp;lt;sitecore&amp;gt;
    &amp;lt;pipelines&amp;gt;
      &amp;lt;initialize&amp;gt;
        &amp;lt;processor type=&amp;quot;Telligent.Rest.SDK.Sitecore.Pipelines.InitializeHost, Telligent.SitecoreSDK&amp;quot; /&amp;gt;
      &amp;lt;/initialize&amp;gt;
    &amp;lt;/pipelines&amp;gt;
  &amp;lt;/sitecore&amp;gt;
&amp;lt;/configuration&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Now that you have this in place, you can use this host reference to set up additional features described in the [[Default REST Host]] topic such as local user detection and url proxying.&lt;/p&gt;
&lt;p&gt;If you choose to use Sitecore accounts as the basis for your community, you can use this pipeline to configure how the host gets your authenticated user:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;using Sitecore;
using Sitecore.Pipelines;
using Telligent.Evolution.Extensibility.Rest.Version1;

namespace Telligent.Rest.SDK.Sitecore.Pipelines
{
    public class InitializeHost
    {
        public virtual void Process(PipelineArgs args)
        {
            Host.Get(&amp;quot;default&amp;quot;).ResolveLocalUser = (host, resolveArgs) =&amp;gt;
            {
                if (Context.User == null || !Context.User.IsAuthenticated)
                {
                    return null; 
                }
                return new LocalUser(Context.User.Name, Context.User.Profile.Email);
            };

            //If you do not wish to use domain accounts
            //Host.Get(&amp;quot;default&amp;quot;).ResolveLocalUser = (host, resolveArgs) =&amp;gt;
            //{
            //    if (Context.User == null || !Context.User.IsAuthenticated)
            //        return null;

            //    return new LocalUser(Context.User.LocalName, Context.User.Profile.Email);
            //};
        }
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;For more information in this topic see the &amp;quot;Use Your Existing Accounts&amp;quot; topic in the [[Default REST Host]] article. Additionally, you can also add your delegates forUrl proxying.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;using Sitecore;
using Sitecore.Pipelines;
using Telligent.Evolution.Extensibility.Rest.Version1;

namespace Telligent.Rest.SDK.Sitecore.Pipelines
{
    public class InitializeHost
    {
        public virtual void Process(PipelineArgs args)
        {
            var host = Host.Get(&amp;quot;default&amp;quot;);
            host.ResolveLocalUser = (host, resolveArgs) =&amp;gt;
            {
                if (Context.User == null || !Context.User.IsAuthenticated)
                {
                    return null; 
                }
                return new LocalUser(Context.User.Name, Context.User.Profile.Email);
            };
            
            host..GetRedirectUrl = (host, url, urlArgs) =&amp;gt;
            {
               //The url parameter is the you can use it to evaluate if you need to redirect it.
               //Return the Url you wish to redirect to
               return url;
            };
        }
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;h2&gt;&lt;a id="Using_The_SDK" name="Using_The_SDK"&gt;&lt;/a&gt;Using The SDK&lt;/h2&gt;
&lt;p&gt;Other than the above mentioned areas for the [[Default REST Host]], you can use the SDK like you would in any .NET application. This includes writing special side code to do special non-interface tasks, or you can write code to power your ASPX pages or MVC powered views. &amp;nbsp;You can learn more about the usage and configuration of the SDK by reading the [REST SDK]] topic and its sub topics.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item></channel></rss>