Data import

Viewed 83

I’d like to address a few points up front: I have thoroughly reviewed both the documentation and the Swagger docs.

I have three sets of JSON files:

  • Questions.json – This file includes all questions, answers, comments, and metadata on who contributed each item.
  • Users.json – This file is self-explanatory, containing user data.
  • Tags.json – This file is also straightforward, containing tag data.
    For the tags, importing them should be straightforward using the /answer/api/v1/tag endpoint.

For users, I understand the process involves:

  • Creating a user with /answer/admin/api/user.
  • Setting a password for the user with /answer/admin/api/user/password.
  • Activating the user with /answer/admin/api/users/activation.

However, I’m unsure if the user creation endpoint returns the user ID, which is crucial for setting the password and activation.

Regarding the questions, answers, and comments: it appears that these are created based on the API user. I’m unsure how to import this content under different users programmatically.

I'm well aware I could import the data directly into the database and deal with the table structure, but that kinda seems like it defeats the purpose of having an API to do all of this programmatically.

Any guidance on how to handle these imports effectively using the API would be greatly appreciated.

2 Answers

Importing into the database seems to be the only sensible soloution, so automated that processes writing some node code!

If you want to import users, perhaps this feature in the admin page will help.

image.png