You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>A lot of our API is accessible <spanclass="badge bg-success">Anonymously</span>. For API endpoints that <spanclass="badge bg-warning">require authentication</span>, you can authenticate using either Bearer token authorization or query/request parameters:</p>
<li><strong>Query or request parameters:</strong> <code>username</code> and <code>apiToken</code> as query or POST parameters</li>
52
+
</ul>
53
+
<p>The Bearer token method is recommended as it keeps credentials out of URLs and logs.</p>
54
+
<p>You have two API tokens accessible in your <ahref="{{ path('my_profile') }}">profile page</a>. The SAFE one is meant to be used for readonly-style operations and can be leaked without causing too much trouble, so use this if possible when putting it in CI systems etc where it might not remain safe. The MAIN token is required for all API endpoints that are marked UNSAFE.</p>
GET https://{{ packagist_host }}/packages/list.json
@@ -108,7 +121,7 @@ GET https://{{ packagist_host }}/packages/list.json?vendor=[type]&fields[]=t
108
121
109
122
110
123
<sectionclass="col-d-12">
111
-
<h3id="list-popular-packages">List popular packages</h3>
124
+
<h3id="list-popular-packages">List popular packages <spanclass="badge bg-success">Anonymous</span></h3>
112
125
<p>If you need to retrieve the most popular (this is sorted by downloads over the last week, not overall downloads to ensure we demote formerly-popular packages) packages please use this endpoint to avoid having to request the download stats for all of our 300K+ packages individually. This also includes faver count (github stars + packagist.org favorites) and downloads count. The API is paginated if you need more than 100.</p>
113
126
<pre>
114
127
GET https://{{ packagist_host }}/explore/popular.json?per_page=100
@@ -134,7 +147,7 @@ GET https://{{ packagist_host }}/explore/popular.json?per_page=100
<p>Search results are paginated and you can change the pagination step by using the per_page parameter. For example <code>https://{{ packagist_host }}/search.json?q=[query]&per_page=5</code></p>
140
153
@@ -206,7 +219,7 @@ GET https://{{ packagist_host }}/search.json?q=[query]&type=symfony-bundle
<p>If you need complete package information and use <ahref="#get-package-by-name">the JSON API</a> already then please use the <code>downloads</code> key to retrieve stats from that response.</p>
324
337
325
338
<p>However if you are only interested in download stats for a set of package names, you can use the stats endpoint which includes overall download stats + the faver count (github stars + packagist.org favorites):</p>
@@ -345,7 +358,7 @@ GET https://{{ packagist_host }}/packages/[vendor]/[package]/stats.json
<p>This endpoint provides a list of security advisories. Either a list of packages as query or request parameter or a timestamp as updatedSince query parameter need to be passed.</p>
440
453
@@ -479,60 +492,60 @@ GET https://{{ packagist_host }}/api/security-advisories/?updatedSince=[timestam
<p>This endpoint creates a package for a specific repo. Parameters <code>username</code> and <code>apiToken</code> are required. Only the <code>POST</code> method is allowed. The <code>content-type: application/json</code> header is required.</p>
497
+
<p>This endpoint creates a package for a specific repo. Only the <code>POST</code> method is allowed. The <code>content-type: application/json</code> header is required.</p>
485
498
<p>This endpoint is considered UNSAFE and requires your main <ahref="{{ path('my_profile') }}">API token</a> to be used.</p>
486
499
487
500
<pre>
488
-
POST https://{{ packagist_host }}/api/create-package?username=[username]&apiToken=[apiToken] {"repository":"[url]"}
501
+
POST https://{{ packagist_host }}/api/create-package {"repository":"[url]"}
<h3id="edit-package">Edit a package <spanclass="badge bg-warning">Authentication Required</span></h3>
502
515
503
-
<p>This endpoint allows you to edit a package URL. Parameters <code>username</code> and <code>apiToken</code> are required. Only the <code>PUT</code> method is allowed. The <code>content-type: application/json</code> header is required.</p>
516
+
<p>This endpoint allows you to edit a package URL. Only the <code>PUT</code> method is allowed. The <code>content-type: application/json</code> header is required.</p>
504
517
<p>This endpoint is considered UNSAFE and requires your main <ahref="{{ path('my_profile') }}">API token</a> to be used.</p>
505
518
506
519
<pre>
507
-
PUT https://{{ packagist_host }}/api/packages/[package name]?username=[username]&apiToken=[apiToken] {"repository":"[url]"}
520
+
PUT https://{{ packagist_host }}/api/packages/[package name] {"repository":"[url]"}
<h3id="update-package">Update a package <spanclass="badge bg-warning">Authentication Required</span></h3>
521
534
522
-
<p>This endpoint updates a package by canonical repository URL or packagist.org package URL. Parameters <code>username</code> and <code>apiToken</code> are required. Only the <code>POST</code> method is allowed. The <code>content-type: application/json</code> header is required.</p>
535
+
<p>This endpoint updates a package by canonical repository URL or packagist.org package URL. Only the <code>POST</code> method is allowed. The <code>content-type: application/json</code> header is required.</p>
523
536
<p>This endpoint is considered SAFE and allows either your main or safe <ahref="{{ path('my_profile') }}">API token</a> to be used.</p>
524
537
525
538
<pre>
526
-
POST https://{{ packagist_host }}/api/update-package?username=[username]&apiToken=[apiToken] {"repository":"[url]"}
539
+
POST https://{{ packagist_host }}/api/update-package {"repository":"[url]"}
0 commit comments