How I can get the latest inserted topic_id when I call create_topic method?


#1

How I can get the latest inserted topic_id when I call create_topic method?

You know, just like mysql, when I insert one row, I can always get the lastInsertId. I hope that when I call create_topic method, I will get the topic_id for later use. Any ideas?


(Dean Taylor) #2

Not 100% sure what API library you are using, assuming the ruby API - something like this:

post = api.create_post(topic_id, user_name, raw_post)
discourse_post_id = post["id"]

#3

I’ll give a shot! Yes, i’m using ruby api. thanks!