Skip to content

API Format

Kripesh Adhikari edited this page Oct 13, 2022 · 8 revisions

The API is pretty much what makes the Profile Manager work. It gives information on how to install Fabric, where the mod files are (the Files API), the latest modpack version, supported optimizer mods and a bit of additional information.

Click here for a complete example.
Continue reading for detailed information about the API Parameters.

Metadata

Unlike the config.json which is bundled with the client and is also very unlikely to change in any breaking way, the API format is definitely not finalized and is bound to change as we add more features. Thus, a metadata object is used to provide the API format version.

The current api_format_version is -3. If this value is not equal to the value stored in the client, the client will simply refuse to use any data from the API and immediately exit, asking the user to update the client.

Example:

"metadata": {
    "api_format_version": -3
}

Links

This object contains the URLs to the links that can be opened directly from the client. Unless you have modified the source code, we request you to use the default value of source_repo, which is the URL of this repository.

Example:

"links": {
    "source_repo": "https://github.com/aitecraft/profile-manager",
    "skin_changer": "https://my_modpack.com/skins/",
    "website": "https://my_modpack.com/"
}

Only source_repo is required here. The other links are only needed if you have the proprietary.links object in config.json.

Latest version

This is the value that declares the latest version of the modpack. It must be a positive integer, other values may work but are not supported. As you update the files or fabric or optimizer mods, make sure to increment this value so the client knows that it needs to update.

Example: "latest_version": 6

Files API Endpoint

The Files API is what gives details to the client about the modpack files. This object is just like the API Data object in the config.json.

Example:

"files_api_endpoint": "https://my_modpack.com/pm/api/files/index.json"

Modrinth API Endpoint

This specifies the root endpoint to the Modrinth API (v2) for use when processing modrinth provider files.

Example:

"modrinth_api_endpoint": "https://api.modrinth.com/v2/"

Must have a trailing backslash.

CurseForge API Endpoint

This specifies the root endpoint to the CurseForge API for use when processing curseforge provider files.

Example:

"curseforge_api_endpoint": "https://api.curse.tools/v1/cf/"

Must have a trailing backslash.

Fabric Configuration

The client needs a lot of information so that it can install Fabric. This object lets the client know if to install Fabric, which version of Fabric to install and from where.

last_updated_version

This is the last version of the modpack where the Fabric version was changed. This value is used by the client to skip installing Fabric everytime a new modpack update is released.

install

If this value is set to false, Fabric installation, as well as profile creation/updating is skipped. This means just the file updating functionality of the Profile Manager will be active.

loader

This object has all the details on the Fabric Loader.

snapshot

Set this to true only if you are installing a snapshot version of the Fabric loader.

mc_version

The version of Minecraft for which you want to install the Fabric loader.

version

The version of the Fabric loader you want to install. latest is a supported value. However, this will almost certainly lead to different users having different Fabric Loader versions as it tends to update frequently, so we don't recommend using latest.

apis

This object describes all the different APIs used by the client to install Fabric. <mc_version> and <loader_version> are available as replaceable strings in the appropriate places.

fabric_loader_list

In addition to the api_endpoint (which supports <mc_version>), you have to provide a JSON path as a string (get_latest_version) to get the latest fabric loader version, if you are using latest in loader.version.

profile_json

api_endpoint is the only child of this object, and that points to the URL that provides the Fabric Loader version.json. Both <mc_version> and <loader_version> are available.

mojang_mc_version_list

The api_endpoint child object points to the Mojang provided version manifests file, or something similar.


Example:

"fabric": {
    "last_updated_version": 4,
    "install": true,
    "loader": {
        "snapshot": false,
        "mc_version": "1.17",
        "version": "0.11.6",
        "apis": {
            "fabric_loader_list": {
                "api_endpoint": "https://meta.fabricmc.net/v2/versions/loader/<mc_version>",
                "get_latest_version": "[0].loader.version"
            },
            "profile_json": {
                "api_endpoint": "https://meta.fabricmc.net/v2/versions/loader/<mc_version>/<loader_version>/profile/json"
            },
            "mojang_mc_version_list": {
                "api_endpoint": "https://launchermeta.mojang.com/mc/game/version_manifest.json"
            }
        }
    }
}

Optimizer Mods

This object has just two child objects:

last_updated_version

The most recent version in which the optimizer mods list was updated. It is very critical to ensure you keep this updated as it is used to know if the client should actually check if their optimizer mod is still supported or not.

options

This is the list of all supported optimizer mods. It is simply a string array, but think of each string as an ID. The language file in the client is used to provide localization for these strings.

Example:

"optimizer_mods": {
    "last_updated_version": 3,
    "options": ["caffeine_mc", "optifine"]
}

Complete Example

{
    "metadata": {
        "api_format_version": -3
    },
    "links": {
        "source_repo": "https://github.com/aitecraft/profile-manager",
        "skin_changer": "https://my_modpack.com/skins/",
        "website": "https://my_modpack.com/"
    },
    "latest_version": 6,
    "files_api_endpoint": "https://my_modpack.com/pm/api/files/index.json",
    "modrinth_api_endpoint": "https://api.modrinth.com/v2/",
    "curseforge_api_endpoint": "https://api.curse.tools/v1/cf/",
    "fabric": {
        "last_updated_version": 4,
        "install": true,
        "loader": {
            "snapshot": false,
            "mc_version": "1.17",
            "version": "0.11.6",
            "apis": {
                "fabric_loader_list": {
                    "api_endpoint": "https://meta.fabricmc.net/v2/versions/loader/<mc_version>",
                    "get_latest_version": "[0].loader.version"
                },
                "profile_json": {
                    "api_endpoint": "https://meta.fabricmc.net/v2/versions/loader/<mc_version>/<loader_version>/profile/json"
                },
                "mojang_mc_version_list": {
                    "api_endpoint": "https://launchermeta.mojang.com/mc/game/version_manifest.json"
                }
            }
        }
    },
    "optimizer_mods": {
        "last_updated_version": 3,
        "options": ["caffeine_mc", "optifine"]
    }
}

JWCC Support

As of version 0.7.0-beta or API format version -3, the API JSON can have comments & trailing commas in arrays and objects.