For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.
Transfer server-side artifacts by using the REST API
Whatever your role, we can export applications, adapters, and resources for back-up or reuse purposes by using the MobileFirst Server administration service. As an administrator or deployer, we can also deploy an export archive to a different server. No access to the application code is required, but the client app must be built for the target server.
Before you begin
- Build the client app for our target server. For more information, see Build an application for a test or production environment.
The export API retrieves the selected artifacts for a runtime as a .zip archive. Use the deployment API to reuse archived content.
Important: Carefully consider your use case:
- The export file includes the application authenticity data. That data is specific to the build of a mobile app. The mobile app includes the URL of the server and its runtime name. Therefore, if we want to use another server or another runtime, we must rebuild the app. Transferring only the exported app files would not work.
- Some artifacts might vary from one server to another. Push credentials are different depending on whether you work in a development or production environment.
- The application runtime configuration (that contains the active/disabled state and the log profiles) can be transferred in some cases but not all.
- Transfer web resources might not make sense in some cases, for example if you rebuild the app to use a new server.
Procedure
- To export all resources, or a selected subset of resources, for one adapter or for all adapters, use the Export adapter resources (GET) or Export adapters (GET) API.
- To export all the resources under a specific application environment (such as Android or iOS), that is all the versions and all the resources for the version for that environment, use the Export application environment (GET) API.
- To export all the resources for a specific version of an application (for example, version 1.0 or 2.0 of an Android application), use the Export application environment resources (GET) API.
- To export a specific application or all applications for a runtime, use the Export applications (GET) or Export application resources (GET) API.
Note: Credentials for push notification are not exported among the application resources.
- To export the adapter content, descriptor, license configuration, content, user configuration, keystore, and web resources of an application, use the Export resources (GET) API.
- To export all or selected resources for a runtime, use the Export runtime resources (GET) API. For example, we can use this general curl command to retrieve all resources as a .zip file.
curl -X GET -u admin:admin -o exported.zip "http://localhost:9080/worklightadmin/management-apis/2.0/runtimes/mfp/export/all"
To deploy an archive that contains such web application resources as adapter, application, license configuration, keystore, web resource, use the Deploy (POST) API. For example, we can use this curl command to deploy an existing .zip file that contains artifacts. curl -X POST -u admin:admin -F file=@/Users/john_doe/Downloads/export_applications_adf_ios_2.zip "http://localhost:9080/mfpadmin/management-apis/2.0/runtimes/mfp/deploy/multi"
To deploy application authenticity data, use the Deploy Application Authenticity Data (POST) API. To deploy the web resources of an application, use the Deploy a web resource (POST) API.
Results
If you deploy an export archive to the same runtime, the application or version is not necessarily restored as it was exported. That is, the redeployment does not remove subsequent modifications. Rather, if some application resources are modified between export time and redeployment, only the resources that are included in the exported archive are redeployed in their original state. For example, if you export an application with no authenticity data, then you upload authenticity data, and then you import the initial archive, the authenticity data is not erased.
Parent topic: Transfer server-side artifacts to a test or production server