How to associate a new upload with a previous post via the API

I am migrating a bunch of content from the Jive Cloud to my discourse. I used the existing jive_api.rb which does not do attachments, so I am attempting to manually associate uploads with currently existing posts within discourse.

Via the API, I don’t see a means to update a current post’s uploads. My thought to try is to add the uploads via the API and then manually update the post_uploads postgresql table to update the post’s associated uploads. Do you think this will work or am I missing some means via the API to make this happen?

thank you

Can’t you just edit the post to add a link to the file?

5 Likes

Thanks, I suppose, but I worry that discourse would then think that this upload has no associated content and would delete the upload after some period. Maybe it wouldn’t :slight_smile:

But that’s what normal users do: They just link to an attachment in a post. Discourse then internally stores that in its database :slight_smile:

3 Likes

awesome, it works and the API auto-updates the post_uploads table to give me warm fuzzies

3 Likes