Room 208

Wiki archive

This document describes how you can write bots that tie into the moeconomy. Or other apps, I suppose.

The Moeconomy

In a fit of poor ideas I have implemented a sorta RESTful API to unify the moeconomy. If you don’t know what the moeconomy is basically IllFlower had an idea and decided he hated it later and took it away. However, some of us remember and like to torture him with his bad ideas. Thus I’ve written a way to do that in a coherent fashion.

If you want to tie some kind of client into the API that needs write access give me a holler (memo or something) and tell me why. I’ll send you a key if I think it isn’t absolutely the worst thing to ever be imagined. If you just need read access then you don’t need a key. Feel free to do what you want with the reading.

API Calls

Action Description HTTP Method Key Required? URI
Get All Accounts Retrieve a JSON representation of all accounts. GET No http://www.redono.org/moeconomy/
Get User Account By ID Retrieve a JSON representation of an account by user ID. GET No http://www.redono.org/moeconomy/<id>
Get User Account Retrieve a JSON representation of a single user account. GET No http://www.redono.org/moeconomy/<nick>
Create User Account Create a new user account from JSON passed in. JSON structure should match the format retrieved from the single user account with the addition of a key value. PUT Yes http://www.redono.org/moeconomy/create/<nick>
Modify User Account Add moepoints, remove moepoints, add new aliases. JSON structure is the same as creating a new account. The alias array returned by this method will only include newly added aliases. PUT Yes http://www.redono.org/moeconomy/modify/<nick>
Get Economy Stats Retrieves a JSON object containing the number of accounts and the amount of moepoints in circulation GET No http://www.redono.org/moeconomy/stats
Delete User Account Deletes the account associated with the nick DELETE Yes http://www.redono.org/moeconomy/nick/<nick>
Delete Alias Deletes alias DELETE Yes http://www.redono.org/moeconomy/alias/<alias>

JSON Participant Format

Each object has four fields: “id”, “nick”, “moepoints”, and “aliases”. As per usual JSON, the order is irrelevant.

When an object is being PUT on the server, an additional field, “key”, must be added, containing the API key (a string).

Example retrieved object:

{"id": 1, "nick":"IllFlower","moepoints":1000,"aliases":[]}

Example uploaded object:

{"key":api_key_here,"nick":"IllFlower","moepoints":1000,"aliases":[]}

Example stat object:

{"accounts":6,"moepoints":6002,"aliases":4}

Possible Responses

HTTP Response Code Body Returned By
200 Okay Returns JSON depending on the request Any excluding create
201 Created Returns JSON depending on the request Create
204 No Content N/A DELETE
400 Bad Request N/A PUT, DELETE
403 Forbidden N/A PUT, DELETE
404 Not Found N/A Any
409 Conflict Returns JSON body containing a description of the error and any additional information. ({“error”:“<string>”, […]}) Any PUT
500 Internal Server Error N/A Any

Bots Implementing This

Bot Owner Read/Write
spacebar Nitya Yes/Yes

Feature Requests

Please only add requests for things to be added to the API here. This doesn’t include “let me buy bot commands” or things like that. Bother the bot owner for that shit.

Planned

Requested