Fandom Developers Wiki
Register
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, which is what you may see being referred to as Nirvana API.

Entry points

/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.

All controllers have a help method defined, so listing all methods of a controller can be done through, for example, /wikia.php?controller=UserApi&method=help&format=json. Grabbing help in the JSON format is required, as other formats will throw an error. In the help, you may see that methods setOutputFieldType and setOutputFieldTypes are available, but these methods cannot be called meaningfully.

/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.

Some controllers, such as the WikisApiController, are only accessible from English Community Central.

Available controllers

There are many Nirvana controllers available, but few of them are properly documented. A few years ago, the easiest way to find them would have been to use the file search option in Fandom's legacy MediaWiki code repository and search for Controller.class.php. However, as Fandom's code repository is now private, you may not find newly introduced controllers in the legacy codebase and the old controllers may have changed their methods and input parameters.

If you are unsure about how a controller can be used, feel free to leave a message on Fandom Developers Wiki's API Discussion category, and other users who worked with Nirvana controllers in the past may be able to help you.

See also

Text above can be found here (edit)
Advertisement