For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.
Register web applications from the MobileFirst Platform CLI
We can use the IBM MobileFirstâ„¢ Platform Command Line Interface (CLI) to register your web application to an instance MobileFirst Server.
Before you begin
- Install the IBM MobileFirst Platform Command Line Interface (CLI). For more information, see Install the MobileFirst Platform CLI.
- Set up a running instance of MobileFirst Server. The server can run locally or it can be a remote server, but you must be able to connect to the server from your local development machine. For more information, see Set up the MobileFirst Development Server, Install the IBM MobileFirst Platform Foundation Developer Kit, or Install IBM MobileFirst Platform Server.
Procedure
From the command line, run one of the following MobileFirst Platform CLI command variations to register your application to an instance of MobileFirst Server:
- To register the application to the default MobileFirst Server, run the following command, where <applicationId> is a unique identifier for our application:
mfpdev app register <applicationId>For example, the following command registers an application with the application ID com.example.myapplication to the default MobileFirst Server:
mfpdev app register com.example.myapplication
Note: If you did not previously set a default server, and an instance of MobileFirst Server is running on your local system, the command registers the application to the running local server and this server becomes the default MobileFirst Server.
To register your application to a server instance other than the default MobileFirst Server, follow these steps:
- Run the mfpdev server add command to create your preferred server profile. For example:
mfpdev server add Server1 -url https://company.mobile.com:9080 -login admin -password secretPassword!For more information about the mfpdev server add command, run mfpdev help server add.
- Run the following command to register your application to the server that you defined in the previous step, where <applicationId> is a unique identifier for our application and <server> is the name of the server profile:
mfpdev app register <applicationId> <server>
Note: The application ID that is provided during registration must be identical to the value of the applicationId initialization option that is set when initializing the web SDK. For more information, see Initializing the MobileFirst SDK. For example, the following command registers an application with the application ID com.example.myapplication to a Server1 MobileFirst Server:
mfpdev app register com.example.myapplication Server1For more information about the mfpdev app register command, including optional parameters, run mfpdev help app register.
Results
When the application is successfully registered to the target server, we can select it from the Applications section in the navigation sidebar of the IBM MobileFirst Platform Operations Console (under Versions or Web). The main application page displays different server-side configuration options for your application.
In the application Configuration Files console tab, we can see the content of the application's descriptor and runtime configuration files. The value of the applicationId in the application descriptor is the application ID that you specified when you registered the application.
Note: We cannot have multiple versions of the same web application. Therefore, the applicationKey object of the application descriptor does not contain a version property.
What to do next
We can proceed with other development tasks that depend on MobileFirst Server, such as making server-side configurations, testing the application's security features, and managing the application from the MobileFirst Operations Console.
Make sure to initialize the SDK from your application before calling any SDK APIs other than the initialization method. For more information, see Initializing the MobileFirst SDK.
Parent topic: Register web applications to MobileFirst Server