Retrieve User Schema¶
An application can get a list of the properties associated with the user schema by using the following API:
Non-Blocking Method Signature¶
Backendless.UserService.describeUserClass() .then( function( result ) { }) .catch( function( error ) { });
Blocking Method Signature¶
Backendless.UserService.describeUserClassSync();
Return Value:¶
Server returns an array of objects representing user properties (the columns in the Users table). Each object has the following properties:
{ // name of the property "name": value, // indicates whether the property is required for user registration "required": true or false, // property data type "type": "STRING"|"STRING_ID"|"DATETIME"|"RELATION"|"INT"|"DOUBLE", // default value of the property if one is not provided during registration "defaultValue": value or null, // indicates whether the property is marked as user identity "identity": true or false, // provides more information about relation columns "relatedTable" : if "type" is "RELATION", this property contains the name of the related table }
Non-blocking Method Example¶
// do not forget to initialize the app with the Backendless.initApp( appId, apiKey ) call Backendless.UserService.describeUserClass() .then( function( result ) { for( var i in result ) { console.log( "property name - " + result[ i ].name ); console.log( "\tis property required - " + result[ i ].required ); console.log( "\tproperty data type - " + result[ i ].type ); console.log( "\tdefault value - " + result[ i ].defaultValue ); console.log( "\tis property identity - " + result[ i ].identity ); } }) .catch( function( err ) { console.log( "server returned an error " + err.message ); });
Blocking Method Example¶
// do not forget to initialize your app with the Backendless.initApp( appId, apiKey ) call var props = Backendless.UserService.describeUserClassSync(); for( var i in props ) { console.log( "property name - " + props[ i ].name ); console.log( "\tis property required - " + props[ i ].required ); console.log( "\tproperty data type - " + props[ i ].type ); console.log( "\tdefault value - " + props[ i ].defaultValue ); console.log( "\tis property identity - " + props[ i ].identity ); }