Get started

Reading and Writing data

10min

This guide will teach you how to create, read, update, and delete data objects on Back4app using the Parse SDK. Data storage on Back4app revolves around the Parse.Object class, which allows you to store key-value pairs of JSON-compatible data, providing flexibility and simplicity in data management.

Objectives

  • Understand how to perform data manipulation (CRUD) on Back4app using Parse SDK.
  • Learn how to set up and use the Parse SDK across different platforms.

Prerequisites

App on Back4app: You need an app created on Back4app.

Parse SDK Installation:

1 - Creating Parse Objects

To store data in Back4app, you need to create a ParseObject associated with a specific class. For example, in a soccer-related application, you could create a SoccerPlayers class to store data about players.

JS
Flutter
Android
iOS
PHP
.NET
REST API


After running this code, you can verify the new object in the Database section of the Back4app Dashboard. Note that you don’t need to manually create the SoccerPlayers class; it will be created automatically the first time an object is saved.

Document image


2 - Reading Parse Objects

To retrieve saved data, you can use a ParseQuery. For instance, to fetch the player created above by its objectId:

JS
Flutter
Android
iOS
PHP
.NET
REST API


In addition to objectId, you can also query by other parameters (e.g., yearOfBirth, playerName), offering greater flexibility in data searches.

3 - Updating Parse Objects

To update an object, retrieve it first, set new values for the desired attributes, and call the save() method.

JS
Flutter
Android
iOS
PHP
.NET
REST API


4 - Deleting Parse Objects

To delete an object, retrieve it by objectId and use the destroy() method.

JS
Flutter
Android
iOS
PHP
.NET
REST API


Again, you don’t have to retrieve the object by its objectId. Parse has many search alternatives to retrieve information from ParseObjects, which you can find out more about in the official Parse documentation for each distinct technology.

Best Practices and Additional Tips

  • Naming Conventions: Use ClassNamesLikeThis for classes and keyNamesLikeThis for keys to keep your code organized and readable.
  • Common Error Checks: If you experience issues connecting to the Parse SDK, verify your SDK installation and configuration.
  • Automatic Fields: Remember that each Parse object automatically includes createdAt, updatedAt, and objectId fields.

Next Steps

After persisting save and reading your first data on Back4app, we recommend keeping exploring the data storage using the guides below. You will find how to store supported data types, save and query relational data, use geopoints, and create optimized data models.

Conclusion

This guide provides a solid starting point for working with data on Back4app, making data storage and manipulation across platforms easy using the Parse SDK. For any questions, feel free to reach out to Back4app support!