Skip to content

Sample App

  Less than to read

In order to help you get started quickly with your own application development, we are providing sample application which cover the basic Data Integration API calls to the X3 application.

In this section, you will build a simple application using Node.js which will upload a file to an X3 configuration and download a file exported by and X3 configuration.

Before you begin

Please make sure that you have latest versions of the following tech dependencies:

  • Visual Studio Code
  • Node.js
  • npm (Installed by default with NodeJS)
  • Git Client
  • App ID/ App secret created with Sage App Registry
    • Redirect URI: https://localhost:5050/callback
    • Notification URI: https://localhost:5050/notifications
  • X3 Sand Box environment

Download an empty project here, then upzip the file. This command may take a few minutes:

    npm i

Then create certificate file to enable https protocol:

    openssl req -nodes -new -x509 -keyout server.key -out server.cert

The result is a working empty project. Open the folder with VSCode, you should have this folder structure :

Step 0

with folders:

  • css: contains CSS file for HTML stylesheet

  • js: contains javascript file for client side (Web browser)

  • lib: contains javascript file for server side

  • views: contains handlebars file for html template

  • main.js: entry point of the demo app

Before launching the project, goto .vscode folder and modify launch.json by entering these 3 values obtained before hand :

  • “ENDPOINT_URL”: API Gateway of the sandbox environment

  • “CLIENT_ID”: your App ID

  • “CLIENT_SECRET”: your App secret

To start the project in VS Code, goto the debug menu then click “Launch Program”:

Step 0

Open a web browser and go to https://localhost:5050/settings to see the default page:

Step 0

Now, you will build the application step by step by implementing basically one by one menu entry (numbered on the screenshot). After each step, you can download the project source code:

Don’t forget to run npm install inside the unzipped folder then open the folder with VSCode and launch the debug to see the result at https://localhost:5050/settings.