Yupi Emulator REST API

Base URL: /api, Version: v1

Yupi Emulator is an open-source HH Emulator, being designed and writed in C#. Yupi will have a new ultimate feature, the Emulator REST API. You will know now for what this API is deserved and its intentions.

Reason

This API deserve to be a way of external commands communication with the Emulator. The intention it's that the Emulator Database (SQL) will not be editable by the end-user, or the developer. Since the Emulator is totally controlled with reactive datas and using an ORM way of service providing. The main intention of this API it's the ability of serve native commands to change any database table content, with a MVC engine provided by the Emulator, with an interaction system, able to handle those commands and decide with action need to be taken. As an example, editing a room, will make that a specific controller handle it, after the alteration of the data and abling to the room being reloaded (packets). In other way this API will serve RCON commands, like "broadcast", and such other commands.

Through the REST API you will be able to edit any data related to in-game things. Like Navigator, Catalogue, Furniture, Users, User Permissions, Groups, Bots, Pets and more. This API it's totally experimental, and being designed.

Server Facts

The HTTP Request will be handled by the REST Module of the Emulator. Every Actor of the system (Eg.: Users) will have a desired Controller module that will Handler a specific Interaction. In case of Users, the Handler will send a Composer to the Client updating user information. And send a message to REST Module like "Edited User Data Successfully" (converted to jSON with HTTP Codes). NHibernate will update the Models and send it back to Database through Transactions.

HTTP Codes

The REST API will follow HTTP codes, like {200, 404, 500, and others} and also it owns Response Codes, in HTTP Header.

Security

The server will be obrigatory using TLS connection. (HTTPS:// Wrapper). You can disable it in the Settings of the Emulator, but is not recommended. The Emulator will only answer Requests through a White List in the Emulator Settings. Also the Authentication will be made by a Token.

Token

The token will be a BASE64 + MCRYPT 24 Bit Length Shared Key. The Key will be stored in the Application (Like CMS) and in the Emulator. Futurely each application will have an own Token. The connection will be secure by TLS 1.2 + RC4 Encryption

Default request content-types: application/json
Default response content-types: application/json
Schemes: http

Summary

Tag: Check Token

Operation Description
GET /auth/{auth-token}

Tag: Create Token

Operation Description
POST /auth/{auth-token}

Tag: SSO Auth

Operation Description
GET /sso/{user-id}

Tag: Gather user Data

Operation Description
GET /user/{user-id}

Tag: Edit User

Operation Description
PUT /user/{user-id}

Tag: Create User

Operation Description
POST /user/{user-id}

Paths

GET /auth/{auth-token}

Tags: Check Token

Check if Token is Valid

auth-token

The Administractive Token

path string #/parameters/auth-token

Uses default content-types: application/json

200 OK

200 OK Created Token

message: string
auth-code: string
403 Forbidden

Invalid Token

message: string
404 Not Found

Token not Found

message: string

POST /auth/{auth-token}

Tags: Create Token

Create a new token providing Administrator Token

auth-token

The Administractive Token

path string #/parameters/auth-token

Uses default content-types: application/json

200 OK

200 OK Created Token

message: string
auth-code: string
403 Forbidden

Invalid Token

message: string

GET /sso/{user-id}

Tags: SSO Auth

Auth user in client to return SSO code

token

The Session Token Identifier

query string #/parameters/token
user-id

The user identifier number

path number #/parameters/user-id

Uses default content-types: application/json

200 OK

The SSO object

sso: string

GET /user/{user-id}

Tags: Gather user Data

Get User Data

token

The Session Token Identifier

query string #/parameters/token
user-id

The user identifier number

path number #/parameters/user-id

Uses default content-types: application/json

200 OK

User Data

user-id: number
user-name: string
user-look: string
user-rank: number
user-sex: string
403 Forbidden

Not Allowed (Invalid or Expired Token)

message: string
404 Not Found

Not Found (User not Found)

message: string

POST /user/{user-id}

Tags: Create User

Create a new User

Uses default content-types: application/json

The user sex parameter

user-name

The user name

query string
user-look

The user look

query string
user-rank

The user rank

query number
user-mail

The user Mail

query string
token

The Session Token Identifier

query string #/parameters/token
user-id

The user identifier number

path number #/parameters/user-id

Uses default content-types: application/json

200 OK

OK Response

message: string
user-id: number
402 Payment Required

User already exists

message: string
403 Forbidden

Not Allowed (Invalid or Expired Token)

message: string

PUT /user/{user-id}

Tags: Edit User

Edit user Data

Uses default content-types: application/json

The user sex parameter

user-name

The user name

query string
user-look

The user look

query string
user-rank

The user rank

query number
user-mail

The user Mail

query string
token

The Session Token Identifier

query string #/parameters/token
user-id

The user identifier number

path number #/parameters/user-id

Uses default content-types: application/json

200 OK

OK Response

message: string
403 Forbidden

Not Allowed (Invalid or Expired Token)

message: string
404 Not Found

Not Found (User not Found)

message: string

Parameter definitions

user-id user-id

The user identifier number

path number
token token

The Session Token Identifier

query string
auth-token auth-token

The Administractive Token

path string