Message:

Subscribe rss
Blog categories
Spread the love

Once an object is stored in the Backendless data storage, any of its properties (except for the system ones) can be updated using the data update API. The API works the same way as the initial call for saving the object. To update a property value, simply modify it in the instance representing the saved object. The example below retrieves a saved object, modifies the “name” property and saves it back in the data store.

The data table and schema look as shown in the screenshots below:
person table - Feature 95: Updating data objects using API

Continue reading

Spread the love

Deleting an object in Backendless using the API is just as easy as creating or updating one. If an object has relations, they are broken up and the related objects are not deleted. The sample below retrieves the first object from a table and deletes it:

Person class – corresponds to the Person table show below:

person table - Feature 94: Deleting persistent objects using Data Service API

Continue reading

Spread the love

In my previous post I wrote how to load the first object from a data table using API. For the symmetry (and out of common sense) there is also API to load the last object from a data table. The last object is determined by the time when it is saved in the data storage. The most recently created (notice it is not the updated one) object is what the API returns.

Continue reading

Spread the love

There is an API for loading the very first object created in the table. The first object is determined by the value in the created column – Backendless picks the one with the smallest timestamp. The code below demonstrating loading an object from the Person table:
person table - Feature 92: Loading first object from a data table using API

Continue reading

Spread the love

As data objects are being saved or updated with the API requests some properties of the objects may not have a value assigned to them. It may be necessary that for those properties a default value is assigned. This is identical to how relational databases may have a default value for a column.

Configuring a default value for a column is very easy. You can set it when you declare a column or after a column is already created.

The popup window for creating a new column includes a field where the default value can be set:
default value field - Feature 91: Configuring default value for a data table column

Alternatively, when a column already exists in a table schema, there is a field which displays and lets you edit the default value:
default field existing column - Feature 91: Configuring default value for a data table columnOnce a default value is assigned to a column, it becomes immediately effective. When an object is saved or updated does not have a value for a property corresponding to the column, Backendless inserts the default value.

Spread the love

Backendless provides an easy to use API to introspect data tables. Given a table name, the API provides information about table columns, their names, data types, default values, etc. If a column represents a relationship, it is properly denoted as such in the provided information.

Consider the following data table. The table name is Person as it is indicated in the upper right corner:
table schema - Feature 90: Retrieving database/table schema using API

Continue reading
Spread the love

The logout API is a logical counterpart for the User Login API. The logout step is not required for most apps – user session will expire automatically. However, some apps provide the functionality, especially those with a special multiple login policy. The logout API is very simple – a single line of code terminates the current session:

Continue reading

Spread the love

In my previous post I described how to adjust object’s access control list (ACL) using Backendless console. As I mentioned, in addition to console, object’s permissions can be controlled using API. In fact, for any persisted object, Backendless supports the following capabilities:

granting/rejecting permission to execute find/save/update/delete operation on an object to:

  • a user
  • a role
  • all users
  • all roles

The general API usage pattern is:


Where <OPERATION> can be FIND , UPDATE , REMOVE. There are many more methods available on the <OPERATION> class supporting all the combinations listed above.
Continue reading
Spread the love

Every data objects saved in Backendless has its own access control list (ACL). Object’s ACL includes permissions for users and roles for all Data service operations. Using ACL an application may be configured to allow users (and/or roles they belong to) to be able to execute Data Service API calls. For example, in a shopping app you may have the Customer and SupportRep roles. Users in the Customer role may have the permission to create and update objects in the Incident table, but may not delete them. A user in the SupportRep role may have the permission to delete those objects.

Object ACL configuration can be done via API or Backendless console. This post review the latter. To get to the ACL screen for a specific object:

  1. Login to Backendless console, select your app and click the Data icon.
  2. Select the table to get to the data object you need to modify the ACL of.
  3. Click the “key” icon in the ACL column:
    object acl icon - Feature 87: Manage data object's access control list (ACL) in console
  4. Select Users Permissions or Roles Permissions In the ACL screen.
  5. Adjust the permissions for the roles and/or users as you see fit. A permission can be adjusted by clicking an icon at the intersection of a row representing user or role and a column which represents an operation. For example the following screenshot restricts access to an object for any not-authenticated user and does not allow users in the Customer role to delete the object:
    sample acl - Feature 87: Manage data object's access control list (ACL) in console
Spread the love

Previously I wrote about how to store and retrieve objects to and from server-side in-memory cache. Quite often when working with cache, it is required to check if an object already exists in cache. Backendless provides an API for that function. The code below checks if an object exists in cache, if not, it places it in there and then runs the existence check again:

Continue reading
Posted in Feature-a-Day