google / deps.dev

Resources for the deps.dev API
https://deps.dev
Apache License 2.0
242 stars 18 forks source link

REST API similarlyNamedPackages returns no results #90

Closed kenwark closed 3 months ago

kenwark commented 4 months ago

I've been trying out the REST API to get similarly names packages and I'm not sure if I'm doing it incorrectly or there is a bug.

For example, if I use https://api.deps.dev/v3alpha/systems/maven/packages/commons-collections:similarlyNamedPackages, I hope to get a list of packages that includes 'commons-collections' in the name (e.g. commons-collections/commons-collections and org.apache.commons/commons-collections4). However, all I get is a 404 Not Found response.

If I try https://api.deps.dev/v3alpha/systems/maven/packages/commons-collections:commons-collections:similarlyNamedPackages, I get:

{
    "packageKey": {
        "system": "MAVEN",
        "name": "commons-collections:commons-collections"
    },
    "packages": []
}
josieang commented 4 months ago

Hi @kenwark thanks for sending us feedback!

The Similar Packages endpoint accepts a package name and returns packages with names similar to it as defined by the algorithm in this blog post https://blog.deps.dev/similar-names/. It returns a 404 if the requested package doesn't exist in our database. The algorithm is focused around typosquatting similarity, it isn't designed for a package search use case.

It sounds like the search bar in the deps.dev website might be more helpful for your situation. https://deps.dev/search?q=commons-collections&system=maven&kind=package Shows maven packages that include "commons-collections" in the package.

@sarnesjo can give more details that I may have missed.

kenwark commented 3 months ago

Thank you for the clarification. I will close the issue.