The Programmatic API
This section covers the programmatic API that Alexandrie exposes.
Some of these endpoints are used by cargo
itself when running commands like cargo search
, cargo publish
and some others.
URL format
Before anything, here is a description of the syntax used throughout these pages for writing URLs:
<name>
: is either:- a placeholder for any path segment (when in within the pathname, eg.
/crates/<name>
) - a querystring variable (when in querystring position, eg.
/search?<q>
)
- a placeholder for any path segment (when in within the pathname, eg.
[...]
: means that the the pattern inside these brackets is optional:- mostly used for optional querystring variables (eg.
/search?<q>[&<page>]
)
- mostly used for optional querystring variables (eg.
Public Endpoints
Public endpoints are accessible without needing to authenticate.
Crates section:
- Search crates:
GET /api/v1/crates?<q>[&<page>][&<per_page>]
- Get crate information:
GET /api/v1/crates/<name>
- List crate owners:
GET /api/v1/crates/<name>/owners
- Download crate archive:
GET /api/v1/crates/<name>/<version>/download
Categories section:
- List crate categories:
GET /api/v1/categories
Account management section:
Authenticated Endpoints
The following endpoints require a valid token to be specified in the Authorization
request header.
Refer to the Authentication docs to learn how to get one and how to use it.
Crates section:
- Publish crate:
PUT /api/v1/crates/new
- Add crate owners:
PUT /api/v1/crates/<name>/owners
- Remove crate owners:
DELETE /api/v1/crates/<name>/owners
- Yank crate version:
DELETE /api/v1/crates/<name>/<version>/yank
- Unyanking crate version:
PUT /api/v1/crates/<name>/<version>/unyank
Account management section:
- Get token information (from name):
GET /api/v1/account/tokens/<name>
- Get token information (from token):
POST /api/v1/account/tokens
- Generate authentication token:
PUT /api/v1/account/tokens
- Revoke authentication token:
DELETE /api/v1/account/tokens