HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket


## Setup

### Package conventions

The packages of the Optimizely Community API adhere to a number of conventions intended to enhance their discoverability and clarify their purposes. A description of these conventions can be found below.

### Package identification

Packages comprising the Optimizely Community API are identified with the prefix _EPiServer.Social_.

### Feature packages

Specific feature packages are identified by a name conforming to the following pattern: _EPiServer.Social.[Feature-Name]_. The _[Feature-Name]_ identifies the platform feature being installed with the package. Examples:

  • _EPiServer.Social.Comments_

  • _EPiServer.Social.Ratings_

### Integration packages

Each Optimizely Community API feature package is accompanied by an optional Optimizely Content Management System (CMS) integration package. These packages conveniently register the services of an Optimizely Community API feature with the service locator supporting an CMS site. These packages can be identified by a name conforming to the following pattern: _EPiServer.Social.[Feature-Name].Site_. Examples:

  • _EPiServer.Social.Comments.Site_

  • _EPiServer.Social.Ratings.Site_

### Package list

Here are the Optimizely Community API packages.

**Package list**Column Title
PackageDescription
_EPiServer.Social.Framework_Installs all features of the Optimizely Community API to an Optimizely Content Management System (CMS) site
_EPiServer.Social.Comments_Installs the platform's commenting services
_EPiServer.Social.Comments.Site_Integrates the platform's commenting services with the CMS's service locator
_EPiServer.Social.Ratings_Installs the platform's rating services
_EPiServer.Social.Ratings.Site_Integrates the platform's rating services with the CMS's service locator
_EPiServer.Social.Moderation_Installs the platform's moderation services
_EPiServer.Social.Moderation.Site_Integrates the platform's moderation services with the CMS's service locator
_EPiServer.Social.Groups_Installs the platform's group services
_EPiServer.Social.Groups.Site_Integrates the platform's group services with the CMS's service locator
_EPiServer.Social.ActivityStreams_Installs the platform's activity stream services
_EPiServer.Social.ActivityStreams.Site_Integrates the platform's activity stream services with the CMS's service locator

The following packages support the platform services and are ancillary to the packages above.

**Ancillary package list**Column Title
PackageDescription
_EPiServer.Social.Common_Supports core functionality of the platform's services
_EPiServer.Social.Common.Rest_Supports integration between the platform's features and associated cloud services

## Install

Follow these steps to install the Optimizely Community API packages. These steps may be repeated for each feature.

  • Installing in an Optimizely site

  • Installing in other applications

### Install in an Optimizely site

  1. Open the Optimizely site with Visual Studio.

  2. From Visual Studio's Solution Explorer window, right click the website's project.

  3. From the menu, choose **Manage NuGet Packages**.

  4. From the NuGet Package Manager, select the Package Source serving the Optimizely Community API packages.

  5. From the list of packages, click the _EPiServer.Social.[Feature-Name].Site_ package corresponding to the feature that you wish to install.

  6. Click the **Install** button. When complete, the package and its dependencies are applied to your site.

### Install in other applications

  1. Open the application with Visual Studio.

  2. From Visual Studio's Solution Explorer window, right click the website's project.

  3. From the menu, choose **Manage NuGet Packages**.

  4. From the NuGet Package Manager, select the Package Source serving the Optimizely Community API packages.

  5. From the list of packages, click the _EPiServer.Social.[Feature-Name]_ package corresponding to the feature that you wish to install.

  6. Click the **Install** button. When complete, the package and its dependencies are applied to your site.

## Get connected

To use the Optimizely Community APIs, you must first configure your application to communicate with the cloud services that support these features.

Note

The details of this configuration are provided to you when your Optimizely Community API account is provisioned. If you have not received your configuration, please contact your Optimizely account manager.

### CMS 12 – Configure the Optimizely Community API

Open _appsettings.json_ and update it to include the XML configuration that was provided to you. An example configuration is shown below:



Add the service into the in Startup.cs file



### CMS 11 – Configure the Optimizely Community API

Open your application's _web.config_ or _app.config_ and update it to include the XML configuration that was provided to you. An example configuration is shown below:



Note

This XML represents a sample configuration. The configuration provided to you contains the necessary data to connect to the Optimizely Community API cloud services.

Note

A missing or malformed configuration will result in a SocialException being thrown when attempting to interact with the Optimizely Community APIs.

### Settings

This section captures general settings for the Optimizely Community APIs.

  • **timeout** – The length of time (in milliseconds), which the Optimizely Community APIs will allow for requests to complete. Requests that exceed the configured timespan are aborted with an exception.

### Authentication

This section captures the settings necessary for your application to authenticate with the Optimizely Community API.

  • **appId** – The unique identifier representing your Optimizely Community API account.

  • **secret** – The cryptographic key used to ensure the authenticity of requests from your application.

### Endpoints

This section defines the endpoints for individual Optimizely Community API services.

### Authentication

The Optimizely Community API uses a multi-layered approach to ensuring the authenticity and integrity of each request issued to it.

### Configuration

The Optimizely Community API configuration for your application captures settings supporting the authentication process. The accuracy of these settings is crucial. Inaccurate authentication settings result in requests being rejected as unauthentic.

Note

Your application’s appId and secret are _private_ to your application. This information should not be committed to a source control repository or otherwise publicly exposed. It is recommended that this information be applied as a step in your application deployment process.

### Server Time

One aspect of the authentication procedure enforces an expiration time for all requests. A request to the Optimizely Community API is allowed five minutes from the time it is constructed until the time it is received by the platform. Requests falling outside of this grace period are rejected as unauthentic.

Note

It is essential that the server hosting your application maintains accurate time. When the server time is inaccurate, requests are created with inaccurate timestamps. As a result, these requests may be rejected as unauthentic.

### Communicate with cloud services

The Optimizely Community APIs communicate with cloud services over HTTPS. The endpoints for these services are identified in the configuration for your application. Configure your application hosting environment to permit communication between your application and these endpoints.