Follow the instructions in this section to create the environment in which you can explore the REST API.
This example uses the Campaign Conversion app in a local installation of Xpress Insight.
To explore the file structure, install
node.js, and perform the following steps:
- In Windows Explorer, navigate to <Xpress Install Directory>\examples\insight\developer_guide\chapter8\rest-client-example\.
The three files,
package.json,
rest-client-example.js, and
dmp-rest-client-example.js, are contained in this directory—This example uses
package.json and
rest-client-example.js.
The package.json file contains some Node.js configuration—specifically calling for the request and prequest modules. request is a simplified HTTP client with HTTPS support, while prequest offers HTTP requests with promises. You can investigate them further at http://github.com/request/request and https://github.com/alyssaq/prequest respectively.
{
"name": "rest-client-example",
"version": "1.0.0",
"author": "FICO",
"devDependencies": {
"prequest": "^1.0.0",
"request": "^2.75.0"
}
}
The rest-client-example.js file contains the example code itself.
- Open a Command Prompt window, navigate to the rest-client-example directory.
- Type npm install and press Enter to obtain the prerequisites and download them into node_modules.
The
node_modules folder is added to your
rest-client-example directory.