Remove my vote
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
They're not an easy way to do that with countapi.xyz (although there is a way). Lets investigate!
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.
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.
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
countapiowner (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
/createyou 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
FeatureVoterstruct).
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 thanks so much for creating countapi! 🥰