Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

Dev Guide
Dev GuideUser GuidesLegal TermsGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

OCP APIs

This topic describes how to work with almost all of the Optimizely Connect Platform (OCP) APIs.

Node SDK for Apps

You can use almost all of the Optimizely Connect Platform (OCP) APIs from within an app using the Node SDK. The key management will happen automatically within an app as well so you do not have to ask the users for their keys.

Optimizely Node SDK Docs

import {z} from '@zaius/node-sdk';

/**
 * Configure the Zaius SDK for use
 */
z.configure(sdkConfig);

/**
 * Access public values of the current configuration
 */
z.config;

/**
 * Send an event to ODP using the v3 event API
 */
z.event(eventPayload);
z.event(eventPayload[]);

/**
 * Create or Update a customer profile in ODP using the v3 profiles API
 */
z.customer(customerPayload, options);
z.customer(customerPayload[], options);

/**
 * Create or Update an object in ODP using the v3 objects API
 */
z.object(type, objectPayload, options);

/**
 * Manage schema (Optimizely domain objects and fields) using the v3 APIs
 */
z.schema.createField(object, field);
z.schema.createIdentifier(identifier);
z.schema.getEnabledModules();
z.schema.enableModule(moduleName);
z.schema.getObject(name);
z.schema.getAllObjects();
z.schema.createObject(objectDefinition);
z.schema.createRelation(object, relationDefinition);

/**
 * Manage customer identifiers using the v3 APIs
 */
z.identifier.updateMetadata(identifierUpdates);
z.identifier.getMetadata(identifierFieldName, identifierValue);
z.identifier.updateReachability(reachabilityUpdates);
z.identifier.getReachability(identifierFieldName, identifierValue);
z.identifier.updateConsent(consentUpdates);
z.identifier.getConsent(identifierFieldName, identifierValue);

/**
 * Manage list subscriptions using the v3 APIs
 */
z.list.createList(listName);
z.list.getLists(listName);
z.list.subscribe(listId, identifiers);
z.list.unsubscribe(listId, identifiers);
z.list.updateSubscriptions(listId, arrayOfUpdates);