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

Dev Guide
Dev GuideUser GuidesGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

OCP database

Manage the data in your Optimizely Connect Platform (OCP) database.

👍

Beta

Optimizely Connect Platform (OCP) for Optimizely is in beta and currently only works with Optimizely Graph in Optimizely Content Management System (CMS) (SaaS) and CMS (PaaS).

The Optimizely Connect Platform (OCP) database is a relational database that can store object data from any source. Data in OCP is stored in collections called objects (also known as a database table). Objects are composed of fields (also known as database columns). Fields link objects together through relationships.

Each object has a primary key to represent an instance of the object. For example, a table representing product data might have a primary key of product_id. This ID is used to create or update new data introduced to the object.

Manage your data schema

You can customize your OCP data schema to represent data tables and relationships from your different systems. See Import data for information on the following data import options.

  • When you import data through an app installation, the app manages your data schema for you, creating any necessary objects, fields, and relationships.
  • When you import data through a CSV file import, you must first manually create the objects (data tables) and fields (data table columns) necessary to support the data being imported.
  • When you import data through the OCP API, you must first manually create the objects (data tables) and fields (data table columns) necessary to support the data being imported.

You can view and manage the schema of your OCP database on the Data Setup > Objects & Fields page in the OCP user interface (UI). The tabs on this page represent the objects in your OCP database. You can select an object and view the fields and data contained within it.

Manage data schema using the API

You can manage your data schema using the following endpoints. See how to make API requests.

  • Update object – Update an existing object in your OCP database.
  • Create object – Create an object in OCP. Define its fields and how it relates to other objects.
  • List objects – List the details of all objects in your OCP account.
  • Get object – List the details of a specific object in your OCP account.
  • Create field – Create a field on an object in your OCP database.
  • List fields – List the details of all fields for a specific object in your OCP database.
  • Get field – List the details of a single field for a specific object in your OCP database.
  • Create relationship – Create a relationship between objects in OCP.
  • List relations – List the details of all relationships of a specific object in OCP.
  • Get relation – List the details of a single relationship of a specific object in OCP.

Add custom objects and fields

🚧

Important

Before you import data using a CSV file or the OCP API, you must create the necessary objects (data tables) and fields (data table columns) in OCP to support the data you plan to import.

Change OCP schema with caution. After you create an object or field, you cannot delete or rename it.

You can create custom objects and fields in the UI or through the API. To do this through the API, see the following endpoints:

  • Create object – Create an object in OCP. Define its fields and how it relates to other objects.
  • Create field – Create a field on an object in your OCP database.
  • Create relationship – Create a relationship between objects in OCP.

To create custom objects and fields in the UI:

  1. Go to Data Setup > Objects & Fields.

  2. Expand Create New Field and select Object to create a database table.


  3. Complete the following:

    • Object Display Name – Enter the display name for the object that is used throughout the OCP UI. This name can include spaces. For example, Custom Categories.
    • Object Name – Enter a name for the object that is used in the database and API. You must use underscores between words in place of spaces. For example, custom_categories.
    • Primary Key Display Name – Enter a display name for the object's primary key, which represents an instance of the object. This name can include spaces. For example, Category ID.
    • Primary Key Name – Enter a name for the object's primary key that is used in the database and API. You must use underscores between words in place of spaces. For example, category_id.
    • Select Primary Key Type – Select Number or Text. This is the data type for the primary key.
  4. Click Save.

  5. Go to Data Setup > Objects & Fields.

  6. Click Create New Field to create a column in your custom database table.

  7. Complete the following:

    • Object Containing New Field – Select the custom object where you want to store this field.
    • Field Display Name – Enter the display name for the field that is used throughout the OCP UI. This name can include spaces. For example, Category Name.
    • Field Name – Enter a name for the field that is used in the database and API. You must use underscores between words in place of spaces. For example, category_name.
    • Field Type – Select the data type for the field.
      • Number – A number represented in standard decimal format (like 0, 3.14159, -2.3, -0.112).
      • Text – Any printable UTF-8 encoded character, including space. Text is limited to 1024 characters.
      • True/False – Must be one of 0, 1, true, or false.
      • Date & Time (timestamp) – Must be formatted as ISO 8601 format or UNIX epoch (seconds since January 1, 1970). For example, 1435708800, 2015-07-01T00:00:00-00:00, 2015-07-01T12:30:00-07:00.
        Note: If time and time zone are not provided, the time is assumed to be 12am UTC.
    • Field Description – (Optional) Enter a description for the field.
  8. Click Save.

  9. Repeat these steps until you have the correct objects (data tables) and fields (database table columns) to support your data import.

Custom objects and fields example

For example, you might want to import the following customer service ticket data:

ticket_agentsatisfaction_ratingcustomer_buckettopic_categoryticket_idcustomer_email
Alex5VIPpassword reset123456[email protected]

Before you can import this data, you need to create the following object (data table) and fields (data table columns) to hold that data:

  • Objecttickets
  • Fields
    • ticket_agent
    • satisfaction_rating
    • customer_bucket
    • topic_category
    • ticket_id
    • customer_email

After you create the object and fields, you can import the data.