How do I get a user's id


#1

In version 1.92, the user registration api returned the new user’s profile, including the user id from the df_sys_user table. In version 2.0, how do I get the user’s id? Each user needs to know their id, so that they I can use the {user.id} filter. However, the register api does not return any user data other that session information.

The idea is similar to this suggestion, but I need the logged in user’s id in order to use it “as a filter parameter in the query

Thanks!


#2

@Brunelamc You can retrieve the registered users id from the GET system/user in API docs. Example:

GET https://df-nachocheese.enterprise.dreamfactory.com:443/api/v2/system/user

would return user details as follows:

{
“resource”: [
{
“id”: 2,
“name”: “Riff_Randall”,
“first_name”: “Joey”,
“last_name”: “Ramone”,
“last_login_date”: null,
“email”: "principle@rnrhs.com",
“is_active”: true,
“phone”: null,
“security_question”: null,
“confirm_code”: null,
“default_app_id”: null,
“adldap”: null,
“oauth_provider”: null,
“created_date”: “2016-01-15 15:49:36”,
“last_modified_date”: “2016-01-15 15:49:36”,
“created_by_id”: 1,
“last_modified_by_id”: null
}
]
}

Is this what you were looking for?


#3

I ended up retrieving it from the user/session api. I ended up having to do two requests as opposed to one, but it works.
Thanks for the input!