Add a New User

You can add end users to your Catalyst serverless applications, fetch their details, or manage their accounts easily. When a user has signed up to a Catalyst application, unique identification values like ZUID and User ID are created for them. The user is also assigned to an organization automatically in this method.

Create a JSON Configuration

Before you add a new end-user to your Catalyst application, you must create a JSON object that contains the registration details of a particular user, such as their email address, last name, the application platform and the role they must be added to, as shown below. You can then pass the configuration to the user registration method.

Note:

  • You must provide the values for email_id and last_name to register a user mandatorily.
  • You can obtain the role_id from the Roles section in Authentication in the Catalyst console.
  • You can obtain the ZAID from the Environment settings in your Catalyst console.
Copied//Create a JSON object for adding a new user
var signupConfig = {
			platform_type: 'web',
			zaid: 10020507508
	         };
var userConfig = {
			last_name: 'Boyle',
			email_id: 'p.boyle@zylker.com',
			role_id : '3376000000159024'
		};

Add a New User

You can now add a new end-user to your Catalyst application using the code below. You must pass the JSON objects you created in the previous section as arguments to the registerUser() method.

The registerUser() method handles the user sign-up process and returns a promise. This promise will be resolved to a JSON object.

The userManagement reference used below is defined in the component instance page.

Note: You will be able to add only 25 users in your application in the development environment. After you deploy your application to production, you can include any number of end-users in it.
Copiedlet userManagement = app.userManagement();
let registerPromise = userManagement.registerUser(signupConfig, userConfig); //Pass the JSON configration to the method
registerPromise.then(userDetails => {  //Returns a promise
        console.log(userDetails); 
});

A sample response that you will receive for each version is shown below:

Node.js

Copied{
  zaid: "1005634498",
  user_details: {
    zuid: "1005641290",
    zaaid: "1005641456",
    org_id: "1005641456",
    status: "ACTIVE",
    is_confirmed: false,
    email_id: "p.boylie@zylker.com",
    last_name: "Boyle",
    created_time: "Aug 12, 2021 12:33 PM",
    modified_time: "Aug 12, 2021 12:33 PM",
    invited_time: "Aug 12, 2021 12:33 PM",
    role_details: { role_name: "App User", role_id: "2305000000006024" },   
    user_type: "App User",
    user_id: "2305000000007752",
    project_profiles: []
  },
redirect_url: "https://aliencity-66446133.development.catalystserverless.com/app/",
  platform_type: "web",
  org_id: null
}
Copied{
  zaid: 1005634498,
  user_details: {
    zuid: 1005641433,
    zaaid: 1005641434,
    org_id: 1005641434,
    status: "ACTIVE",
    is_confirmed: false,
    email_id: "p.boyle@zylker.com",
    last_name: "Boyle",
    created_time: "Aug 12, 2021 12:27 PM",
    modified_time: "Aug 12, 2021 12:27 PM",
    invited_time: "Aug 12, 2021 12:27 PM",
  role_details: { role_name: "App User", role_id: 2305000000006024 },
    user_type: "App User",
    user_id: 2305000000007745,
    project_profiles: []
  },
redirect_url: "https://aliencity-66446133.development.catalystserverless.com/app/",
  platform_type: "web",
  org_id: null
}