With Api how do you create topics and posts so owned by particular user

Importing my data from csv files using the api.
I’m importing my users successfully. I’m importing categories, topics and posts successfully, except at the moment all my topics and posts are shown as being created by me the discourse admin for the site.

Not clear how I create them so owned by the actual user

Does the correct user have to be specified as the Api-Username for each post, and if so does that mean the user has to be an admin user (which they wouldnt be).

Or do I create the topics/posts and pass another parameter for the user (that I cant see in the docs) ?

Or do I create and then modify the post, specifying the user (again I cant see this option) ?

thanks Paul

2 Likes

I tried passing user_id (and userid) as an extra post parameter when I create topic, but it had no effect.

Set the Api-Username to the username that you want to publish the post. Use the All Users API key for the Api-Key.

4 Likes

Thanks, if I use such an api key can I use that for everything, or our there some things I can only do with key if restrict to single user.

1 Like

You can use the All Users API key for everything to do with importing your data.

3 Likes

Ok, can confirm I have tried it and it works, thanks.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.