HomeDev guideRecipesAPI ReferenceGraphQL
Dev guideUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Reset account functionality

Describes how to reset account functionality when working with GraphQL.

Sometimes you may need to reset the search index that the Optimizely Graph service uses to retrieve results. This need 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.

🚧

Caution

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.

To perform the reset account procedure, use the CMS Admin UI and a GraphQL call (account mutation).

Reset with the CMS Admin UI

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 also can go to http:///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 for reset account mutation.

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

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

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 also: GraphQL mutation