I've been issuing SQL statements against Confluence Database to add likes to blog/page. But I just saw "Confluence Like REST API" on Confluence Administration page, Add-on section. Does it mean that there's a REST API to add likes? I searched online but there's no result relating to that. Anyone know, if that's possible?
It's a private method, but it's certainly possible. You can see it if you monitor your traffic (when clicking the like button) and/or use the REST API Browser. It is:
(contextPath) /rest/likes/1.0/content/{id}/likes
and you can do either a GET (to see likes), POST (to like), and DELETE (to unlike). The limitation is that the like is applied to the currently logged-in user, so you can't like a page for someone else. To do that, you would have to use a server method or modify the database.
It maybe a better option even though I still need to update the database. Because, right now, I need to generate id for every like I insert(I just increment the largest id by one) and it kind of scares me. With REST approach, I don't need to generate id. I just need to update the username and creationdate. That said, you mentioned server method and I'm not familiar with that. How do I access those methods? Our Confluence is hosted on Cloud by the way.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If your confluence is hosted on Cloud, how are you modifying the database?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Heh. Yes, REST is the only option for Cloud.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok My bad. It's not on cloud. It's hosted on VM running on AWS. So, I have access to the database.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't think the REST interface handles like yet. The basics are at https://docs.atlassian.com/atlassian-confluence/REST/latest/ and doesn't mention it.
(I am mildly intrigued by your SQL though - how do you handle the cache clearing and reindexing after running the SQL?)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For the time being, I use user-interface ("Confluence Admin" > "Cache Statistics"). Later, I may use REST API.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Erk, that's no good, how do you do the indexing?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Same way - Context Indexing/Rebuild. Could you tell my why it isn't good?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So you're running a huge indexing operation every time you use SQL? Are you taking Confluence offline when you do this SQL as you need to? Sounds like you're having to make it usable all the time.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm just working on test site. So, I don't need to take it offline. What I do is, I have nodejs script that imports contents and likes, and updates creation date and whatnot. I have to manually flush the cache and rebuild the index after.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah. Yes you do. Never write to a Confluence database while it is running.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Didn't think of that. You are right, I should keep it offline. Any other suggestion to keep database from corrupting?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.