Skip to content

NEM API Documentation

Dylan Page edited this page Aug 24, 2016 · 5 revisions

Welcome to the NEM-API documentation and wiki page!

NotEnoughMods is a metadata service that provides vital data on your favorite minecraft mods.. Its main goal is to provide a central place to gather and contribute data about a mod. Another goal is the ability to de-centralize the mod hosting experience, allow modders to host from wherever they like.

Documentation

Table of Contents:


Response & Errors

The API will always return an object based on its name like shown:

GET - /mod

{ "mod": .... }

Some example error responses are shown below:

Validation error when adding a mod

"id": "unprocessable_request",
"message": "The name field is required",

Mod not found

"id": "not_found",
"message": "Mod not found"

Tokens & Rate Limiting

Tokens

The Header used to authentication via token is X-NEM-Token

Example: curl -H "X-NEM-Token: 74Fse3zFbzzZH2M8ig0e"

Rate Limiting

The API has a rate limit in place to prevent abuse and maintain the stability of the API. These rate limits are set to 5 requests per minutes for unauthenticated users. Authenticated users are limited to 60 requests per minute.

The limits are presented to you via headers in the response as the following:

  • X-RateLimit-Limit - This describes the limit placed on you.
  • X-RateLimit-Remaining - This describes how many requests you have left before your limited
  • X-RateLimit-Reset - This represents the time when the oldest request will expire. The value is given in Unix epoch time.

As long as the RateLimit-Remaining count is above zero, you will be able to make additional requests.

If the RateLimit-Remaining reaches zero, subsequent requests will receive a 429 error code until the request reset has been reached. You can see the format of the response in the examples.


Minecraft Version

Retrieve a Minecraft Version

http://genpage.xyz/mcversion/{version}

Parameters:

  • version: string - The minecraft version you are looking for

Example: curl -H "X-NEM-Token: 74Fse3zFbzzZH2M8ig0e" genpage.xyz/mversion/1.7.10


Mod

Retrieve a Mod

http://genpage.xyz/mod/{modid}

Parameters:

  • modid: string - The modid of the mod you are looking for

Example: curl genpage.xyz/mod/foobar

Create a Mod

Parameters:

  • name: string - Required - The name of the mod
  • modid: string - Required - The modid of the mod
  • longurl: url - Required - The link to the mods homepage
  • shorturl: url - Deprecated
  • license: string
  • repo: url - Link to the mods codebase
  • description: string

Example: curl -H "X-NEM-Token: 74Fse3zFbzzZH2M8ig0e" --data "name=FooBar&modid=foobar&url=https://github.com" genpage.xyz/mod

Delete a Mod

You must be an admin to do this.

Parameters:

  • modid: string - The modid of the mod you are looking to delete

Example: curl -X DELETE -H "X-NEM-Token: 74Fse3zFbzzZH2M8ig0e" genpage.xyz/mod/foorbar

Link an Author to a Mod

Parameters:

  • modid: string - The modid of the mod you are looking to attach an author to
  • slug: string - The slug of the author you want to link to the Mod

Example: curl -X PUT -H "X-NEM-Token: 74Fse3zFbzzZH2M8ig0e" --data="slug=genpage" genpage.xyz/mod/foobar/author

Author

Get an Author

Parameters:

  • slug: string - The slug of the author

Example: curl -H "X-NEM-Token: 74Fse3zFbzzZH2M8ig0e" genpage.xyz/author/genpage

Create an Author

Parameters:

  • name: string - The name of the author you want to create

Example: curl -X POST -H "X-NEM-Token: 74Fse3zFbzzZH2M8ig0e" --data="name=genpage" genpage.xyz/author

Delete an Author

You must be an admin to do this.

Parameters:

  • slug: string - The slug of the author you want to delete

Example: curl -X DELETE -H "X-NEM-Token: 74Fse3zFbzzZH2M8ig0e" genpage.xyz/author/genpage