Relationship to DF's user table

I have a table that contains a user_id, which is the dreamfactory user table id. Now, I want to get the records from my table and have the relationship to the DF users also included, so I can get for example the email addresses of these users. I’m not seeing a way to do this? Am I forced to manually query the DF user table for each record in my table? There has to be a better way to do this?

If it is a foreign key relationship with the dreamfactory user table, you can query your table with the related attribute pointing to user table. That will bring back user details in the same response. Have you tried that?

In the API Docs, try putting a * (asterisk) in the “related” attribute and see the response. Now, pickup the relationship name and place that instead of the * to get only the related table information.

Let me know if that does not work.

Good luck!

It wont let me set up a field in my table that is a reference to the df
user table in the first place.

I have instead created a view in my database that puts the two together,
and this is working for now…

[image: --]

Aric Caley
Web and Mobile Software Engineer
[image: http://]

“If you’re not prepared to be wrong, you’ll never come up with anything
original.” ― Ken Robinson,

1 Like

were you able to figure out how to relate to user table ?

1 Like

I simply created a view for what I needed. :slight_smile: Thanks for the follow-up.

1 Like

You have to set the Attribute unsigned, then it should be possible to set the foreign key relationship!

1 Like

I am trying to reference user from api/v2/system/user to a mysql table.
but I don’t see any option to that
any Idea how can I achieve it ?

Are you saying you want to do a db foreign key to the user object? To do that you’ll have to add your system database as a service. Then it will be available under the user table in the newly added service.

isn’t it under field type that you choose type user_id rather than text or integer.