adafruit / Adafruit_CircuitPython_AdafruitIO

Adafruit IO for CircuitPython
http://io.adafruit.com
MIT License
49 stars 33 forks source link

add_feed_to_group() is not working at all. #121

Closed thejunglejim closed 4 months ago

thejunglejim commented 4 months ago

Using the add_feed_to_group() call is NOT working - It gives the error: Adafruit IO Error 404: not found - API documentation can be found at https://io.adafruit.com/api/docs

I looked at the code in the library adafruit_io.py and it seems fine but I'm no expert ;-)
The docs say it will add an existing feed to a group. https://docs.circuitpython.org/projects/adafruitio/en/latest/api.html#adafruit_io.adafruit_io.IO_HTTP.add_feed_to_group It seems to create the correct path/url

When using Curl to call the API directly, it does do something a little strange. It creates a brand new feed under the specified group i.e. If I have a feed called test under my general feeds, it will create a new feed called test under the group I specify. I will now have two test feeds. curl -F 'feed_key=test' -H "X-AIO-Key: XXX" https://io.adafruit.com/api/v2/XXX/groups/envsensors/add

I believe the bug is in the API. It wants a feed that already exists .... but then goes and creates a new feed in the group regardless. Now you have two feeds with the same name: one in general feeds and one in the group specified. Calling that API without a feed existing in the general feeds, throws an error too.

thejunglejim commented 4 months ago

Finally the penny dropped. A feed can belong to more than one group but it is still the same feed. The group designation is just a tag for a feed. Thanks @tyeth for the help and explanation.

This issue is now closed as both work as expected.