Skip to content
nitsuga5124 edited this page Dec 31, 2020 · 4 revisions

POST - /upload

Uploads a mod.

Output

Content-Type: application/text

Returned Status

  • 200 The mod uploaded successfully.
  • 400 Sent too many files, or there's invalid data on the json.
  • 401 User bound to the token does not own the mod.

Multipart Form

  • Zip file

    • This file contains the files of the mod.
  • Json file

    • This file contains the metadata of the mod.

Minimum Required

{
  "name": "a_mod_name",
  "version": "0.0.1-alpha.0",
  "description": "this is some mod that idk, yes",
  "repository_git": "https://example.com/example.git"
}

"Everything" that can be uploaded

{
  "name": "a_mod_name",
  "version": "0.0.1-alpha.0",
  "description": "this is some mod that idk, yes",
  "repository_git": "https://example.com/example.git",
  "authors": ["<user [email protected]>"],
  "documentation": "https://docs.rs/",
  "readme": "# some text\n- oh wow\n-yeah",
  "homepage": "https://5124.mywire.org/",
  "license": "MPL-v2.0",
  "keywords": ["some", "poly", "mod"],
  "build_script": "#!/bin/bash\ndotnet build",
  "dependencies": [
    {
      "name": "testing",
      "version": "0.0.1-alpha.0"
    }
  ],
  "metadata": ["just testing"]
}

Example usage

  • curl -X POST http://5124.mywire.org:1232/api/upload -i -H 'Authorization: ...' --form "mod=@C:\\path\\to\\file.zip" --form "data=@C:\\path\\to\\data.json"
  • curl -X POST http://5124.mywire.org:1232/api/upload -i -H 'Authorization: ...' --form "mod=@/path/to/some/zip/file.zip" --form "data=@/path/to/data.json"