Hi there,
I noticed this day that there is an important difference between data returned by /public/collections/{id}
and /public/collections
.
The API doc states that a collection is represented by an object containing, among other things, another object named groups
, being obviously a list of groups. This is partially wrong, or at least confusing.
Indeed, I was debugging an automation script and noticed this :
- A call to
/public/collections/my-test-id-to-an-existing-and-known-collection
send back a properly filledgroups
property. The result being printed on terminal :
- A call to
/public/collections
and then filtrating data in order to select only the part relevant tomy-test-id-to-an-existing-and-known-collection
gives an emptygroups
(existing but value is None). Here again the result being outputted on terminal :
I blacked out most of the collection ID but of course they are identical in both calls.
I understand very well that the /public/collections
method is probably designed to returned a “lite” version of collections in order to make it quicker and the returned data smaller, and I think it is fine as is. However, the API documentation should be enhanced with a warning, in order to avoid letting users figure out themselves why their script is failing on some strange errors such as, in my case :
for group in collection['groups']:
TypeError: 'NoneType' object is not iterable
I hope I described the issue in an understandable way. Also, I wonder if this should be in a different section of this community forum. I don’t feel like it is user-to-user support, as I debugged my own problem (or at least I hope I correctly understand the behaviour of the API here). However it does not sound like a Feature Request nor like a GitHub Contributions thing. Feel free to move this anywhere if best suited.
Best regards