Message:

Subscribe rss
Blog categories
All | Backendless features
Feature 43: Required user properties for user registrations
February 19, 2015 by markpiller
Spread the love

Previously I reviewed how to use user registration API to register users for an app. When registering a user your app sends to the server a collection of user registration properties. Values for these properties typically come from a registration form in your app. Some form fields may be required and have a special validation logic. To assist with these use-cases Backendless provides a very simple way to enforce these rules on the backend. In this post I review the process of configuring registration properties as required. Once you do that, any registration API request which does not include a required property is rejected by the server with an error.

To configure a property as required:

  1. Login to Backendless console, select your app and click the Users icon.
  2. The User Properties menu is selected by default. You should see a list of user properties:
    app user properties - Feature 43: Required user properties for user registrations
  3. Notice the Required column which is rendered with a checkbox for each property. Click a checkbox marks the property as required.

For instance, in the interface above if I select the “name” property as required and run the following code, the server would respond with an error. Notice the line of code which sets the “name” property is commented out to cause an error:

Asynchronous Code (Plain Java and Android):

Synchronous Code (Plain Java only):

Asynchronous API sample:

Synchronous API sample:

Asynchronous API sample:

Synchronous API sample:

Reported error:

As soon as the line of code which sets the “name” property is included into the code, the error goes away and the user is successfully created.

Share this post
Tweet about this on TwitterShare on FacebookGoogle+