6 Backend Lifecycle

You created a backend and now it's time to use it. Remember that after you publish it, it becomes immutable, that is, you can't modify it.

If you want to make a change to a published backend, you create a new version of it. Because backends are tightly integrated with custom code, APIs, and other objects in AMCe, you'll need to consider the relationships and dependencies on those objects.

If you want a general introduction to how artifacts interrelate in the overall lifecycle before exploring the lifecycle of backends, see Understanding Lifecycles.

Backend Lifecycle States

Relationships with other artifacts create dependencies. For example, your backend might depend on other artifacts, such as collections or APIs. When any artifact changes state, all dependent artifacts must also change states. AMCe keeps track of any dependencies for you.

Backends have the following activation states that determine whether they can be updated, deleted, or whether or not a new version can be created:

  • Active: Denotes the version of the backend is valid and active.

  • Quiesce: Denotes the version of the backend has become quiet, that is, it no longer supports new requests, and after all currently running requests are completed, it’s changed to Inactive. This is a transitional state.

  • Inactive: Denotes the version of the backend that’s present but not in an active state (that is, not usable).

    If a user tries to access an API through an inactive backend, a 404 code is returned.

  • Deleted: Denotes the version of the backend that’s been moved to the trash and susceptible to a hard delete (actually removed from the repository).

    Note:

    Only mobile cloud administrators can purge (that is, permanently delete) an item in the trash.

Publishing a Backend

Follow these steps to publish a backend. When a backend is published, all dependencies that aren’t yet published must also be published.

  1. Click open the side menu icon and select Mobile Apps > Backends from the side menu.
  2. Select the backend that you want to publish.
  3. Click Publish.
  4. In the Confirm Publish Backend dialog, click Check Dependencies to reveal whether or not the backend has dependencies and what those dependencies are so you'll know how to proceed:
    • If you don't have dependencies, a confirmation dialog is displayed. Click Publish.

    • If any dependencies are found in the trash, they’re listed. Cancel the publish operation, restore the dependent items from the trash, and restart the process.

    • If there are dependencies in the Draft state, they’re listed in the confirmation dialog. You have the option to publish all the dependent artifacts along with your mobile backend. Click Publish All.

Updating the Version Number of a Backend

If you created a new version of a backend using the New Version dialog, you can update its version number if it’s still in a Draft state. This is useful if you need to designate a different version number for it before you publish it or you’ve made a change to the configuration and you need a new version designation.

  1. Click open the side menu icon and select Mobile Apps > Backends from the side menu.
  2. Select the backend you want to update from the list.
  3. In the right section, select More > Update Version Number.
  4. Enter a version number of the format Major.minor.

    The previous version of the backend is displayed next to the field. You'll get a message letting you know if you've entered an existing version number.

  5. (Optional) Add a brief description that states what distinguishes this version from the previous one.
  6. Click Update.

    A confirmation message is displayed. A draft of the new version is added to the list of backends.

Creating a New Version of a Backend

When you create a new backend, the version is automatically set to 1.0. As long as the backend is in a Draft state, you can change any aspect of it. As you develop your backend, you can change the version's major and minor version values as you see fit.

You can use a published backend as a root for a new version.

  1. Click open the side menu icon and select Mobile Apps > Backends from the side menu.
  2. Select the published backend.
  3. In the right section, select More > New Version.

The new version is created in a Draft state.

Note:

If the backend is associated with an API, you can’t associate another version of that API with the backend, regardless of whether the backend is in a Draft or Published state. You must create a new version of the backend and associate it with the other API version.

Moving a Backend to the Trash

Remove a backend in a by moving it to the trash. A backend in the trash is no longer listed but it’s still viable, that is, it could continue to serve requests. If the backend is needed later on, you can restore it from the trash.

Note:

If a backend is referenced by a client, you can’t move that backend to the trash. If the backend is in Draft state, you can disassociate it from the client by opening the backend, selecting Clients in the navbar and clicking Delete (X) for that client. Then you can move the backend to the trash.

An alternative to removing a backend is to deactivate it, in which case it no longer services requests. See Deactivating a Mobile Backend for information.

  1. Click open the side menu icon and select Mobile Apps > Backends from the side menu.
  2. Select the backend.
  3. In the right section, select More > Move to Trash.
  4. Click Trash in the confirmation dialog if there are no dependency issues.

    If you think you or someone else might restore it later on, enter a brief comment about why you're putting this item in the trash.

To find out how dependencies can affect moving an artifact to the trash, see Moving an Artifact to the Trash. To restore a backend that’s in the trash, see Restoring a Backend.

If you move a backend to the trash that has been redirected to another backend, the redirection still occurs.

Deactivating a Backend

If you want to stop access to a backend without deleting it, you can do so by deactivating it. A deactivated backend can’t service any more requests. Deactivation is most common for backends in a Published state that have been replaced by newer versions and are no longer needed.
  1. Click open the side menu icon and select Mobile Apps > Backends from the side menu.
  2. Select your backend and click More > Manage Activation .
  3. In the dialog that appears, select Inactive from the drop-down list to deactivate the backend, or Active to reactivate an inactive backend.
  4. Click Save.

If you deactivate a backend that has been redirected to another backend, the redirection still occurs.

Restoring a Backend

  1. Click open the side menu icon and select Mobile Apps > Backends from the side menu.
  2. Click Trash (open the trash list icon).
  3. In the list of items in the trash, click open the trash drawer icon by the backend you want and select Restore from Trash.
  4. Click Restore in the confirmation dialog if there are no conflicts.
Restoring an artifact can cause conflicts if a duplicate exists. To find out more about restoring an artifact when a duplicate artifact exists, see Restoring an Artifact.

Managing a Backend

When at least one backend exists, you’ll be taken to the Backends page every time you click open the side menu icon and select Mobile Apps > Backends from the side menu. On the left side of the page, you see a list of all the backends, their version numbers, and their Draft or Published state (mobile backends in Trash aren’t displayed).

On the upper right side of the Backends page, you can open, test, publish, see runtime data about your backend, and get authentication and application key values:

  • Click Trash open the trash list icon to see which backends are in the trash.

  • Click Open to see details about the selected backend.

  • Click Publish to change the state of the backend from Draft to Published.

  • Click More to create a new version, update an existing version, change the activation state, or move the backend to the trash.

  • Look in the Metrics section to see the number of calls to the API associated with the backend and the average response time.

  • Expand Keys to obtain the values for the backend ID, anonymous key (click Show), and the application key for the associated client. Click Manage to configure the associated clients or create a new client.

On the lower right side of the page, you view data about the selected backend:

  • Expand Dependencies to see the artifacts the mobile backend is dependent on.

  • Expand Used By to see any associated artifacts that aren’t dependencies.

  • Expand History to quickly see the latest activity for the selected backend.