Wowpedia:How to edit API pages

The current policy is to separate different kinds of page categories somewhat, and add breadcrumbs to the top of the page to make navigation easier.


 * Don't let these guidelines stop you from creating a page just to add a quick comment about something useful or important that you've learned and want to share! If you just want to write a one-liner, by all means: do so. Just add Stub/API somewhere in the page so it's easier to find and fix later!
 * Please do not create blank stubs just to get rid of red links. We want the red links there to know that there's no point in clicking it!

Different types of pages
Below is a list of different types of pages, what boilerplates to use, and what page tags to use.

World of Warcraft API page
This page is a user-maintained list of Blizzard-provided functions. When adding and editing function links:


 * There are over one hundred duplicate listings of functions under more than one heading. Look out for unnecessary duplication.
 * Do not place a function under several headings unless you really feel it belongs there.
 * Mikk's API page management scripts can detect duplicates that have gone out of sync.
 * Basic link syntax:    →   DisableAddOn(index or addonname)
 * The api template may also be used:     →   (index or addonname)
 * If a brief description is feasible and not redundant, include it after a hyphen and end with a period:
 * (index or addonname) - Disable the specified AddOn for subsequent sessions.


 * Version or patch numbers should be used rather than simply "NEW!" (and preferably, "removed"). Remember, the page has to make sense a year from now, and beyond. The phrase "added in x.y[.z]" (where x.y.z or x.y is a patch number) is preferred. Use of lowercase keeps the emphasis on the separate description. Recommended formats:
 * Parenthetically after description: - Summons a random critter companion. (added in 3.3.3)
 * Italicized and separated from description by a double hyphen: - Summons a random critter companion. -- added in 3.3.3
 * For undocumented functions, simply in place of description: - added in 3.0.8
 * When an entire section was added in a certain patch, individual notes may be omitted in favor of a brief sentence to cover them all, for example the archaeology functions added in version 4.0.
 * Linking to the patch's WoWpedia page is optional here. Offsite links are unnecessary.
 * Use the proper prefix before a function when applicable. These are explained at the top of the page, and are simply all-caps words or abbreviations with a space before the function listing. Multiple prefixes are allowed, but some prefixes are mutually exclusive and only PROTECTED UI has been observed:
 * PROTECTED UI - Opens/closes the game menu. Triggers protected functions.

Regular API function pages
Global, honest-to-god APIs, e.g. &#x5b;UnitName&#x5d;, &#x5b;AcceptDuel&#x5d;, &#x5b;GetAddOnDependencies&#x5d;


 * Name the page.
 * Use Help:API Function articles as a basis for the page.
 * Place wowapi at the top of the page (the boilerplate already has it). Places the page in Category:API functions.

Event pages
Events dispatched through the script handler, e.g.

QUEST_AUTOCOMPLETE: questId
 * Name the page.
 * Use e.g.  at the top of the page, which places the page in Category:API events and subcategories of Category:API namespaces
 * Include a one-sentence description of the event, followed by its signature, using appropriate names for its arguments, e.g.
 * Then follow the format of format for the arguments, details, examples, patch changes and see also sections.

FrameXML function pages
These are the "UI" tagged functions, e.g. &#x5b;ChatFrame_AddChannel&#x5d;, &#x5b;ToggleBackpack&#x5d;


 * Name the page.
 * Use Help:API Function articles as a basis for the page.
 * Replace wowapi with FrameXML/FileWhereFunctionIsDefined.lua at the top of the page. Places the page in Category:FrameXML documentation.

Other FrameXML pages
For instance &#x5b;API AuctionFrameAuctions.duration&#x5d; et al.


 * Use framexml at the top of the page. Places the page in Category:FrameXML documentation.

Widget method pages

 * Name the page.
 * Document new methods and handlers introduced by a widget.
 * Use Help:Widget method articles as a basis for the page.
 * Place widgetmethod at the top of the page (the boilerplate already has it). Places the page in Category:Widget methods.

Data type pages

 * Name the page  (no prefix to make it easier to link)
 * Place wowapitype at the top of the page.
 * Not every argument deserves to be described as a stand-alone data type. E.g. if it's just a 1--n index that every novice hacker can grasp, chances are, it doesn't.

User-defined function pages

 * Name the page according to the function name without prefix, e.g. strfindt, or the logical function group, e.g. Table Helpers.
 * Place userfunc at the top of the page (the boilerplate already has it). Places the page in Category:User defined functions.

UI Technical Details pages

 * Place uitech at the top of the page. Places the page in Category:UI technical details.

Example API listing

 * SetMapZoom(continentIndex [, zoneIndex]) - Sets the current world map to a specific continent and optionally zone.
 * This function takes one or two arguments. The square brackets indicate that the second argument is optional.

Example of an UI Object (widget) method

 * LayoutFrame:SetAllPoints(frame or frameName) - Set all anchors to match edges of specified frame.
 * This example shows that the SetAllPoints function is called as a method function on a LayoutFrame object. The argument is either a frame, or a frame name (string).

Link Code Examples

 * Pages describing individual API functions are named on the form "API FunctionName" (with no argument information).


 * Pages describing individual widget methods are named on the form "API ObjectType FunctionName" (with no argument information).

Link Prefixes

 * PROTECTED - function exists, but is protected for Blizzard only code.
 * If the page exists, put version when it was protected at the top


 * REMOVED - indicates that the function has been removed from the API.
 * Removed functions should only be listed in Category:API functions/Removed
 * If the page exists, put version when it was removed at the top


 * UI - indicates that the function is provided by the FrameXML UI code, rather than the core API.
 * If the page exists, put FrameXML/FileNameWhereFunctionIs.lua at the top

Data and Argument Types
The API uses special values for some function arguments, the commonly used types are:

Category:API types has the full list. (Though if something there is not available here: please list it!)

Learning about undocumented functions
So, when you can't go to Wowpedia to learn how a WoW API works, what to do?


 * Look in FrameXML to learn how Blizzard themselves uses the API.


 * Ask yourself if the examples really cover everything you need to know:
 * What happens on failure? Does the function return nil or false? Does the error message mention the function signature?
 * That logical test you see, is the function returning 1 or true? It might make a difference to others.
 * Which parameters can be left as nil?


 * TEST your questions. Either by experimenting with the API in an AddOn of yours, or, perhaps easier, use /dump or an in-game Lua editor like WowLua, REHack or myDebug!
 * Please help the rest of us and type your findings into Wowpedia :-)

Someone else might have done the hard work without sharing already; if you have a bunch of AddOns installed, try searching in them to see if they use the API. It might tell you more.