npms-io / npms-api

The https://npms.io API
MIT License
189 stars 30 forks source link

API end point to get data for a given package name #35

Closed michaelrambeau closed 8 years ago

michaelrambeau commented 8 years ago

Hello everyone and thank you for that useful project, really well done. I built an application that gather the best open source projects related to the web platform => http://bestof.js.org/

I'd like to include npms.io data to display relevant information about npm packages. I already use metrics from http://packagequality.com/, as yo can see in this screenshot:

image

It seems that a public API exists to search for projects: https://api.npms.io/search?term=redux

...but I cannot find what is the URL to get data, given a npm package name. (something like https://api.npms.io/packages?name=redux does not work)

Is it possible? Thank you!

satazor commented 8 years ago

Yes it is possible, I will create this endpoint soon!

satazor commented 8 years ago

@michaelrambeau In your use-case you would prefer to get info about multiple modules, is that correct? If so, the API could also support a POST endpoint in which you specify the module names, and it would return those modules info.

michaelrambeau commented 8 years ago

Hello @satazor , thank you for your quick answer. For now, an API point for a single package would be enough because I already have kind of batches that run once every day to generate data consumed by the UI, looping through all projects and retrieving data from Github, npm, packagequality.com... So I don't really need an end point for multiple modules.

satazor commented 8 years ago

@michaelrambeau I have done both the single + multi endpoints anyway. You may preview how it will look like in https://api-docs.npms.io/. Note that it's not yet deployed but you may follow the merging process here #36

michaelrambeau commented 8 years ago

Preview looks good, I cannot wait for the release. Thank you for your hard work!

satazor commented 8 years ago

Deployed!

michaelrambeau commented 8 years ago

@satazor Thank you very much, I am impressed by the amount of data returned by the API for a given package (https://api.npms.io/module/redux for example), that is really good 👍 !

I will let you know when data from that API is included in http://bestof.js.org/.

satazor commented 8 years ago

Thanks!

michaelrambeau commented 8 years ago

Hello @satazor , I am integrating the wonderful API you did, it works well but is seems that if the package name contains a dot ., an html 404 error page is returned.

Examples:

Note: both intro.js and reveal.js are valid npm package names:

They can be found using the normal npms.io search page.

Can it be fixed, or should I replace the dots by something else ?

satazor commented 8 years ago

It seems like a bug, let me take a look

satazor commented 8 years ago

@michaelrambeau Should be fixed, was a nginx missconfiguration.

michaelrambeau commented 8 years ago

@satazor Amazing, all my issues are gone, your correction was so fast, thank you very much!

For the records, 41 packages (out of 500) were involved by the problem you have just fixed.

Now I am working on the UI part.

satazor commented 8 years ago

Great!

michaelrambeau commented 8 years ago

Hello @satazor , just to confirm, I have just included npms.io data in http://bestof.js.org/. When you browse project tags, you can sort results by npms.io score. If you have any feedback to improve the application, please feel free to contact me. Thank you very much for the API!

image