Blog

How to Create/Save New Data Objects Using REST Console

by on April 1, 2020

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:

Location 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:

Location Table REST Console PUT

Notice we already added the JSON object in the Request body field. In the request body above, you see that there is a missing " in the Request Body, so the POST button is unavailable. We need to fix that proceed.

Once we make the correction, 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:

Location Table REST Console PUT Response

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

Confirm Object Added In REST Console

Enjoy!

Leave a Reply