Skip to content

Commit 1793a03

Browse files
authored
Promoting more endpoint to public API: publisher and score. (#8923)
1 parent 6d9c3f4 commit 1793a03

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

doc/help-api.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Notes:
5050
* The order of the packages reflects their overall ranking on `pub.dev`.
5151
* The inclusion criteria used by `pub.dev` may change without notice.
5252

53+
5354
### Package names for archiving and mirrors
5455

5556
**GET** `https://pub.dev/api/package-names`
@@ -85,6 +86,56 @@ Notes:
8586
* The order of the packages, the number of packages on a response page,
8687
or the URL structure of `"nextUrl"` may change without notice.
8788

89+
90+
### Package metadata: publisher
91+
92+
**GET** `https://pub.dev/api/packages/<package>/publisher`
93+
94+
**Response**
95+
* `cache-control: public, max-age=120`
96+
* `content-type: application/json; charset="utf-8"`
97+
98+
```js
99+
{
100+
"publisherId": "dart.dev"
101+
}
102+
```
103+
104+
The API returns the publisher of the requested `<package>`, or `null` if the
105+
package is not under a publisher.
106+
107+
108+
### Package metadata: score
109+
110+
**GET** `https://pub.dev/api/packages/<package>/score`
111+
112+
**Response**
113+
* `cache-control: public, max-age=120`
114+
* `content-type: application/json; charset="utf-8"`
115+
116+
```js
117+
{
118+
"grantedPoints": 160,
119+
"maxPoints": 160,
120+
"likeCount": 8297,
121+
"downloadCount30Days": 11831655,
122+
"tags": [
123+
"sdk:dart",
124+
"sdk:flutter",
125+
"platform:android",
126+
/* further tags */
127+
],
128+
}
129+
```
130+
131+
The API returns the current scores and score-related metadata for the package:
132+
- `likeCount`: the number of likes on the package
133+
- `downloadCount30Days`: the 30-days download count of the package
134+
- `grantedPoints` / `maxPoints`: the current values of `pana` scores
135+
- `tags`: the tags assigned by `pana` or by `pub.dev`
136+
137+
If a value has not been calculated yet (e.g. for newly created packages) it will be `null`.
138+
88139
## FAQ
89140

90141
### I'd like to implement search, what API can I use?

0 commit comments

Comments
 (0)