Skip to content

Using the Nameless API

partydragen edited this page Jul 18, 2017 · 5 revisions

Introduction

The Nameless API was added in version 1.0.11, and its current features are:

  • User registration
  • Obtaining information about a user
  • Setting a user's group
  • Submitting a report regarding a user

All calls to the Nameless API require an API key, which can be obtained in the AdminCP -> Minecraft tab, by clicking on "Settings" alongside the "Use Nameless Minecraft plugin" option.

Using the API

In order to use the API, the API key must be verified. This is done by passing the API key within the URL, as follows:

example_site.com/api/v1/API_KEY/action

where API_KEY is the API key used, and action is the specified action.

The available actions are as follows:

  • register - registers a user
  • get - retrieves information about a user
  • setGroup - sets a user's group
  • createReport - creates a report about a given user
  • getNotifications - Get number of unreaded alerts and messages a user has
  • updateUsername - update a players username

Actions

Data to be passed through to an action must be present in a POST request.

register

The register action will register a specified user. The required POST parameters are as follows:

  • username - the Minecraft username of the user
  • uuid - the Minecraft UUID of the user (must be unique)
  • email - the email address of the user (must be unique)

If there is an issue with the POST request, the API will display an error containing information about the issue. Otherwise, an email will be sent to the user, asking them to visit the website to complete registration.

get

The get action will retrieve information about a specified user. The required POST parameters are as follows:

Either

  • username - the Minecraft username of the user
  • uuid - the Minecraft UUID of the user

You can obtain the information using the username or the UUID, and only one is necessary. The output is a JSON object containing:

  • username - the Minecraft username of the user
  • displayname - the custom displayname of the user on the website
  • uuid - the Minecraft UUID of the user
  • group_id - the numeric group ID of the user
  • registered - UNIX timestamp of when the user registered
  • banned - whether the user is banned from the website or not (either 1 or 0)
  • validated - whether the user has validated their account on the website or not (either 1 or 0)
  • reputation - the user's site reputation

setGroup

The setGroup action will set a specified user's group on the website. The required POST parameters are as follows:

  • username - the Minecraft username of the user
  • uuid - the Minecraft UUID of the user
  • group_id - the website group ID of the group to change the user to

It is not necessary for both the username and uuid fields to be present, and it is recommended that only the uuid field is used as Minecraft usernames can change, and the site may not have updated the username yet.

createReport

The createReport action will create a report about a given player. The required POST parameters are as follows:

  • reporter_uuid - the Minecraft UUID of the user creating the report
  • reported_uuid - the Minecraft UUID of the user being reported
  • reported_username - the Minecraft username of the user being reported
  • content - the reason for the report's creation

The method will return an error if the user creating the report has not yet registered on the website.

getNotifications

The getNotifications action will return the number of unread private messages and alerts a user has. The required POST parameters are as follows:

  • uuid - either the Minecraft UUID or username of the user

The method will return an error if the user does not exist on the website, otherwise it will return an object containing the number of unread private messages and alerts.

updateUsername

The updateUsername action will update a user's Minecraft username on the website. The required POST parameters are as follows:

  • id - either the Minecraft UUID or current website username (not the updated username) of the user
  • new_username - new username for the website user

The method will return an error if the user does not exist on the website.