Message:

Data Service (54 posts)

Create and Save New Data Objects Using REST Console

Today we are going to demonstrate how to create and save new data objects using the very convenient REST Console in Backendless. We will start by opening our Backendless application and navigating to the REST Console. To do this, go to the Backendless Console and select the Data tab.

Continue reading
Posted in Data Service, REST

Create Table Schema in One Query

Today, we are going to look at a useful and interesting, but hidden, feature of Backendless. Some features like these are not covered in the documentation, so they are not recommended for use in production because they are not supported and there is no guarantee that their implementation will not change. Still, these features can be very helpful during initial development. Using these features is not for the faint of heart!

Continue reading

In this edition of Backendless Spotlight, we cross the Atlantic to take a closer look at TopAnimals, an educational sticker-collecting app out of Italy. With TopAnimals, users can collect animal stickers of varying rarities that offer descriptions, curiosities, and habitat information. TopAnimals is brand new to the market, launching on iTunes just last week.

TopAnimals Backendless Spotlight

Editor’s Note: If you or someone you know have an app using Backendless for its backend and would like to be considered for a future Backendless Spotlight, we want to hear from you! Send us an email with a link to the app or website and a description of how Backendless has helped them be successful.

Continue reading

The mission of Backendless is to simplify the app development process. We strive to empower software developers to build apps without spending any time on monotonous and repetitive coding tasks. In most cases, a developer working with Backendless should not even think about the server-side and focus entirely on the user experience. We have seen thousands of apps getting built the standard way – that is using code. Whether it is Java, Objective-C, Swift, JS or C#, developers still write, compile, debug and profile code when building the client-side of their mobile apps. Can the process be simpler? Wouldn’t it be awesome if you could build a mobile app without knowing a programming language? Or better yet, how cool would it be if you could get all the boring and annoying parts of creating a skeleton of a mobile app using an easy-to-use and a powerful UI and after that jump into the code to handle more advanced tasks at that level? Yes, that would be awesome. What’s even more awesome is that such a solution is available now and it integrates nicely with Backendless. Welcome to Dropsource – a platform for developing mobile apps without any coding. And if you want to get the code, it will generate a complete Android Studio or Xcode project for you.

As the saying goes, it is better to see something once than to hear about it a thousand times. The video below starts with a demo of a mobile (iOS) client-server app built with Dropsource. This is a classic ToDo app which uses the Backendless database to store data and demonstrates a complete set of the database operations (Create, Retrieve, Update, Delete – CRUD). Right after the demo in the video, there is a detailed walkthrough showing how to build the app. If you follow the instructions, you will be developing the same app and learn how to use Dropsource and integrate it with Backendless. Enjoy!

All available APIs for creating, updating and deleting objects in the Backendless database operate on single objects. It means when you need to store multiple objects in the database, each object requires a separate API call. This increases the number of API calls your app makes. While it is great for us (hey, our billing is based on the API calls), it is not that great for your app as it results in longer processing times and substandard user experience. Starting today, with the release of Backendless version 4.5.0 we’re introducing the new APIs which will allow you to create, update or delete multiple objects with a single API call.

Bulk Create

Saving multiple new objects in the database is now as simple as passing an array of objects to the server. The server responds with a collection of objectId values (which, for example, can be used in the createRelation  API). The bulk create API is supported in all SDKs as well as the REST interface.

Bulk Update

To update objects in the database, the API accepts a condition (where clause) which identifies a group of objects. In addition to the condition, the client must also provide an object containing the changes which should be applies to the selected objects.

Bulk Delete

Similar to “Bulk Update”, this API receives a condition which identifies a group of objects to be deleted.

All of the APIs can be extended using custom business logic’s before/after events.

You can find the documentation for these APIs in the developer guides:

Performing a calculation on a group of database objects may be a complex task. For example, to calculate the sum of all orders for a customer would require retrieving all customer’s orders, iterating over them to calculate the mathematical sum of all amounts. This was yesterday! As of Backendless 4.4.0, you can use aggregate functions to calculate the average, sum, maximum and minimum values for a collection of objects without retrieving them from the server. Additionally, the system supports calculating object count for all records in the database or a record subset.

To use an aggregate function, simply request a property in a data retrieval request in the following format (the example below is for calculating the sum for the orderAmount  column):

The returned object includes the sum  property with the calculated value:

The name of the property can be modified by assigning an alias (using %20  to replace the spaces in the URL):

The result contains a value for the property named after the alias:

Grouping Results

Results can be grouped by a column. The column could be either in the same table or a related one. For example, the following request retrieves the sum of all orders grouped by related country:

Unlike the response above, the result for this query includes a collection of objects, each containing the sum for a related country:

It is also possible to apply a filter on the grouped values. This can be done using the having  clause. For example, the request below retrieves only the groups of countries where the total order amount is greater than 10000:

For more information about aggregate functions see the Backendless API documentation:

We conducted a webinar titled “Backendless Core Concepts” for ex-Parses last week. A recording of the webinar is now available. The video should be helpful not only if you’re coming from Parse, but for anyone who is starting their journey with Backendless. The webinar reviewed the concepts of Backendless User and Data services. Specifically, we focused on:

  • user properties
  • setting up user relations
  • registering a user
  • registering a user with custom properties
  • configuring a data model
  • code-driven schema creation
  • data relations
  • a brief overview of Cloud Code

In my previous post I described how data tables in Backendless map to the client-side classes whose instances contain persisted data objects. However, there are scenarios when the default mapping is undesirable. In that case, Backendless client libraries provide an API to override the mapping. For example, consider the following data table (Restaurant):
restaurant-table-schema

Continue reading

It may already be obvious if you had followed this blog series. Data tables created in Backendless and the client-side classes you write or obtain through Backendless code generation, have a direct correlation. By default a table and the corresponding client-side class have the same name. This is true for all Backendless SDKs which support object-oriented data access. This includes Android, Java, Objective-C, Swift, JavaScript, ActionScript and .NET. For example, consider the following data table:
restaurant-table-schema

Continue reading

Previously I described how to save data objects using REST Console. The same interface allows to save objects with related data – it is strictly a matter of formatting the request body. Consider the following two data table schemas:

Restaurant table schema:
restaurant-table-schema

Continue reading

Find us in facebook