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.
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…
“If you’re not prepared to be wrong, you’ll never come up with anything
original.” ― Ken Robinson,
were you able to figure out how to relate to user table ?
I simply created a view for what I needed. Thanks for the follow-up.
You have to set the Attribute unsigned, then it should be possible to set the foreign key relationship!
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.