Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post API request #414

Open
zlepper opened this issue Jul 16, 2015 · 1 comment
Open

Post API request #414

zlepper opened this issue Jul 16, 2015 · 1 comment

Comments

@zlepper
Copy link
Contributor

zlepper commented Jul 16, 2015

Stuff that would be needed:

  • Updating the md5 of a specific mod
  • Adding an entirely new mod to solder
  • Get the id of a specific mod using info like the name
  • Check if a modversion already is on solder
  • Add a new modversion to solder
  • Create a new modpack
  • Create a new modpack build
  • Get a modpacks build id
  • Get a modversion id
  • Check if a modversion already is added to a build
  • Add a modversion to a build

That is all i'm using for solderhelper.
But otherwise pretty much everything that is possible to do through the MVC system, but as a web api instead.

Currently needed hax: https://github.com/zlepper/TechnicSolderHelper/blob/master/TechnicSolderHelper/SQL/SolderSQLHandler.cs

A bit more fleshed out

All of these would also be send with an authkey, to make sure the API consumer actually are allowed to make the changes.

For handling the modpacks

Create a modpack with POST request to /api/modpack with data:

{
    "name": "Modpack name",
    "slug": "modpack-slug"
}

Update the specified modpack slug with PUT request to /api/modpack/:slug with data:

{
    "name": "Modpack name"
}

Delete the specified modpack with a DELETE request to /api/modpack/:slug.

For handling the mods

Create a new mod with a POST request to /api/mod with data:

{
    "name": "It's the little things",
    "slug": "itlt",
    "author": "Zlepper",
    "description": "A mod about those little things you did not notice you missed",
    "url": "http://minecraft.curseforge.com/mc-mods/232791-its-the-little-things"
}

Here author, description and url can be empty or omitted and they won't be added to the database.
Name and slug is required and maps the pretty_name and name respectively // Btw, whos idea was it to call the slug the name, and the name for pretty_name?

Update an existing mod with a PUT request to /api/mod/:slug with data:

{
    "name": "It's the little things",
    "slug": "itlt",
    "author": "Zlepper",
    "description": "A mod about those little things you did not notice you missed",
    "url": "http://minecraft.curseforge.com/mc-mods/232791-its-the-little-things"
}

Create a new mod version with a POST request to /api/mod/:slug/:modversion with optional data:

{
    "md5":"INSERT MD5 VALUE HERE"
}

If data is omited or there is no md5 field, then solder with attempt to fetch the md5 value by downloading the mod and calculating it like it does now.
If data is there, then it will be inserted into the database without solder checking if it actually is equal to the remote.

Build management

Create a modpack build with POST request to /api/modpack/:slug/:build with data:

{
    "mcversion": "1.7.10",
    "min-java": "1.8",
    "min-memory": 2048,
    "clone": "1.4.5"
}

If "min-memory" is left empty or excluded, then there is no specified minimum memory.
If "clone" is left empty or exlucluded, then an empty build will be created, otherwise the new build will be cloned from the old. It is then up to the API consumer to remove the old mods to avoid having two of the same mods in the same build.

Add a modversion to a build with POST request to /api/modpack/:slug/:build/addmod with data:

{
    "slug": "itlt",
    "version": "1.7.10-0.0.3"
}

Modpackslug is in the url, build is in the url.
The "slug" in the request data is the slug of the mod to add, while "version" is the version.

@zlepper
Copy link
Contributor Author

zlepper commented Jul 22, 2015

I fleshed out a bit more how i imagine the post api might be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants