{"id":44028,"date":"2016-09-14T20:17:04","date_gmt":"2016-09-14T17:17:04","guid":{"rendered":"https:\/\/www.altoros.com\/blog\/?p=44028"},"modified":"2019-06-08T04:45:31","modified_gmt":"2019-06-08T01:45:31","slug":"how-to-configure-predix-analytics-services-and-use-them-from-a-node-js-app","status":"publish","type":"post","link":"https:\/\/www.altoros.com\/blog\/how-to-configure-predix-analytics-services-and-use-them-from-a-node-js-app\/","title":{"rendered":"How to Set Up Predix Analytics Services and Use Them from a Node.js App"},"content":{"rendered":"<p><a href=\"https:\/\/www.predix.io\/docs\/?r=57569#EG3xVdLg\" target=\"_blank\" rel=\"noopener noreferrer\">Predix Analytics<\/a> is a set of services that enable developers to use analytics solutions  implemented by data scientists from their own apps. In this post, we explain how to get started with the three services required for running Predix analytics: Analytics Catalog, Analytics Runtime, and Analytics User Interface. With the provided instructions, you will be able to set up the services and call the Univariate Anomaly Detection analytic service from a Node.js application.<\/p>\n<p>&nbsp;<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_79_2 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.altoros.com\/blog\/how-to-configure-predix-analytics-services-and-use-them-from-a-node-js-app\/#Prerequisites\" >Prerequisites<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.altoros.com\/blog\/how-to-configure-predix-analytics-services-and-use-them-from-a-node-js-app\/#Creating_and_configuring_the_services\" >Creating and configuring the services<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.altoros.com\/blog\/how-to-configure-predix-analytics-services-and-use-them-from-a-node-js-app\/#Code_for_the_Nodejs_application\" >Code for the Node.js application<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.altoros.com\/blog\/how-to-configure-predix-analytics-services-and-use-them-from-a-node-js-app\/#What_to_do_next\" >What to do next<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.altoros.com\/blog\/how-to-configure-predix-analytics-services-and-use-them-from-a-node-js-app\/#Further_reading\" >Further reading<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"Prerequisites\"><\/span>Prerequisites<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>To follow the steps of the tutorial, you need:<\/p>\n<ul>\n<li>A Predix account<\/li>\n<li>Node.js and npm installed on your system<\/li>\n<li>The <a href=\"https:\/\/github.com\/cloudfoundry\/cli\" target=\"_blank\" rel=\"noopener noreferrer\">Cloud Foundry CLI<\/a><\/li>\n<li>The <a href=\"https:\/\/github.com\/cloudfoundry\/cf-uaac\" target=\"_blank\" rel=\"noopener noreferrer\">UAA CLI<\/a> (optional; Predix <a href=\"https:\/\/uaa-dashboard.run.aws-usw02-pr.ice.predix.io\" target=\"_blank\" rel=\"noopener noreferrer\">UAA Dashboard<\/a> should be sufficient for our needs)<\/li>\n<\/ul>\n<p>Here, I describe the service setup process very briefly. Refer to the <a href=\"https:\/\/www.predix.io\/docs\/?r=36675#EG3xVdLg\" target=\"_blank\" rel=\"noopener noreferrer\">Predix documentation<\/a> for more detail.<\/p>\n<p>Note that analytic services are commonly referenced as \u201can analytic\u201d in the Predix catalog. In this tutorial, I use \u201can analytic service\u201d as the equivalent.<\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Creating_and_configuring_the_services\"><\/span>Creating and configuring the services<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Before setting up the services, you may want to create a new Cloud Foundry space to isolate your application. You can do it by clicking the Create Space button in the Predix console or by using the Cloud Foundry CLI and its <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">cf create-space SPACE_NAME<\/code> command (replace <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">SPACE_NAME<\/code> with a name of your choice). To continue working with the Cloud Foundry CLI within the recently created space, run the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">cf target -s SPACE_NAME<\/code> command.<\/p>\n<p>&nbsp;<br \/>\n<b>Step 1. Setting up UAA<\/b><\/p>\n<p>User Account and Authentication (UAA) is a hard dependency of the Predix Analytics services and is needed for authorizing access to all of their functionality (management, execution, and status check).<\/p>\n<p>To set up a UAA service instance, run the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">cf create-service predix-uaa Tiered uaa -c '{\"adminClientSecret\":\"SECRET\"}'<\/code> command, replacing <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">SECRET<\/code> with your password.<\/p>\n<p>If you want to create a UAA service instance from the Predix console, click Subscribe on the <a href=\"https:\/\/www.predix.io\/services\/service.html?id=1172\" target=\"_blank\" rel=\"noopener noreferrer\">User Account and Authentication<\/a> service page and fill out the form. You may leave the Subdomain field empty.<\/p>\n<p>&nbsp;<br \/>\n<b>Step 2. Configuring UAA<\/b><\/p>\n<p>For working with analytics, we need a separate UAA client with appropriate grants.<\/p>\n<p>A UAA client can be created with the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">uaac client add -i<\/code> command. You have to authenticate as an admin client before setting up a new client (see <a href=\"https:\/\/github.com\/cloudfoundry\/cf-uaac#connecting-and-logging-in\" target=\"_blank\" rel=\"noopener noreferrer\">UAAC documentation<\/a>). Alternatively, you can create a client from a web configuration tool. To do that, click the Configure Service Instance button on your UAA service page and specify the admin client secret key used in Step 1.<\/p>\n<p>Make sure the new client has <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">implicit<\/code>, <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">client_credentials<\/code>, <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">password<\/code>, and <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">authorization_code<\/code> in authorized grant types. Scope and authorities are to be updated after the creation of the Analytics services.<\/p>\n<p>Create a user to log in to the Analytics UI with the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">uaac user add USERNAME -p PASSWORD<\/code> command.<\/p>\n<p>&nbsp;<br \/>\n<b>Step 3. Setting up Analytics Catalog<\/b><\/p>\n<p>Before creating an Analytics Catalog service instance, you need to know your UAA GUID. You can obtain it by running the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">cf service uaa --guid<\/code> command, where <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">uaa<\/code> is your UAA service name.<\/p>\n<p>To create the service instance, run the following command,<\/p>\n<pre>cf create-service predix-analytics-catalog Bronze SERVICE_NAME -c '{\"trustedIssuerIds\":[\"ISSUER_ID\"]}'<\/pre>\n<p>where:<\/p>\n<ul>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">ISSUER_ID<\/code> is <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">https:\/\/GUID.predix-uaa.run.aws-usw02-pr.ice.predix.io\/oauth\/token<\/code>. <\/li>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">GUID<\/code> is the UAA GUID we obtained at the beginning of this step. <\/li>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">SERVICE_NAME<\/code> is the name you want to give your Catalog service.<\/li>\n<\/ul>\n<p>After the service is created, you need to update the UAA client and create a group for granting authorities to the client users. First, add <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">analytics.zones.GUID.user<\/code> to your client\u2019s <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">scope<\/code> and <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">authorities<\/code> fields: <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">uaac client update CLIENT_NAME -i<\/code>. (Ensure you preserve existing values when making the updates.) Then, create the group with the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">analytics.zones.GUID.user<\/code> name: <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">group add GROUP_NAME<\/code>. To grant a user Analytics Catalog access rights, add this user to the group with the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">uaac member add GROUP_NAME USER_NAME<\/code> command.<\/p>\n<p>&nbsp;<br \/>\n<b>Step 4. Setting up Analytics Runtime<\/b><\/p>\n<p>The process of creating an Analytics Runtime service instance is identical to the described in Step 3. Just remember to use <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">predix-analytics-runtime<\/code> instead of <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">predix-analytics-catalog<\/code> when launching the instance with the Cloud Foundry CLI and to use the Analytics Runtime service instance GUID in UAA client updates.<\/p>\n<p>&nbsp;<br \/>\n<b>Step 5. Setting up Analytics User Interface<\/b><\/p>\n<p>You can create an Analytics UI service instance with the following command:<\/p>\n<pre>cf create-service predix-analytics-ui Free UI_SERVICE_NAME -c '{\"clientId\":\"CLIENT\",\"clientSecret\":\"SECRET\",\"uaaHostUri\":\"UAA_URL\",\"domainPrefix\":\"YOUR_PREFIX\",\"catalogPredixZoneId\":\"CATALOG_GUID\",\"runtimePredixZoneId\":\"RUNTIME_GUID\"}'<\/pre>\n<p>Also, the parameters description is available in the Predix catalog (<a href=\"https:\/\/www.predix.io\/services\/service.html?id=1586\" target=\"_blank\" rel=\"noopener noreferrer\">Analytics User Interface<\/a> in the Analytics Services section), and you can create the service instance right from there.<\/p>\n<p><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/ge-predix-uaa-v1.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/ge-predix-uaa-v1.jpg\" alt=\"ge-predix-uaa-v1\" width=\"647\" height=\"641\" class=\"aligncenter size-full wp-image-44030\" \/><\/a><\/p>\n<p>Now, you should be able to log in to your UI  with the user credentials created in Step 1. (You can get the URL from the output of the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">cf service UI_SERVICE_NAME<\/code> command.)<\/p>\n<p>&nbsp;<br \/>\n<b>Step 6. Setting up the Univariate Anomaly Detection service<\/b><\/p>\n<p>In the Predix catalog, go to the Analytics tab, select the Univariate Anomaly Detection analytic service, and then click Subscribe. Fill out the form with information about your space and the services created in the previous steps.<\/p>\n<p><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/ge-predix-analytics-catalog-v1.jpg\"><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/ge-predix-analytics-catalog-v1.jpg\" alt=\"ge-predix-analytics-catalog-v1\" width=\"640\" class=\"aligncenter size-full wp-image-44031\" \/><\/a><\/p>\n<p>You should be able to see Univariant Anomaly Detection in your Analytics UI. You can obtain the analytic service ID from the last part of its page URL in Analytics UI:<\/p>\n<pre>https:\/\/YOUR_PREFIX.predix-analytics-ui.run.aws-usw02-pr.ice.predix.io\/analytics\/view\/ANALYTIC_ID<\/pre>\n<p><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/ge-predix-anomaly-detection.png\"><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/ge-predix-anomaly-detection.png\" alt=\"ge-predix-anomaly-detection\" width=\"640\" class=\"aligncenter size-full wp-image-44032\" \/><\/a><\/p>\n<p>Test the service by providing some data at the Test tab. You can get sample input from the analytic service description section.<\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Code_for_the_Nodejs_application\"><\/span>Code for the Node.js application<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>You do not have to keep the front end and back end of your application separate; however, you  will need to run some Node.js code, as Analytics API does not support CORS. To perform HTTP requests from the back-end app, the <a href=\"https:\/\/github.com\/request\/request\" target=\"_blank\" rel=\"noopener noreferrer\">Request<\/a> library is used here.<\/p>\n<p>To make an analytics request from my Node.js application, I use the following code:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">let opts = {\r\n  method: 'POST',\r\n  uri: ANALYTICS_URI,\r\n  body: JSON.stringify(analyticsInput),\r\n  headers: {\r\n    'Authorization': `Bearer ${token.access_token}`,\r\n    'Predix-Zone-Id': ANALYTICS_ZONE,\r\n    'Content-Type': 'application\/json'\r\n  }\r\n}\r\nrequest(opts, function(err, response, body) {\r\n  if (!err) {\r\n    const respData = JSON.parse(body);\r\n    \/\/ respData contains analytics response here\r\n    \/\/ ...\r\n  }\r\n});\r\n<\/pre>\n<p>Here,<\/p>\n<ul>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">analyticsInput<\/code> is input data for the analytic service. For Univariate Anomaly Detection, it should be in the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">{\"Time\":[], \"Value\":[]}<\/code> format.<\/li>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">ANALYTICS_URI<\/code> is <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">https:\/\/predix-analytics-catalog-release.run.aws-usw02-pr.ice.predix.io\/api\/v1\/catalog\/analytics\/ANALYTIC_ID\/execution<\/code>.<\/li>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">ANALYTIC_ID<\/code> is obtained as described in Step 6.<\/li>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">ANALYTICS_ZONE<\/code> is your Analytics Catalog GUID.<\/li>\n<\/ul>\n<p>The token for a client\/user that has Analytics Catalog and Runtime permissions is used to authenticate the UAA request.<\/p>\n<p>Below is an example of how to obtain a client token:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">const AUTH_URL = `${UAA_BASE_URL}\/oauth\/token?grant_type=client_credentials&amp;client_id=${UAA_CLIENT}&amp;client_secret=${UAA_SECRET}`;\r\nrequest\r\n  .get(AUTH_URL, function(err, response, body) {\r\n    if (!err) {\r\n      const token = JSON.parse(body);\r\n      \/\/ token is obtained now\r\n      \/\/ ...\r\n    }\r\n  })\r\n  .auth(UAA_CLIENT, UAA_SECRET);<\/pre>\n<p>In this code,<\/p>\n<ul>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">UAA_BASE_URL<\/code> is your UAA instance scheme and hostname.<\/li>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">UAA_CLIENT<\/code> and <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">UAA_SECRET<\/code> are the ID and secret key of the UAA client.<\/li>\n<\/ul>\n<p>You can easily wrap these lines in Expess (for HTTP), Socket.IO (for WebSockets), or any other server similar to the following (Socket.IO is used in the example):<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">const Server = require('socket.io');\r\nconst server = new Server().attach(PORT);\r\nserver.on('connection', (socket) =&gt; {\r\n  socket.on('analyze', (inputData, callback) =&gt; {\r\n    \/\/ preprocess inputData\r\n    \/\/ UAA and Analytics requests {\r\n      callback({success: true, result: result});\r\n      \/\/ or callback({success: false, error: error});\r\n    \/\/ }\r\n  });\r\n});<\/pre>\n<p>All code of the sample application is available at my <a href=\"https:\/\/gist.github.com\/gekola\/2d8775d3a89dafeaa20d47a9f9896bc1\" target=\"_blank\" rel=\"noopener noreferrer\">GitHub Gist<\/a>. Environment variables (see 10 top lines) should be used for its proper work. The front-end part of the application looks like this:<\/p>\n<p><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/ge-predix-analytics-services-v1-1.jpg\"><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/ge-predix-analytics-services-v1-1.jpg\" alt=\"ge-predix-analytics-services-v1\" width=\"640\" class=\"aligncenter size-full wp-image-44033\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"What_to_do_next\"><\/span>What to do next<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>There are several possible ways to proceed with exploring Predix Analytics. You can start with browsing the <a href=\"https:\/\/www.predix.io\/catalog\/analytics\" target=\"_blank\" rel=\"noopener noreferrer\">Predix analytics catalog<\/a>, which is currently growing, for analytics services documentation and usage examples. In the <a href=\"https:\/\/www.predix.io\/services\/service.html?id=1187#swagger-ui-container\" target=\"_blank\" rel=\"noopener noreferrer\">Analytics Catalog API documentation<\/a>, you can also find endpoints for asynchronous analytics calls as well as for creating, maintaining, and structuring your own analytics.<\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Further_reading\"><\/span>Further reading<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/prototyping-a-greenhouse-management-system-with-node-red-and-predix-in-48-hours\/\">Prototyping a Greenhouse Management System with Node-RED and Predix in 48 Hours<\/a><\/li>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/introducing-a-one-click-button-for-deploying-to-ge-predix\/\">Introducing a One-Click Button for Deploying to GE Predix<\/a><\/li>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/an-iot-prototype-light-monitoring-with-nodered-components-in-predix\/\">IoT Prototype: Light Monitoring with NodeRED Components in Predix<\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<hr\/>\n<p><center><small>The tutorial was created by Nick Herman; edited and published by Victoria Fedzkovich and <a href=\"https:\/\/www.altoros.com\/blog\/author\/alex\/\">Alex Khizhniak<\/a>.<\/small><\/center><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Predix Analytics is a set of services that enable developers to use analytics solutions  implemented by data scientists from their own apps. In this post, we explain how to get started with the three services required for running Predix analytics: Analytics Catalog, Analytics Runtime, and Analytics User Interface. With [&#8230;]<\/p>\n","protected":false},"author":78,"featured_media":44033,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"content-type":"","footnotes":"","_links_to":"","_links_to_target":""},"categories":[214],"tags":[873,647],"class_list":["post-44028","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-cloud-native","tag-predix"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Set Up Predix Analytics Services and Use Them from a Node.js App | Altoros<\/title>\n<meta name=\"description\" content=\"Learn how to get started with the services required for running Predix Analytics, as well as how to make an analytics request from your app.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.altoros.com\/blog\/how-to-configure-predix-analytics-services-and-use-them-from-a-node-js-app\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Set Up Predix Analytics Services and Use Them from a Node.js App | Altoros\" \/>\n<meta property=\"og:description\" content=\"Predix Analytics is a set of services that enable developers to use analytics solutions implemented by data scientists from their own apps. In this post, we explain how to get started with the three services required for running Predix analytics: Analytics Catalog, Analytics Runtime, and Analytics User Interface. With [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.altoros.com\/blog\/how-to-configure-predix-analytics-services-and-use-them-from-a-node-js-app\/\" \/>\n<meta property=\"og:site_name\" content=\"Altoros\" \/>\n<meta property=\"article:published_time\" content=\"2016-09-14T17:17:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-06-08T01:45:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/ge-predix-analytics-services-v1-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1189\" \/>\n\t<meta property=\"og:image:height\" content=\"517\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Nick Herman\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nick Herman\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.altoros.com\/blog\/how-to-configure-predix-analytics-services-and-use-them-from-a-node-js-app\/\",\"url\":\"https:\/\/www.altoros.com\/blog\/how-to-configure-predix-analytics-services-and-use-them-from-a-node-js-app\/\",\"name\":\"How to Set Up Predix Analytics Services and Use Them from a Node.js App | Altoros\",\"isPartOf\":{\"@id\":\"https:\/\/www.altoros.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.altoros.com\/blog\/how-to-configure-predix-analytics-services-and-use-them-from-a-node-js-app\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.altoros.com\/blog\/how-to-configure-predix-analytics-services-and-use-them-from-a-node-js-app\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/ge-predix-analytics-services-v1-1.jpg\",\"datePublished\":\"2016-09-14T17:17:04+00:00\",\"dateModified\":\"2019-06-08T01:45:31+00:00\",\"author\":{\"@id\":\"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/f18d50b9edfbcdc995be899e3edb42ff\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.altoros.com\/blog\/how-to-configure-predix-analytics-services-and-use-them-from-a-node-js-app\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.altoros.com\/blog\/how-to-configure-predix-analytics-services-and-use-them-from-a-node-js-app\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.altoros.com\/blog\/how-to-configure-predix-analytics-services-and-use-them-from-a-node-js-app\/#primaryimage\",\"url\":\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/ge-predix-analytics-services-v1-1.jpg\",\"contentUrl\":\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/ge-predix-analytics-services-v1-1.jpg\",\"width\":1189,\"height\":517},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.altoros.com\/blog\/how-to-configure-predix-analytics-services-and-use-them-from-a-node-js-app\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.altoros.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Set Up Predix Analytics Services and Use Them from a Node.js App\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.altoros.com\/blog\/#website\",\"url\":\"https:\/\/www.altoros.com\/blog\/\",\"name\":\"Altoros\",\"description\":\"Insight\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.altoros.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/f18d50b9edfbcdc995be899e3edb42ff\",\"name\":\"Nick Herman\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/12\/328df9f-150x150.jpg\",\"contentUrl\":\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/12\/328df9f-150x150.jpg\",\"caption\":\"Nick Herman\"},\"description\":\"Nick Herman is a software engineer at Altoros. He specializes in web development using Ruby and JavaScript as his primary tools. Nick also has professional interests and expertise in many other areas related to software engineering, including programming languages and cloud technologies. You can find him on GitHub.\",\"url\":\"https:\/\/www.altoros.com\/blog\/author\/nick-herman\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Set Up Predix Analytics Services and Use Them from a Node.js App | Altoros","description":"Learn how to get started with the services required for running Predix Analytics, as well as how to make an analytics request from your app.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.altoros.com\/blog\/how-to-configure-predix-analytics-services-and-use-them-from-a-node-js-app\/","og_locale":"en_US","og_type":"article","og_title":"How to Set Up Predix Analytics Services and Use Them from a Node.js App | Altoros","og_description":"Predix Analytics is a set of services that enable developers to use analytics solutions implemented by data scientists from their own apps. In this post, we explain how to get started with the three services required for running Predix analytics: Analytics Catalog, Analytics Runtime, and Analytics User Interface. With [...]","og_url":"https:\/\/www.altoros.com\/blog\/how-to-configure-predix-analytics-services-and-use-them-from-a-node-js-app\/","og_site_name":"Altoros","article_published_time":"2016-09-14T17:17:04+00:00","article_modified_time":"2019-06-08T01:45:31+00:00","og_image":[{"width":1189,"height":517,"url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/ge-predix-analytics-services-v1-1.jpg","type":"image\/jpeg"}],"author":"Nick Herman","twitter_misc":{"Written by":"Nick Herman","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.altoros.com\/blog\/how-to-configure-predix-analytics-services-and-use-them-from-a-node-js-app\/","url":"https:\/\/www.altoros.com\/blog\/how-to-configure-predix-analytics-services-and-use-them-from-a-node-js-app\/","name":"How to Set Up Predix Analytics Services and Use Them from a Node.js App | Altoros","isPartOf":{"@id":"https:\/\/www.altoros.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.altoros.com\/blog\/how-to-configure-predix-analytics-services-and-use-them-from-a-node-js-app\/#primaryimage"},"image":{"@id":"https:\/\/www.altoros.com\/blog\/how-to-configure-predix-analytics-services-and-use-them-from-a-node-js-app\/#primaryimage"},"thumbnailUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/ge-predix-analytics-services-v1-1.jpg","datePublished":"2016-09-14T17:17:04+00:00","dateModified":"2019-06-08T01:45:31+00:00","author":{"@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/f18d50b9edfbcdc995be899e3edb42ff"},"breadcrumb":{"@id":"https:\/\/www.altoros.com\/blog\/how-to-configure-predix-analytics-services-and-use-them-from-a-node-js-app\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.altoros.com\/blog\/how-to-configure-predix-analytics-services-and-use-them-from-a-node-js-app\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.altoros.com\/blog\/how-to-configure-predix-analytics-services-and-use-them-from-a-node-js-app\/#primaryimage","url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/ge-predix-analytics-services-v1-1.jpg","contentUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/ge-predix-analytics-services-v1-1.jpg","width":1189,"height":517},{"@type":"BreadcrumbList","@id":"https:\/\/www.altoros.com\/blog\/how-to-configure-predix-analytics-services-and-use-them-from-a-node-js-app\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.altoros.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Set Up Predix Analytics Services and Use Them from a Node.js App"}]},{"@type":"WebSite","@id":"https:\/\/www.altoros.com\/blog\/#website","url":"https:\/\/www.altoros.com\/blog\/","name":"Altoros","description":"Insight","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.altoros.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/f18d50b9edfbcdc995be899e3edb42ff","name":"Nick Herman","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/12\/328df9f-150x150.jpg","contentUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/12\/328df9f-150x150.jpg","caption":"Nick Herman"},"description":"Nick Herman is a software engineer at Altoros. He specializes in web development using Ruby and JavaScript as his primary tools. Nick also has professional interests and expertise in many other areas related to software engineering, including programming languages and cloud technologies. You can find him on GitHub.","url":"https:\/\/www.altoros.com\/blog\/author\/nick-herman\/"}]}},"_links":{"self":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/44028","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/users\/78"}],"replies":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/comments?post=44028"}],"version-history":[{"count":9,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/44028\/revisions"}],"predecessor-version":[{"id":44045,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/44028\/revisions\/44045"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/media\/44033"}],"wp:attachment":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/media?parent=44028"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/categories?post=44028"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/tags?post=44028"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}