Skip to content

What is a Service?

An API Service is a logical unit with one or more API endpoints. These endpoints are available in two formats:

  • via HTTP REST endpoint URI
  • via native SDK

Backendless automatically generates both types of endpoints for the deployed code. Access to an API Service is guarded by Backendless security, where individual service operations can be allowed or denied for application's users and roles. Additionally, Backendless gathers analytics for the service' API usage. The diagram below visually demonstrates these concepts:


The workflow for developing and deploying a hosted service is very straight-forward:

  1. Developer writes the service code;
  2. Developer debugs and tests the service code using Backedless CodeRunner;
  3. Developer uses Backendless CodeRunner or Backendless Console to deploy the code;
  4. Backendless processes the deployed code and creates an API Service;
  5. Backendless automatically generates native client-side SDKs as well as REST API routes for the service operations.

Code deployed to Backendless automatically becomes an API service when it follows a set of simple rules documented below. For the code to be an API Service, it means it  is accessible through the standard networking mechanisms, such as generated REST API as well as native SDKs created by Backendless.

Developer must observe the following rules when creating service code:

  • The service class must be declared public.
  • The service class must implement the com.backendless.servercode.IBackendlessService interface. It is a marker interface - it does not declare any methods.
  • The service class must have the default, public, no-argument constructor.
  • The service class must not be declared abstract.
  • There must be at least one public method in the service class (API Engine generates API routes based on the available public methods).
  • Any classes referenced by the service must be public, cannot be inner or anonymous and must have public, default no-argument constructor.

Consider the following sample service:

package com.mbaas;

import com.backendless.Backendless;
import com.backendless.servercode.IBackendlessService;

public class SampleService implements IBackendlessService
  public WeatherInfo getWeather( String zipCode )
    return new WeatherInfo( zipCode );

  public long getServerTime()
    return System.currentTimeMillis();

  public void sendEmail( String to, String subject, String body )
    Backendless.Messaging.sendHTMLEmail( subject, body, to );


There are several considerations and limitations for the runtime behavior of the invoked methods:

  • The code cannot use native File IO, instead, it must be the Backendless File Service API to work with the application's file storage.
  • The execution time of a service method is limited for each Backendless Cloud pricing plan. Check the pricing table on the website for details. This limitation does not exist in the Backendless Pro and Managed Backendless versions of the service.