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.
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.
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.
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.
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.
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:
"streetAddress":"123 Commerce St"
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).
Now we will send a post request by pressing the POST button, and we will see the answer in the Response Body section.
Let’s check that the record is added to the table by going to the DATA BROWSER tab.
That’s all there is to it! Everything should be very simple and clear. Enjoy your increased productivity thanks to Backendless services!