Manage Likes via API

I am attempting to managed the task likes for a specific project. This project keeps track of postings we drop into a news feed. Staff use the Like feature to upvote which items they like best for the month and the ones with the most votes get committed to the feed. Every month the likes need to be reset so staff can vote again on their favorite items for the new month.

I am attempting to use the API to managed this process. I thought it would be relatively simple to simply loop through the project every month and reset the “likes” property. It looks like tasks with no likes simply have an empty array - simple enough to just pass an empty array to that property via the API, but when I attempt this the API throws an error - apparently this property is read-only.

So I’m looking for suggestions on:

A) does anyone else manage likes via the API and if so how do they go about it

And

B) if Likes aren’t the best way to manage this process I’m open to an other way to do this with say custom fields if someone has a cleaner way to create some sort of rating for tasks that can be reset every month. Thanks.

Hi @Pete_Schellenbach,

Yeah, almost positive likes is a read-only property.

There is a num_likes property; you would think that would be read-only but I don’t show it as that; what happens if you try to update that property?

No dice, still returns Cannot write this property error.

Yeah, it would have been really odd to be able to alter that number when you can’t alter the underlying array that’s generating it.

The only way to affect likes is via the liked boolean property. However, that only turns on and off one’s like for a task for the specific user whose account you’re authenticated to. You can see how that makes sense; otherwise the API could like a task on behalf of someone it has no permissions for, without that user ever knowing that they liked that task!

So I don’t see how likes will fit your use case.

The only thing I can think of - and it’s kinda ugly IMO - is to use subtasks. Have a user add a subtask with their name underneath a task they want to vote for. Then you can write code to loop through the tasks and use the num_subtasks property to get the votes on each task. Then you can delete those subtasks.