I think i will use websockets, thanks for the advice. At moment i'm using callbacks only because can't do different.
Probably async/await will be available from the next version (I've read that too).
SOLVED Populate additional fields when creating a user using Write API
I'm creating users in NodeBB instance from another Node.js application using NodeBB Write API plugin.
According to the documentation
POST /api/v1/users/accepts only
username, password, emailfields and "Any other data passed in will be saved into the user hash".
My questions are: What is actually user hash in context of NodeBB? And is it possible at all to populate any other fields than
username, password, emailwhen creating a user using Write API?
In nodebb the user hash is just the user object. The name comes from the redis hashes. If you are using redis you can see the data in the hash with
Thank you for response!
No, I'm using mongo instead of redis. I'm just wondering how can I write additional fields like
locationetc. using Write API. Should I firstly create a user with
POST /api/v1/users/and then make additional API call
PUT /api/v1/users/:uidin order to populate additional user fields?
Yes that should work since fullname and location are core fields, if you need to add additional fields that don't exist in core then you would need to write a plugin to add those fields using hooks like
Thanks a lot for your assistance. The filter
filter:user.updateProfileseems to be very useful for my needs.
@baris Hi, i too have the same requirement, i understand that we have to write a plugin to use the hooks filter:user.updateProfile.
Could you please provide any sample to write plugin and use this hook.