Using the REST API to change user information and set active to false

I would like to modify user properties such as first name and last name through a user admin page in my app. I’d also like to be able to set a user as ‘inactive’ through this interface.

Is this possible through the REST API? I’ve had a very detailed look through the swagger and the documentation and can’t find anything. I see there is an end point for password reset, are there any others I am unaware of?

Many thanks,
Doug

A user can POST to user/profile to update their built in profile information. The potential payload keys are:

{
  "email": "string",
  "first_name": "string",
  "last_name": "string",
  "display_name": "string",
  "phone": "string",
  "security_question": "string",
  "default_app_id": int,
  "security_answer": "string"
}

This how the user profile page works in the admin in app ( http://…/dreamfactory/dist/index.html#/profile )

Many thanks for the info and quick response Drew, very much appreciated.

I am aware of the user/session end point enabling a user to update their own properties, I was hoping to create an admin page when an admin user could modify the properties of other users, including the ability to perform a password reset (using the dedicated end point as stated in the documentation) or to set an account as “inactive”.

This would work in much the same way as the admin app (http://…/dreamfactory/dist/index.html#/users).

If this can be done through the user/session end point, could you give me a high level explanation of how to do this.

Thanks again

Oh I see.
These properties are editable by the system/user endpoint.
If you’re creating a new user it’s a POST to system/user
If editing an existing user it’s a PATCH to system/user/{user id}

Here are all of the possible payload keys, including relationships

UserResponse { id (id, optional), name (string), first_name (string, optional), last_name (string, optional), last_login_date (datetime, optional), email (string), password (text, optional), is_sys_admin (boolean, optional), is_active (boolean, optional), phone (string, optional), security_question (string, optional), security_answer (text, optional), confirm_code (string, optional), default_app_id (integer, optional), remember_token (string, optional), created_date (datetime), last_modified_date (datetime), created_by_id (reference, optional), last_modified_by_id (reference, optional), oauth_provider (string, optional), adldap (string, optional), app_by_last_modified_by_id (array[RelatedAppResponse], optional): Zero or more App records that are potentially linked to this record directly, role_by_app (array[RelatedRoleResponse], optional): Zero or more Role records that are potentially linked to this record via the App table., service_by_app (array[RelatedServiceResponse], optional): Zero or more Service records that are potentially linked to this record via the App table., app_by_created_by_id (array[RelatedAppResponse], optional): Zero or more App records that are potentially linked to this record directly, app_group_by_last_modified_by_id (array[RelatedAppGroupResponse], optional): Zero or more AppGroup records that are potentially linked to this record directly, app_group_by_created_by_id (array[RelatedAppGroupResponse], optional): Zero or more AppGroup records that are potentially linked to this record directly, app_lookup_by_last_modified_by_id (array[RelatedAppLookupResponse], optional): Zero or more AppLookup records that are potentially linked to this record directly, app_by_app_lookup (array[RelatedAppResponse], optional): Zero or more App records that are potentially linked to this record via the AppLookup table., app_lookup_by_created_by_id (array[RelatedAppLookupResponse], optional): Zero or more AppLookup records that are potentially linked to this record directly, cors_config_by_last_modified_by_id (undefined, optional), cors_config_by_created_by_id (undefined, optional), db_field_extras_by_last_modified_by_id (undefined, optional), service_by_db_field_extras (array[RelatedServiceResponse], optional): Zero or more Service records that are potentially linked to this record via the db_field_extras table., db_field_extras_by_created_by_id (undefined, optional), db_relationship_extras_by_last_modified_by_id (undefined, optional), service_by_db_relationship_extras (array[RelatedServiceResponse], optional): Zero or more Service records that are potentially linked to this record via the db_relationship_extras table., db_relationship_extras_by_created_by_id (undefined, optional), db_table_extras_by_last_modified_by_id (undefined, optional), service_by_db_table_extras (array[RelatedServiceResponse], optional): Zero or more Service records that are potentially linked to this record via the db_table_extras table., db_table_extras_by_created_by_id (undefined, optional), email_template_by_last_modified_by_id (array[RelatedEmailTemplateResponse], optional): Zero or more EmailTemplate records that are potentially linked to this record directly, email_template_by_created_by_id (array[RelatedEmailTemplateResponse], optional): Zero or more EmailTemplate records that are potentially linked to this record directly, event_script_by_last_modified_by_id (array[RelatedEventScriptResponse], optional): Zero or more EventScript records that are potentially linked to this record directly, script_type_by_event_script (array[RelatedScriptTypeResponse], optional): Zero or more ScriptType records that are potentially linked to this record via the EventScript table., event_script_by_created_by_id (array[RelatedEventScriptResponse], optional): Zero or more EventScript records that are potentially linked to this record directly, event_subscriber_by_last_modified_by_id (array[RelatedEventSubscriberResponse], optional): Zero or more EventSubscriber records that are potentially linked to this record directly, event_subscriber_by_created_by_id (array[RelatedEventSubscriberResponse], optional): Zero or more EventSubscriber records that are potentially linked to this record directly, role_by_last_modified_by_id (array[RelatedRoleResponse], optional): Zero or more Role records that are potentially linked to this record directly, role_by_created_by_id (array[RelatedRoleResponse], optional): Zero or more Role records that are potentially linked to this record directly, role_lookup_by_last_modified_by_id (array[RelatedRoleLookupResponse], optional): Zero or more RoleLookup records that are potentially linked to this record directly, role_by_role_lookup (array[RelatedRoleResponse], optional): Zero or more Role records that are potentially linked to this record via the RoleLookup table., role_lookup_by_created_by_id (array[RelatedRoleLookupResponse], optional): Zero or more RoleLookup records that are potentially linked to this record directly, role_service_access_by_last_modified_by_id (array[RelatedRoleServiceAccessResponse], optional): Zero or more RoleServiceAccess records that are potentially linked to this record directly, service_by_role_service_access (array[RelatedServiceResponse], optional): Zero or more Service records that are potentially linked to this record via the RoleServiceAccess table., role_by_role_service_access (array[RelatedRoleResponse], optional): Zero or more Role records that are potentially linked to this record via the RoleServiceAccess table., role_service_access_by_created_by_id (array[RelatedRoleServiceAccessResponse], optional): Zero or more RoleServiceAccess records that are potentially linked to this record directly, service_by_last_modified_by_id (array[RelatedServiceResponse], optional): Zero or more Service records that are potentially linked to this record directly, service_type_by_service (array[RelatedServiceTypeResponse], optional): Zero or more ServiceType records that are potentially linked to this record via the Service table., service_by_created_by_id (array[RelatedServiceResponse], optional): Zero or more Service records that are potentially linked to this record directly, system_config_by_last_modified_by_id (undefined, optional), system_config_by_created_by_id (undefined, optional), system_custom_by_last_modified_by_id (undefined, optional), system_custom_by_created_by_id (undefined, optional), system_lookup_by_last_modified_by_id (array[RelatedLookupResponse], optional): Zero or more Lookup records that are potentially linked to this record directly, system_lookup_by_created_by_id (array[RelatedLookupResponse], optional): Zero or more Lookup records that are potentially linked to this record directly, system_setting_by_last_modified_by_id (array[RelatedSettingResponse], optional): Zero or more Setting records that are potentially linked to this record directly, system_setting_by_created_by_id (array[RelatedSettingResponse], optional): Zero or more Setting records that are potentially linked to this record directly, token_map_by_user_id (undefined, optional), user_by_last_modified_by_id (RelatedUserResponse, optional): A single User record that this record potentially belongs to., user_by_created_by_id (RelatedUserResponse, optional): A single User record that this record potentially belongs to., user_custom_by_last_modified_by_id (undefined, optional), user_custom_by_created_by_id (undefined, optional), user_custom_by_user_id (undefined, optional), user_lookup_by_last_modified_by_id (array[RelatedUserLookupResponse], optional): Zero or more UserLookup records that are potentially linked to this record directly, user_lookup_by_created_by_id (array[RelatedUserLookupResponse], optional): Zero or more UserLookup records that are potentially linked to this record directly, user_lookup_by_user_id (array[RelatedUserLookupResponse], optional): Zero or more UserLookup records that are potentially linked to this record directly, user_to_app_to_role_by_user_id (array[RelatedUserAppRoleResponse], optional): Zero or more UserAppRole records that are potentially linked to this record directly, role_by_user_to_app_to_role (array[RelatedRoleResponse], optional): Zero or more Role records that are potentially linked to this record via the UserAppRole table., app_by_user_to_app_to_role (array[RelatedAppResponse], optional): Zero or more App records that are potentially linked to this record via the UserAppRole table. } RelatedAppResponse { id (id, optional), name (string), api_key (string, optional), description (string, optional), is_active (boolean, optional), type (integer, optional), path (text, optional), url (text, optional), storage_service_id (reference, optional), storage_container (string, optional), requires_fullscreen (boolean, optional), allow_fullscreen_toggle (boolean, optional), toggle_location (string, optional), role_id (reference, optional), created_date (datetime), last_modified_date (datetime), created_by_id (reference, optional), last_modified_by_id (reference, optional) } RelatedRoleResponse { id (id, optional), name (string), description (string, optional), is_active (boolean, optional), created_date (datetime), last_modified_date (datetime), created_by_id (reference, optional), last_modified_by_id (reference, optional) } RelatedServiceResponse { id (id, optional), name (string), label (string), description (string, optional), is_active (boolean, optional), type (string), mutable (boolean, optional), deletable (boolean, optional), created_date (datetime), last_modified_date (datetime), created_by_id (reference, optional), last_modified_by_id (reference, optional) } RelatedAppGroupResponse { id (id, optional), name (string), description (string, optional), created_date (datetime), last_modified_date (datetime), created_by_id (reference, optional), last_modified_by_id (reference, optional) } RelatedEmailTemplateResponse { id (id, optional), name (string), description (string, optional), to (text, optional), cc (text, optional), bcc (text, optional), subject (string, optional), body_text (text, optional), body_html (text, optional), from_name (string, optional), from_email (string, optional), reply_to_name (string, optional), reply_to_email (string, optional), defaults (text, optional), created_date (datetime), last_modified_date (datetime), created_by_id (reference, optional), last_modified_by_id (reference, optional) } RelatedEventScriptResponse { name (string), type (string), is_active (boolean, optional), affects_process (boolean, optional), content (text, optional), config (text, optional), created_date (datetime), last_modified_date (datetime), created_by_id (reference, optional), last_modified_by_id (reference, optional) } RelatedScriptTypeResponse { name (string), class_name (string), label (string), description (string, optional), sandboxed (boolean, optional), created_date (datetime), last_modified_date (datetime) } RelatedServiceTypeResponse { name (string), class_name (string), config_handler (string, optional), label (string), description (string, optional), group (string, optional), singleton (boolean, optional), created_date (datetime), last_modified_date (datetime) } RelatedLookupResponse { id (id, optional), name (string), value (text, optional), private (boolean, optional), description (text, optional), created_date (datetime), last_modified_date (datetime), created_by_id (reference, optional), last_modified_by_id (reference, optional) } RelatedSettingResponse { id (id, optional), name (string), value (text, optional), created_date (datetime), last_modified_date (datetime), created_by_id (reference, optional), last_modified_by_id (reference, optional) } RelatedUserResponse { id (id, optional), name (string), first_name (string, optional), last_name (string, optional), last_login_date (datetime, optional), email (string), password (text, optional), is_sys_admin (boolean, optional), is_active (boolean, optional), phone (string, optional), security_question (string, optional), security_answer (text, optional), confirm_code (string, optional), default_app_id (integer, optional), remember_token (string, optional), created_date (datetime), last_modified_date (datetime), created_by_id (reference, optional), last_modified_by_id (reference, optional), oauth_provider (string, optional), adldap (string, optional) }

If you look at the system/user endpoint in API Docs, you should see the model there, but it won’t include the relationship data. This relationship data was inadvertently removed when Swagger 2.0 was implemented. I have asked the engineering team to add this info back to the API Docs.

1 Like

That’s fantastic, many thanks for the information, exactly what I need.

Apologies, I totally forgot at the system/user endpoints and got fixated on the user service.

Thanks again, especially for the fast turnaround.

1 Like