Fandom Developers Wiki
Advertisement

Nirvana is the name of Fandom's application framework. In the most basic sense, it consists of controllers and templates these controllers are rendering. Some controllers and their public methods can be accessed through /wikia.php or /api/v1 on every Fandom wiki.

Endpoints

/wikia.php

Script for accessing methods of any class extending WikiaController that allows external requests. Accepts two arguments as query string parameters:

  • controller — Controller to access. If the class name of the controller is SomethingController, this field accepts both Something and SomethingController in order to access it.
  • method — Public method to access. Defaults to index. Case-insensitive due to PHP method name case-insensitivity.
  • format — Can be set to json or html. Default is html, but methods with no templates associated just return data as JSON.

For example, /wikia.php?controller=UserApi&method=getUsersByName&query=KockaAdmiralac&format=json calls the getUsersByName method of the UserApi class and requests that the data is returned as JSON.

/api/v1

Can access only a subset of externally accessible controllers. Accessible controllers are those whose names end with ApiController with public method names starting with get. Always returns data as JSON. For example, /api/v1/Users/Details?ids=KockaAdmiralac accesses the getDetails method of the UserApiController class.

Controllers accessible through /api/v1 often have their parameters and responses documented on the same page, with their documentation auto-generated by Swagger. Some controllers, such as the WikisApiController, are only accessible from Community Central.

Available controllers

There are many Nirvana controllers available, but only a few of them are properly documented. The easiest way to find them is to use the file search option in Fandom's MediaWiki code repository and search for Controller.class.php. If you are unsure about how a controller can be used, feel free to leave a message on Fandom Developers Wiki's API Discussion board, and other users who worked with Nirvana controllers in past may be able to help you.

Definitions

These classes are used within the Nirvana framework.

WikiaApp
Wrapper for many common operations, such as hooks registration and getting access to global variables.
WikiaController
Wraps queries and data related logic into functions for the front end.
Can be accessed through /wikia.php or /api/v1 endpoints.
WikiaException
The exception class typically thrown by Nirvana controllers.
WikiaModel
Abstract class for other helper classes with methods for database access.
WikiaObject
Abstract class extended by non-controllers that still need framework variables.
WikiaRequest
An incomplete replacement for MediaWiki's WebRequest class.
WikiaResponse
Used for passing data between controllers and templates.
Any variables set in the response are in the JSON response of the controller.
WikiaService
Class for controllers that cannot be accessed externally.
WikiaSpecialPageController
Class for controllers used for controlling special page features.
WikiaView
Class representing a template.

See also

Advertisement