Saving data after registration

Hi,

I’ve been trying to figure out today how to save the next set of data after registration (i.e, username, age, etc.)

Was trying to save it at the same backend on backendless which ends with ‘/users/register’.

However, when I was re-reading this : How to Integrate AppGyver With Backendless | Backendless

it states that we should save the next set of data of a user under a new table. ‘data/person’.

I haven’t tried doing that, but may I understand what’s the logic behind it?

If data from the same user are saved in different DBs, what are they linked by? How do we know it’s from the same user? (for eg, how do we know username: Goku is from tommyhilfiger@gmail.com if they are stored in different APIs?)

Thank you ! :smiley:

Hello, @Troy_Lee.

These are two independent examples.
You can store all data in the Users table. They can even be passed directly at registration time using the setProperty( string key, object value ) function. If you want to store data separately from the Users table, then you can establish a relation between the two tables, or simply use the same objectId.

Best regards, Nikita.

Thanks for your reply Nikita. :smiley: appreciate it.

How do I go about doing what you mentioned? ‘setProperty (string key, object value) function’

Based on your experience, is it better to store data in separate tables or on the same table?

many thanks!

@Troy_Lee, as for me, I would keep in one.

What sdk do you use?

Noted Nikita.

im using Appgyver

@Troy_Lee, my request body for user registration and adding value to column “myCustomValue”:

{
  "email" : "test@gmail.com",  
  "password" : "123123",
  "myCustomValue" : "123Name"
}

As a result, my user was registered and the value “123Name” was saved in the column “myCustomValue” (The column must be created in advance).

Best regards, Nikita.

@Nikita_Fedorishchev

Yes, when i’m running the test, everything could be inserted to the columns properly.

However, when I’m running on the app. There’s an error.

The first page (which is the registration page with inputs of email and password) is smooth.
For the second page (which only has inputs of username and date picker for birthday), ‘Record properties’ tab of the ‘Create Record’ Component needs me to insert the email and password as page variables, otherwise they will be static text. So I created email and password as page variables on the second page.

As seen in this screenshots:

This step returns the error as seen above.

I know there must be something that I’ve forgotten to link or done in error, because the email and password inputs aren’t in the second page, bringing them in as page variables might be the cause of this error.

Even if I leave the email and password empty as static text, the error is the same.

How do I inform the system that the input of username and birthdate on the second page is a continuation of what the user does after the registration? So that it can stop asking for the property value input of password.

I’m guessing smth related to objectId?

Over at the registration page, this works fine.

However, over at the second page, the ‘Object with properties’ tab under "Create Record’ component shows this:

@Troy_Lee, this error indicates that the server does not receive a value for the “password” field. You need to make sure you are sending this value. Alternatively, you can split this logic into 2 queries. The first one uses /user/register and the server will return the objectId to you. Then using date/Users passing your objectId value to Request body, you can save additional fields.

Thank you for your reply, and sorry for the multiple messages.

The value for password is passed on for the first page using users/register. But it’s just not passed on for the second page.

So yes, I’m thinking of the alternative you recommended. But my mental map for that is dark, blank… LOL. Which documentation in specific or is there a particular mission tutorial that I can take to learn about this? It’ll be 2 database but linked with the same objectId, is this understanding right? @Nikita_Fedorishchev

@Troy_Lee, all these things are described in our documentation. Will this be stored in one database? Depending on your preference and how you want to do it. The example I described saves everything to the Users table.

This is a link to our documentation:
https://backendless.com/docs/rest/users_user_registration.html

And it’s okay, we are always happy to help :slight_smile:

I would very much prefer one database. Like what you said, under Users.

I’ve read this page many times today :laughing:

But over at appgyver, I don’t see the request response body (I see it in backendless REST API)

My current logic flow @ appgyver is :

Create input field, link it to page variable: username
Create Date Picker, link it to page variable: birthday
Create button below to ‘create record’, link it to the database and set page variables of username and birthday.
Dismiss initial view
Open new page.

Screenshot below:

I’m guessing the error might be at the create record part. Judging by the ability to get all the inputs when i RUN TEST @ Data Configurator.
But i just am not sure what and how needs to be changed. :sob:

Hi Troy,

It would be much easier for us to operate at the level of API calls made from your app rather than pages. When you make a user registration API call, both email address and password are required. In addition to these two properties, you can add additional ones as shown here.

Since you’re talking about “first page” and “second page”, does your app make several registration calls?

Regards,
Mark

Hi Mark,

I’m not too sure about the qtn. The first page is the registration page. With the ‘Create Record’ Logic flow calling into the data resource that has the user/register ending linked to Backendless.

The second page and subsequent pages will be about filling information of this user.
But within the ‘Create Record’ Logic flow, the data resource funnelled to is still the same as the first page’s, with the URL ending with user/register.

Is this method of proceeding wrong?

In regards to the link you shared, when I’m running a test over at the data config side, everything is added nicely to the Backendless backend, in the users table.

My issue is when I input the entries within the app. Only the inputs from the first page (email and password entries) are reflected in the backend. And not inputs from the second page.

So I was wondering: Is there a need to bring over the entries from the first page (email and password) to the second page to tell it that we are in fact updating columns for the same user?
If so, how do I go about doing it? (Should the email and password then not be page variables but app variables instead?)

When the system error shows code 3041: unable to register user. Missing required property value for ‘password’, it’s in fact able to register the inputs on the first page as shown in the screenshot below:

It’s just that the inputs on the second page (birthdate and username) are not reflected.

Hi Troy,

I think I understand it a little better now. The registration page (the first one) uses the User Registration API call. On the subsequent pages, you need to update the user record to add additional data to the user record.

The API calls for registration and user update are different. The first one is this:
https://backendless.com/docs/rest/users_user_registration.html

The subsequent ones are this:
https://backendless.com/docs/rest/data_single_object_update.html

The result of the user registration call (the first one) is a JSON object that includes the objectId property of the user record. It will be important to include that value in the subsequent call to update the user record.

Does this make any sense?

Regards,
Mark

Hi Mark,

Yes I think it makes sense to update record moving from the second page onwards.

Now it’s about linking any updates to the objectId created from the user after they registered on the first page.

let me try it out Mark. :smiley:

Thank you

Hi Mark,

For subsequent update calls, let’s say it’s ‘username’ and ‘birthdate’ on the second page, it would be ‘Saving Multiple Objects’ instead of ‘Saving Single Object’?

The API DB for my users’ registration was
https://api.backendless.com///users/register

So do I create another API DB for updating users’ records and use resource URL https://api.backendless.com///data/bulk/ ?

But in this sense, where do I add the objectId? Is it as depicted in the screenshot below:

note, I’m not literally putting the API ID and REST API key as such. I replace them with my own API ID when I run the test. This is for illustrating.

Sorry it seems like I’m asking these simple questions. Still can’t wrap my head around it as a newbie. Feels like an ant running in a circle maze. :sob:

No, it would be updating a single object - you are updating a single user record, not multiple user records.

Please note the documentation for bulk update says:

This API updates multiple objects in a data table with a single request

You’re on the right path, but picked a wrong API call :slight_smile: it will get better!

I see, ahhhh, thanks for the clarification Mark. Single object update meaning updating a row (user). Multiple objects update means updating several rows, up to 100.

So I’ll be creating another API DB with the URL?:
https://api.backendless.com///data/users/objectId

With that said, the docu states that I should add the exact objectId at the end of the URL.

I know this will specify exactly which user row to update in the backend. But isn’t that unfeasible to manually change the objectId for every user?