Dev Guide
Dev GuideUser GuidesLegal TermsGitHubDevCommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

ODP APIs

Describes how to work with Optimizely Data Platform (ODP) APIs within your app.

You can use almost all the Optimizely Data Platform (ODP) APIs from within an app using the Node SDK. The key management and authentication occurs automatically within an app, so you do not have to provide API keys or any other credentials.

📘

Note

Omit the configure step as this is done automatically within your app.

Access ODP APIs using Node SDK

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

/**
 * 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);

/**
 * Query data using the GraphQL API
 */
z.graphql<ResponseType>(query, variables);

Access ODP APIs using ApiV3

For ODP APIs that the Node SDK does not natively support, you can use the ApiV3 helper to call any ODP API directly.

📘

Note

Authentication occurs automatically within an app, so you do not have to provide API keys or any other credentials.

For example:

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

await z.v3Api.post('objects/products', [
  {
    product_id: '123',
    name: 'Red Shirt'
  },
  {
    product_id: '456',
    name: 'Blue Shirt'
  }
]);

📘

Note

For more information on ODP APIs, see the ODP API reference.