Roadmap icon indicating copy to clipboard operation
Roadmap copied to clipboard

Remove my vote

Open iSapozhnik opened this issue 2 years ago • 6 comments

Is there a way to remove my vote? For instance I voted for one feature but then I. saw another one which I actually like more and don't want the first one anymore. I would expect that clicking on the feature I voted before will reset it back.

Thanks

iSapozhnik avatar Feb 21 '23 15:02 iSapozhnik

They're not an easy way to do that with countapi.xyz (although there is a way). Lets investigate!

jordibruin avatar Feb 21 '23 15:02 jordibruin

Yeah I see. Just sniffed the traffic to check what does it return (like if there is an ID we can store locally) but no - nothing. 🤔 I'm afraid with the countAPI it's not even possible.

iSapozhnik avatar Feb 21 '23 16:02 iSapozhnik

It is possible with the /set/ endpoint

/set/:namespace?/:key?value=:value

Set the value of a key. Optionally specify the namespace. The key must be created with enable_reset set to 1 (true).

This endpoint will return the previous value before the assignation.

We would have to save the current votes and then set it to one below that.

jordibruin avatar Feb 21 '23 19:02 jordibruin

It is possible with the /set/ endpoint /set/:namespace?/:key?value=:value Set the value of a key. Optionally specify the namespace. The key must be created with enable_reset set to 1 (true). This endpoint will return the previous value before the assignation. We would have to save the current votes and then set it to one below that.

The /set endpoint would do the trick. Sidenote: as I read the docs, you can set a counter value to any new value. But /set only works if you use /create with parameters like enable_reset=true. But I tried, and even the examples in the /create API documentation don't work for any of create's parameter.

My guess is that, because api.countapi.xyz got sold, the new owner may have disabled some features unless you pay. See sale of countapi in 2021.

Alternatives for us:

  • contact new countapi owner (might just be a bug). At least the API docs for /create need updating. [ Update 19 March: can't find CountAPI in the offering of apilayer.com ]
  • contact original author @mlomb of countAPI.
  • with /create you can create default counters that can be incremented and decremented by 1. But, because you are stuck with using only default parameters, you end up with namespace 'default' with key=UUID (hmmm). Pretty ugly, but that would allow you to create as many custom keys as you need. This thus means replacing the /hit endpoint partly with /create and storing the created UUID names in userDefaults.
  • app just emphasises to the user that cast votes cannot be withdrawn (I took this approach so far) and preferably the app request confirmation. I am more worried about accidentally pressing the button than users changing their minds. I didn't quite get this to work yet (as a a custom wrapper around the default FeatureVoter struct).

vdhamer avatar Mar 18 '23 17:03 vdhamer

Hi, original author of CountAPI here. Yes, the only way to reduce a counter is using /set with enable_reset=1. If it doesn't work it must be a bug 😢. I think APILayer hasn't changed the code at all for now.

mlomb avatar Mar 19 '23 15:03 mlomb

@mlomb thanks so much for creating countapi! 🥰

jordibruin avatar Mar 20 '23 08:03 jordibruin