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

(daryl herzmann) #1

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

(Felix Freiberger) #2

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

(daryl herzmann) #3

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:

(Felix Freiberger) #4

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:

(daryl herzmann) #5

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