[wp-trac] [WordPress Trac] #54989: Download stats API returning unexpected results
WordPress Trac
noreply at wordpress.org
Sun Jan 30 10:31:11 UTC 2022
#54989: Download stats API returning unexpected results
--------------------------+-----------------------
Reporter: pyves | Owner: (none)
Type: defect (bug) | Status: reopened
Priority: normal | Milestone:
Component: HTTP API | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+-----------------------
Changes (by pyves):
* status: closed => reopened
* resolution: invalid =>
Comment:
Requesting data for a plugin slug that does not exist is not necessarily
intentional.
As an example, I'm looking at badges provided by Shields.io
(https://github.com/badges/shields). We support one that displays the
number of WordPress plugin downloads (e.g.
https://img.shields.io/wordpress/plugin/dd/bbpress). When building the
badge URL, users may make a typo or a mistake when copy-pasting the slug
from somewhere. After all, they're only human.
As the Wordpress API isn't returning a 404, an empty response, or a 0
download result, we've got no way of telling whether the returned data is
trustworthy. As pointed out, it may be fake or nonsense in a non-explicit
manner. We could have surfaced the user mistake by displaying a badge
stating "plugin not found", like we do for dozens of other services we
integrate with. Instead we've got little choice but to render a healthy-
looking badge, which is misleading and a poor user experience.
Worth noting that only the downloads stats API seems to behave like this.
All other Wordpress endpoints I've checked do something more sensible when
an erroneous plugin/theme slug is provided:
- https://api.wordpress.org/stats/plugin/1.0/qdsdqsd returns an empty
array.
- https://api.wordpress.org/plugins/info/1.0/ebufskjfskdf returns a 404
with a helpful error message.
- https://api.wordpress.org/translations/plugins/1.0/?slug=eqfhuesffkhdsk
returns an object with a single empty array.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54989#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list