Predix SDK for Hybrid
Total Page:16
File Type:pdf, Size:1020Kb
Predix SDK for Hybrid © 2020 General Electric Company Contents Predix SDK for Hybrid 1 About Predix SDK for Hybrid 1 Predix Mobile Command Line Interface 3 Predix Mobile Command-Line Interface (pm CLI) Commands 3 Installing the pm Command-Line Interface 3 pm api 3 pm apps 4 pm auth 5 pm channels 6 pm conflicts 7 pm data-delete 7 pm define 7 pm grant 8 pm import 8 pm invalidate-session 8 pm logs 8 pm oauth-token 9 pm publish 9 pm revoke 10 pm routes 10 pm version 11 pm webapps 13 pm workspace 13 Predix Mobile Client Core Services Framework 14 Predix Mobile Client Core Services Framework 14 Predix Mobile Authentication Service 14 Predix Mobile Boot Service 14 Predix Mobile Command Service 15 Predix Mobile Connectivity Service 15 Predix Mobile Data Access Services 15 Predix Mobile Logging Service 16 Predix Mobile OpenURL Service 17 ii Predix SDK for Hybrid Predix Mobile Notify Service 17 Predix Mobile User Information Service 18 Predix Mobile User Settings Service 19 Predix Mobile Version Service 19 Predix Mobile Window Service 21 Predix Mobile Client Advanced Services 21 Configuration Preferences and Properties 23 Configuration Preferences and Properties 23 Troubleshooting Predix Sync and SDK for Hybrid 25 Troubleshooting UAA Service 25 UAA User Account not Found 28 User Token Invalid - Expired 28 Authentication Not Valid when Creating User 29 Running pm CLI in Debug Mode 29 Developing Apps for Apple Devices 31 Developing Apps for Apple Devices 31 Build an App with Native iOS Components 31 Submitting a Predix Mobile Container to the Apple App Store 31 Release Notes 33 Release Notes 33 iii Copyright GE Digital © 2020 General Electric Company. GE, the GE Monogram, and Predix are either registered trademarks or trademarks of General Electric Company. All other trademarks are the property of their respective owners. This document may contain Confidential/Proprietary information of General Electric Company and/or its suppliers or vendors. Distribution or reproduction is prohibited without permission. THIS DOCUMENT AND ITS CONTENTS ARE PROVIDED "AS IS," WITH NO REPRESENTATION OR WARRANTIES OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF DESIGN, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. ALL OTHER LIABILITY ARISING FROM RELIANCE UPON ANY INFORMATION CONTAINED HEREIN IS EXPRESSLY DISCLAIMED. Access to and use of the software described in this document is conditioned on acceptance of the End User License Agreement and compliance with its terms. iv © 2020 General Electric Company Predix SDK for Hybrid About Predix SDK for Hybrid The Predix SDK for Hybrid includes Reference App Containers for various platforms, the pm command-line tool, and several services that help you to extend the container. A Mobile Reference App Container is a native application that includes the Predix Mobile Client Core Services framework that enables you to load, display, and run your Predix Mobile applications. • For Android, you build the Predix Mobile Reference App Container for Android. • For iOS, you build the Predix Mobile Reference App Container for iOS. • For MacOS, you build the App Container for MacOS. The Predix Mobile (pm) command-line tool allows you to manage your Predix Mobile apps and your mobile back-end processes. The pm CLI commands depend on the Cloud Foundry and UAAC command-line tools, so make sure they are installed and properly configured prior to installing the pm tool. See Predix Mobile Command-Line Interface (pm CLI) Commands on page 3. The SDK for Hybrid provides several services as REST APIs to provide functionality to hybrid or native Mobile applications. The Client SDK consuming application (Predix Mobile App Container) can interact with these local services following this general URL structure: http://pmapi//<parameters>. The Predix Mobile Reference App Container interprets URL requests and delegates them to the services in the Predix Mobile Client Core Services framework , which respond with a JSON payload describing the result of the call. See Predix Mobile Client Core Services Framework on page 14. © 2020 General Electric Company 1 Figure 1: Predix Mobile Reference App Container and Mobile Service See also https://github.com/PredixDev/PredixMobileSDK. 2 © 2020 General Electric Company Predix Mobile Command Line Interface Predix Mobile Command-Line Interface (pm CLI) Commands Predix Mobile command-line interface (pm CLI) is a set of command line utility tools Use the pm CLI to manage your Predix Mobile apps and Mobile Service processes. The pm CLI includes a set of commands that are invoked through the pm command-line interface. The pm CLI commands use the following syntax: pm [options] [command] Installing the pm Command-Line Interface Use the pm CLI to manage Predix mobile users, roles, Predix mobile applications, and their web app dependencies. Before You Begin The pm CLI depends on both the Cloud Foundry (CF) and UAAC command-line tools. • Install Cloud Foundry's cf CLI. See https://github.com/cloudfoundry/cli#downloads. • Install Cloud Foundry's cf-uaac CLI. See https://github.com/cloudfoundry/cf-uaac and Troubleshooting UAA Service on page 25. About This Task Install the pm CLI: Procedure • Download the pm .zip file from https://github.com/PredixDev/predix-mobile-cli/releases/latest. ◦ For iOS and MacOS platforms, unpack the pm-v1.x.x-Mac.zip file in your workspace. ◦ On the Windows platform, unpack the pm-v1.x.x-win.zip file in your workspace. pm api Use this command to display the current target, set the target, or change the target Predix Mobile Client API Gateway service. In a typical application-development workflow, you begin by targeting the Predix Mobile Client API Gateway service. The Client API Gateway and the UAA Service work together to ensure that all clients that access the Predix Mobile service possess a valid authentication token. In this example, the command returns an empty target. $ pm api info: API> © 2020 General Electric Company 3 You can pass the URL of your Predix Mobile API Gateway host to the command to set or change the target. For example: $ pm api https://015272.grc-apps.svc.ice.ge.com info: API> https://015272.grc-apps.svc.ice.ge.com Run each pm command against the targeted Client API Gateway. If you do not set a target, any pm command fails with an error. pm apps Use this command to list each Predix Mobile app defined in your Predix Mobile service. $ pm apps ┌──────────┬──────────────────────────────┬──────────┬───────────────── ───────────────────────┐ │ Type │ Name │ Version │ Channel │ ├──────────┼──────────────────────────────┼──────────┼───────────────── ───────────────────────┤ │ PM-APP │ FunctionalTestSuite │ 1.0.0 │ app- FunctionalTestSuite_1_0_0 │ │ │ │ │ │ ├──────────┼──────────────────────────────┼──────────┼───────────────── ───────────────────────┤ │ PM-APP │ ionic1 │ 1.0 │ app- ionic1_1_0 │ │ │ │ │ │ ├──────────┼──────────────────────────────┼──────────┼───────────────── ───────────────────────┤ │ PM-APP │ Sample1 │ 1.0 │ app- Sample1_1_0 │ │ │ │ │ roler- user │ │ │ │ │ role- user │ │ │ │ │ │ └──────────┴──────────────────────────────┴──────────┴───────────────── ───────────────────────┘ Include the -w parameter to list web apps deployed with your defined Predix Mobile apps. For example: $ pm apps -w ┌──────────┬──────────────────────────────┬──────────┬───────────────── ───────────────────────┐ │ Type │ Name │ Version │ Channel │ ├──────────┼──────────────────────────────┼──────────┼───────────────── ───────────────────────┤ │ PM-APP │ FunctionalTestSuite │ 1.0.0 │ app- FunctionalTestSuite_1_0_0 │ │ │ │ │ │ ├──────────┼──────────────────────────────┼──────────┼───────────────── 4 © 2020 General Electric Company ───────────────────────┤ │ WEB-APP │ e2e-app-test │ 0.0.1 │ webapp-e2e-app- test_0_0_1 │ ├──────────┼──────────────────────────────┼──────────┼───────────────── ───────────────────────┤ │ │ │ │ │ ├──────────┼──────────────────────────────┼──────────┼───────────────── ───────────────────────┤ │ PM-APP │ ionic1 │ 1.0 │ app- ionic1_1_0 │ │ │ │ │ │ ├──────────┼──────────────────────────────┼──────────┼───────────────── ───────────────────────┤ │ WEB-APP │ ionic_sidemenu │ 0.0.1 │ webapp- ionic_sidemenu_0_0_1 │ ├──────────┼──────────────────────────────┼──────────┼───────────────── ───────────────────────┤ │ │ │ │ │ ├──────────┼──────────────────────────────┼──────────┼───────────────── ───────────────────────┤ │ PM-APP │ Sample1 │ 1.0 │ app- Sample1_1_0 │ │ │ │ │ roler- user │ │ │ │ │ role- user │ │ │ │ │ │ ├──────────┼──────────────────────────────┼──────────┼───────────────── ───────────────────────┤ │ WEB-APP │ sample-webapp │ 0.0.1 │ webapp-sample- webapp_0_0_1 │ ├──────────┼──────────────────────────────┼──────────┼───────────────── ───────────────────────┤ │ │ │ │ │ └──────────┴──────────────────────────────┴──────────┴───────────────── ───────────────────────┘ pm auth Use this command to authenticate a user against the currently targeted Predix Mobile API Gateway host. Use the user name and password for an account that has been set up with UAA with the following command: $ pm auth [email protected] password: info: API endpoint: https://d7dfcca0- c774-4f24-80b3-6c0c20106c8b.predix-uaa-staging.grc-apps.svc.ice.ge.com info: Authenticating... OK © 2020 General Electric Company 5 pm channels Use this command to manage the readable channels assigned to each user. For more information about channels, see . the Couchbase documentation. Options Option Description -c, --channel [channel_name...] Specify one or more channels.