| [ Web Proxy ] |
| Viewing: https://pub.dev/help/api | [Back] [Original] |
pub.dev API for developers #This document describes the officially supported API of the pub.dev site.
pub.dev may expose API endpoints that are available publicly, but unless
they are documented here, we don't consider them as officially
supported, and may change or remove them without notice.
Changes to the officially supported pub.dev API will be announced at Dart announce.
pub.dev implements the Hosted Pub Repository Specification V2,
used by the pub command line client application.
GET https://pub.dev/api/package-name-completion-data
Headers:
accept-encoding: gzipResponse
cache-control: public, max-age=28800content-encoding: gzipcontent-type: application/json; charset="utf-8"{
"packages": [
"http",
"provider",
/* further package names */
]
}
The API returns the top package names on pub.dev. To reduce payload size the
result may not include all package names. The size limitation is subject to change.
The response is always a gzip-ed JSON content, and should be cached
on the client side for at least 8 hours between requests (as indicated
by the cache-control header).
Notes:
pub.dev.pub.dev may change without notice.GET https://pub.dev/api/package-names
Headers:
accept-encoding: gzipResponse
cache-control: public, max-age=28800content-encoding: gzipcontent-type: application/json; charset="utf-8"{
"packages": [
"http",
"provider",
/* further package names */
],
"nextUrl": null /* a client should call this full URL for the next page */
}
The API returns all package names on pub.dev. The package names are
paginated, clients should call "nextUrl" for the next page if it is
present in the response.
The response is always a gzip-ed JSON content, and should be cached
on the client side for at least 2 hours between requests (as indicated
by the cache-control header).
Notes:
"nextUrl" may change without notice.GET https://pub.dev/api/packages/<package>/publisher
Response
cache-control: public, max-age=120content-type: application/json; charset="utf-8"{
"publisherId": "dart.dev"
}
The API returns the publisher of the requested <package>, or null if the
package is not under a publisher.
GET https://pub.dev/api/packages/<package>/score
Response
cache-control: public, max-age=120content-type: application/json; charset="utf-8"{
"grantedPoints": 160,
"maxPoints": 160,
"likeCount": 8297,
"downloadCount30Days": 11831655,
"tags": [
"sdk:dart",
"sdk:flutter",
"platform:android",
/* further tags */
],
}
The API returns the current scores and score-related metadata for the package:
likeCount: the number of likes on the packagedownloadCount30Days: the 30-days download count of the packagegrantedPoints / maxPoints: the current values of pana scorestags: the tags assigned by pana or by pub.devIf a value has not been calculated yet (e.g. for newly created packages) it will be null.
Please use the above package names for name completion data to fetch the list of package names, and implement search in your app based on that list.
Please check if there is already a similar request or open a new issue. The following requirements are must have for an API endpoint to be considered as official:
[bug report]| Web Proxy Viewer | New URL | Original Page |