Blog

How to Create and Save New Data Objects Using REST Console

by on June 20, 2019

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. The console lets you easily test your REST APIs prior to deployment.

We will start by opening our Backendless application and navigating to the REST Console. To do this, go to Backendless Console and select the Data tab.

Data Management in Backendless Console

Next, let’s create a new table and name it “Location”. To do this, click on the “+” icon and in the opened window enter the name of the table being created.

Create "Location" Table

Now we will create several columns for our table. Click on the name of the table we have created and go to the SCHEMA tab.

Location Table Schema Tab

Next, click the “New” button and fill out the form to create a column in our table. The name for the first column will be “country”, and the column type will be STRING.

Create New Table Column

Similarly, let’s create three more columns with the names “city”, “phoneNumber” and “streetAddress”. Then go back to the DATE BROWSER and see our changes.

Create Additional Columns

That’s all of the preparatory work we need to do. Now we can turn to the most interesting part – using the REST Console. To do this, click the REST CONSOLE tab. You will see the REST Console and the Request Body input field, which accepts in the JSON format. Insert a description of our new object there with the following data:

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

Add Data to Request Body in REST Console

Note that the Request URL contains the name of the table in the context of which the rest of the console was called (see below).

Table Name in REST Request Url

Now we will send a post request by pressing the POST button, and we will see the answer in the Response Body section.

POST Request in REST Console

Let’s check that the record is added to the table by going to the DATA BROWSER tab.

Data Added to Data Browser

That’s all there is to it! Thanks to the REST Console, Backendless makes it easy to work with REST APIs.

Enjoy your increased productivity thanks to Backendless services!

Leave a Reply