HomeDev GuideRecipesAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Reset account functionality

How to reset account functionality when working with GraphQL.

You may need to reset the search index that the Optimizely Graph service uses to retrieve results. This typically arises when your Optimizely Graph tenant synchronizes with multiple sites with different content and content types or because you want to reset your data to standard indexes. Resetting account functionality involves removing indexes and creating new standard indexes for the current tenant.

🚧

Important

Resetting account functionality deletes your indexed data and is not a routine maintenance procedure. After resetting your account, manually run the Content type indexing job and Content indexing job again.

Use the CMS Admin UI and a GraphQL call (account mutation) to perform the reset account procedure.

Reset using Optimizely Content Management System

After installing the Optimizely.Search.Synchronizer package, the admin menu for your site features a Project GraphQL page.

  1. Go to Admin > Project GraphQL. (You can also visit http://<yoursite>/EPiServer/ProjectGraphQL/GraphQLAdmin).
  2. Click Reset Account, and confirm the reset procedure for the current account.

Use a reset account mutation (advanced)

You can reset your account with a GraphQL call to reset the account mutation.

{
    "query": "mutation { resetAccount }"
}

To use reset account mutation, use HMAC authentication for data integrity and message authentication purposes. Set your request's confirmation header RemoveAllData to true.

Example using Postman:
URL:

POST https://cg.optimizely.com/content/v2

Headers:

RemoveAllData: true

Body (JSON):

{
    "query": "mutation { resetAccount }"
}

Pre-request Script:

var crypto = require("crypto-js");
var sdk = require('postman-collection');
var method = pm.request.method;
var key = "yourProvidedSecret";
var secret = CryptoJS.enc.Base64.parse("yourProvidedSecret");
var target = new sdk.Url(request.url).getPathWithQuery();
var timestamp = (new Date()).getTime();
var nonce = Math.random().toString(36).substring(7);
var body = "";
if( pm.request.body )
{
    body = pm.request.body.raw;
}
var bodybase64 = crypto.MD5(body).toString(CryptoJS.enc.Base64);
var hmac = crypto.HmacSHA256(key + method + target + timestamp + nonce + bodybase64, secret);
var base64hmac = CryptoJS.enc.Base64.stringify(hmac);
var header = "epi-hmac " + key + ":" + timestamp +":" + nonce + ":" + base64hmac;
// Add Authorization header with computed HMAC to the request
pm.request.headers.add({
    key: "Authorization",
    value: header});

HMAC keys:

var key = "yourProvidedAppKey"
var secret = "yourProvidedSecret"

Replace yourProvidedSecret and yourProvidedSecret in the pre-request script with the same keys that are used in web.config or appsettings.json of your site.

Successful result:

See GraphQL mutation.