Blog

How to Create/Save New Data Objects Using REST Console

by on September 1, 2019

The REST Console is a part of the Backendless Console. It is a versatile interface that lets you perform a complete CRUD (Create, Retrieve, Update, Delete) set of operations on your data stored in Backendless using the REST interface.

Another Recipe article described how to use the REST Console to perform search queries (that’s the Retrieve part of CRUD). In this post, we are going to demonstrate how to save new data objects using the REST Console.

Consider the following data table schema:

The table name is “Location”, as you can see in the drop-down in the upper-right corner of the screen. There are five columns in the table. Let’s switch to the REST Console interface for the table and enter a JSON object describing a new location. We’re going to ignore the “menu” column, for now, to keep things simple. A JSON object describing a location per the schema shown above may look like this:

{
"country":"USA",
"city":"Dallas",
"phoneNumber:"972-555-1212",
"streetAddress":"123 Commerce St"
}

The REST Console interface is available on the Data screen of Backendless Console. Select a table where you want to create a new object and click the REST Console tab. In my case it is going to the Location table:

Notice we already added the JSON object in the Request body field. To send a REST request to save a new object, click the POST button. An object is saved and a complete object description is returned and shown in the Response body field. It is important to note that this would be the exact behavior for the same REST request executed outside of the REST Console:

If you switch to the Data Browser tab, the new object will show up in the table as well:

Enjoy!

Leave a Reply