Mod Updater API
Closed this issue · 1 comments
Is it possible to use this Mod Update checker with an API (for example in python)?
Is it possible to use this Mod Update checker with an API (for example in python)?
Hey @herowarriors0, this Mod Updater does not expose an API, but instead uses the official Modrinth API "Labrinth" to search for updates. If you want to create an update checker in Python, I suggest you to read the official Labrinth documentation.
Given that I can see your edit history, I will also reply to your previous question:
Hi! I don't know if it's possible, but I would love to use a python API to check for mod updates. I wanted to do it myself, but I can't really understand the Modrinth api haha. I was just wondering if you had any tips on how to do it, because I'm lost in the modrinth api documentation.
The Modrinth API is a openAPI 3.0 compliant API which you interact with using HTTP Calls. You should find a lot of videos on this topic e.g. YouTube - Working with APIs in Python. As Modrinth provides a openAPI specification, you could also use openapi-python-client to automatically create your client from the specification.
If you want to update a mod given a file, you need to call the following methods:
- Get version from hash with the hex encoded sha1 hash of the file content.
- (optional) Get a project using the project_id received from the preivous call to check whether the mod is available for the selected loader.
- List project's versions using the project_id and the version you want to update to. This call should return an array of files which you can sort by filename or date_published to get the latest update for the version.
Hope that helps!