Docs‎ > ‎CA Live API Creator‎ > ‎Create‎ > ‎Resources‎ > ‎REST APIs‎ > ‎

JavaScript Example

This procedure will download a JavaScript app that runs against the pre-installed Demo project.  You can run the app directly from the file system - there's nothing to deploy.  Please follow the directions below.

Download the App

To get the application:
  1. Download the JavaScript sample app's zip file from here.
  2. Unzip it into a folder with no spaces in the path (important: do not run the files from the zip - that will not work) 
  3. Modify the JavaScript file LogicDemo.js ({froot folder}/WebContent/js}

Matching your Server Location and Auth Token

You'll need to update it to match your server location and Auth Token, as described here.

First, a bit of background.  When you create your project (here called Demo as shown in "Current project"), API Creator generates a default Auth Token key:

Using this, update the app as shown below:
  1. Open the WebContent/js/LogicDemo.js in a text editor, as shown below

  2. Update the ec2baseUrl, specifying your account / project.  Shown below are settings for account valJune18, using the pre-installed demo project (its' urlName is obtained as described here).

  3. Update the currentApiKey from the setting above

Running the application

You can run this directly from the file system:
  1. Double-click WebContent/index.html - should run in your Browser.
This app should look as shown below.  Explore the various Use Cases, such as changing Line Items, adding Orders, etc.  To keep it simple, all changes are immediate - there is no save button.

When you make a change, you will see the transaction log (right side of screen, labelled Logic Execution Plan).  You can see the same log in your log screen, which you'll find useful for debugging your own applications.

Unknown user,
Nov 20, 2015, 12:41 PM