Skip to content

Working with the Service

The instructions below apply to both modes of service execution (debug and deployment).

  1. Once the service is in the debug mode, Backendless generates the service's REST APIs and the native SDKs. You can see the service and its operations on the Business Logic > API Services screen. For the service reviewed in this guide you will see the following screen when the service is running in the debug mode:
    js-service-in-debug-v4.zoom70
  2. Backendless Console lists all available service operations/methods. To see the details of an operation and to invoke it, click the operation name. For example, click the addItem method. When invoking the method from Backendless Console, the request body must be a JSON object which combines the shopping cart name and the item being added to the cart:
    {
      "cartName": "string",
      "item": {
        "objectId": "string",
        "product": "string",
        "price": 0,
        "quantity": 0
      }
    }
    
    . However, when the operation is invoked from a native client (Android, iOS, JS), method arguments will be represented by objects from the native programming environment. In other words, you do not need to convert everything to JSON when working with API Services, unless you use service's REST API.
  3. To invoke the addItem method from Backendless console, you will need to provide argument values. Click the model schema area to copy its contents to the to the argument value area:
    click-to-copy-schema
  4. Modify the argument value as shown below. The objectId element should be removed, it is not needed for this operation.

    {
      "cartName": "mycart",
      "item": {
        "product": "Hoverboard",
        "price": 499,
        "quantity": 1
      }
    }
    

  5. Click INVOKE to make an invocation of the method:
    js-invocation-result-v4

  6. Notice you can get a complete cURL request which executes the same REST API request by switching to the CODE section:
    curl-request-api-service
  7. To see the contents of the shopping cart, click the getItems method. Enter the same name for the shopping cart that was used in the addItem invocation ("mycart") and click INVOKE again:
    get-items-invoke-v4.zoom80