Marketing Sample

The Marketing API sample is a small sample that illustrates a complete API, starting with no database. This sample creates a database, a basic user interface, and an API. It enforces simple logic.

Download the API from the file.

For more information about how to create the API, see Manage Existing Schema.

Business Requirement

Your company does business with many larger partners who put on shows. The partners provide Events, which includes a location, and options for Speaking and/or Exhibitions. These include costs. Live API Creator must capture these, and select Speaking/Exhibition options, subject to a budget.

As part of the application economy, your company receives discounts if your interaction is digital. Also as part of the application economy, you needed it yesterday.

Watch it

The following video illustrates how to create a database, a basic user interface, and an API that enforces simple logic:

Embed gadget

Phase 1: Create Database

The following image shows Data Explorer:

This creates and runs all the Data Definition Language (DDL) for this data model (click to enlarge image):

Phase 2: Reactive Logic

The following image shows the rules on the Manage, Rules, By table tab:

Phase 3: APIs connect to Partners, Systems

You can iterate, and use the JavaScript debugger.  Let's Post to AccountPost when an Event is Approved.

For more information

Here is a summary of the steps from the video above:

1. Use Schema to define a new attribute: Events.Approved 

2. Define a Custom Resource called AccountingPost, that includes Events, Exhibits and Talks.  Set the Filter for the Exhibits and Talks:

"Use" = true

3. Enable the User Library TransformToWebHook

4. Create an event for the Events table, with:

if (row.Approved === true && row.Approved !== oldRow.Approved) {
    var transform = logicContext.transformCurrentRow("AccountingPost");
    B2B.sendToWebHook(transform, "URL TBD");

The code will fail since the string "URL TBD" should be null; this will give you a chance to try to the debugger.