跳到正文

面向开发者

公共 API

位于 /api/v1 的 JSON API,用于查询模组、地图和皮肤并下载文件。只读。

基础地址

https://dromorcraft.com/api/v1

Projects

get /projects

Search published projects, or get several by id

get /search

Alias of GET /projects

get /projects/{idOrSlug}

Get a project

get /projects/{idOrSlug}/dependencies

Public projects and versions the published versions depend on (required, optional, embedded)

Versions

get /projects/{idOrSlug}/versions

List published versions (newest first)

get /projects/{idOrSlug}/versions/{version}

Get one version of a project

get /versions

Get several versions by id (max 100, in the order asked)

get /versions/{id}

Get a version by id

Files

get /projects/{idOrSlug}/files

Files of the current version

get /version-files

Identify many installed files at once: hash → version that contains it

get /version-files/update

Check updates for many files: hash → newest compatible version of the same project

get /version-files/{hash}

Find the version that contains a file (identify installed files, check updates)

get /version-files/{hash}/update

Newest published version of the same project that matches the filters (the installed one when it is already the newest)

get /files/{id}/download

Download a published file (302 to the immutable object; counted once per visitor and day)

Users

get /users

Get several public profiles by id or username (max 50)

get /users/{username}

Public profile

get /users/{username}/projects

Public projects of a user

Reference

get /categories

Categories

get /types

Enabled content types and their file rules

get /minecraft/versions

Minecraft versions

get /statistics

Platform totals: published projects, versions, files, authors and downloads

get /openapi.json

This document

示例

搜索适用于 Fabric 1.21.4 的模组

curl "https://dromorcraft.com/api/v1/projects?type=mod&platform=fabric&gameVersion=1.21.4&sort=downloads&limit=10"

获取项目及其版本

curl "https://dromorcraft.com/api/v1/projects/<slug>"
curl "https://dromorcraft.com/api/v1/projects/<slug>/versions?channel=stable"

通过哈希识别已安装的文件(SHA-1 或 SHA-256)

curl "https://dromorcraft.com/api/v1/version-files/<sha1>"
curl "https://dromorcraft.com/api/v1/version-files/<sha256>?algorithm=sha256"

一次请求获取多个项目或文件

curl "https://dromorcraft.com/api/v1/projects?ids=<id>,<slug>"
curl "https://dromorcraft.com/api/v1/version-files?hashes=<sha1>,<sha1>"

查找兼容 Fabric 1.21.4 的更新

curl "https://dromorcraft.com/api/v1/version-files/update?hashes=<sha1>,<sha1>&platform=fabric&gameVersion=1.21.4"

下载文件(重定向到文件)

curl -L -o mod.jar "https://dromorcraft.com/api/v1/files/<fileId>/download"