Save new Object Model in Table

Hi all,
sorry for my english, i’m new user.

I have a simple question, i see the “quick starter guides”, but i don’t understand how to save a new object in the table.
I have, for example, this table:
id - integer
description - string
numberRoom - string

and the relative model


  • @property {Integer} id
  • @property {String} description
  • @property {String} numberRoom
    class Room extends Backendless.ServerCode.PersistenceItem {


module.exports = Backendless.ServerCode.addType(Room);

Then i want to create an API in the Service for add new Room.

Can you help me please?

Hi GF,

If the table name is Rooms, then the class should be called Rooms as well.

To save an object in the table is as simple as this:

var rooms = new Rooms(); = “foo”;
rooms.description = “bar”;
rooms.numberRoom = “1234”;
Backendless.Data.of( Rooms ).save( rooms );

The documentation is right here:


Hi Mark,

thank’s for your response.
Then, for example, the correct service with an API for add new room is the seguent:

const Rooms = require(’…/models/rooms’);

class MyService {


  • @param {Rooms} rooms
  • @returns {Promise.<void>}
    addRoom(rooms) {
    return Backendless.Data.of( Rooms ).save( rooms );

Backendless.ServerCode.addService( AladorService );

is correct?

Yes, it seems to be correct in case you pass a valid json into the method.