Skip to content

BestGems API v1 Specification

brian piercy edited this page May 30, 2016 · 3 revisions

BestGems API v1 Specification

Introduction

  • You can get BestGems's data using this API by your program.
  • RESTful API Design. Using HTTP and JSON.
  • Free access, without client authentification.

Trends API

  • Returns trends as array of hash containing requested data.
  • Trends is sorted by date desc.
  • If [GEM_NAME] is not found, returns status code 404.

Note

Results of trends API are not perfect. Often, results have chasm as indicated by the following example. You don't expect that perfect data are returned.

[{"date":"2014-01-04", "total_downloads":4567},
 {"date":"2014-01-02", "total_downloads":2345},
 {"date":"2014-01-01", "total_downloads":1234}]

Total Downloads Trends

Endpoint:

GET - /api/v1/gems/[GEM_NAME]/total_downloads.json

Example of results:

[{"date":"2014-07-16","total_downloads":123},
 {"date":"2014-07-15","total_downloads":456},
 {"date":"2014-07-14","total_downloads":789}]

Daily Downloads Trends

Endpoint:

GET - /api/v1/gems/[GEM_NAME]/daily_downloads.json

Example of results:

[{"date":"2014-07-16","daily_downloads":123},
 {"date":"2014-07-15","daily_downloads":456},
 {"date":"2014-07-14","daily_downloads":789}]

Total Ranking Trends

Endpoint:

GET - /api/v1/gems/[GEM_NAME]/total_ranking.json

Example of results:

[{"date":"2014-07-16","total_ranking":123},
 {"date":"2014-07-15","total_ranking":456},
 {"date":"2014-07-14","total_ranking":789}]

Daily Ranking Trends

Endpoint:

GET - /api/v1/gems/[GEM_NAME]/daily_ranking.json

Example of results:

[{"date":"2014-07-16","daily_ranking":123},
 {"date":"2014-07-15","daily_ranking":456},
 {"date":"2014-07-14","daily_ranking":789}]