Difference between revisions of "User:TheY4Kman/Plug-in Search API"

From AlliedModders Wiki
Jump to: navigation, search
(How To Use It)
Line 1: Line 1:
 
'''WORK IN PROGRESS!'''
 
'''WORK IN PROGRESS!'''
 +
 
The plug-in search API exposes the plug-ins database through the JSON format.
 
The plug-in search API exposes the plug-ins database through the JSON format.
  
==How To Use It==
+
==How To Search==
Criteria for searching is specified in GET variables in the URL. For example, http://users.alliedmods.net/~they4kman/plugin_search.php?approved=yes&author=theY4Kman will retrieve all the plug-ins by theY4Kman.
+
Criteria for searching is specified in GET variables in the URL. For example, http://users.alliedmods.net/~they4kman/plugin_search.php?approved=yes&author=theY4Kman will retrieve all the plug-ins by theY4Kman. Here's the rest of the search criteria available:
 +
 
 +
*'''title''': the title of the plug-in, e.g. "Triggers"
 +
*'''author''': the username of the author, e.g. "theY4Kman"
 +
*'''description''': the description provided by the author
 +
*'''category''': the type of plug-in, e.g. "General Purpose", "All", "Administration", etc.
 +
*'''pluginid''': the ID of a plug-in ('''note''': this is NOT the thread ID)
 +
*'''postid''': the ID of the plug-in's thread ('''note''': this IS the thread ID)
 +
*'''authorid''': the forum user ID of the author
 +
*'''mod''': the short name of a mod. For example, "cstrike" to search for Counter-Strike: Source games.
 +
*'''approved''': whether the plug-in has been approved or not. '1', 'yes', and 'true' will filter out all non-approved plug-ins, whereas '0', 'no', and 'false' will filter out all approved plug-ins. Don't use this variable at all to see both approved and unapproved plug-ins.
 +
 
 +
All of the criteria (save for ''approved'') support MySQL wildcards. '''%''' (percent sign) will accept any range of text, and '''_''' (underscore) will accept one character. For example:
 +
<pre>http://users.alliedmods.net/~they4kman/plugin_search.php?approved=yes&title=sawce%rukia</pre>
 +
Will accept plug-in titles with any of these values:
 +
*sawce loves rukia
 +
*sawce is rukia
 +
*sawce LOOOVES rukia
 +
*sawcerukia
 +
*sawce and rukia
 +
 
 +
 
 +
<pre>http://users.alliedmods.net/~they4kman/plugin_search.php?approved=yes&title=sawce_</pre>
 +
Will accept any of these:
 +
*sawces
 +
*sawce!
 +
*sawce.
 +
 
 +
==Results==
 +
The query http://users.alliedmods.net/~they4kman/plugin_search.php?author=theY4Kman&title=Triggers will find theY4Kman's Triggers plug-in, which will result in the following output (whitespace added for human readability):
 +
<pre>[
 +
  {
 +
    "pluginid":"285",
 +
    "author":"theY4Kman",
 +
    "postid":"585758",
 +
    "title":"Triggers",
 +
    "category":"General Purpose",
 +
    "mod_url":"",
 +
    "description":"Adds commandlist.txt functionality (From Mani) to SourceMod",
 +
    "authorid":"28227",
 +
    "mod_short":"any",
 +
    "mod_full":"Any",
 +
    "approved":"1",
 +
    "dependencies":[]
 +
  }
 +
]</pre>
 +
 
 +
*'''pluginid''': the ID of the plug-in
 +
*'''author''': the username of the author
 +
*'''postid''': the thread ID of the plug-in. Use ''forums.alliedmods.net/showthread.php?t='''postid''''' to get the full URL to the thread.
 +
*'''title''': the title of the plug-in
 +
*'''category''': the type of plug-in
 +
*'''mod_url''': a link to the webpage for the mod this plug-in was built for. For example, if the plug-in was meant for Counter-Strike: Source, the ''mod_url'' will be "http://www.steamgames.com/v/index.php?area=game&AppId=240"
 +
*'''description''': self-explanitory
 +
*'''authorid''': the forum user ID of the author. Use ''forums.alliedmods.net/member.php?u='''authorid''''' to get the full URL of the author.
 +
*'''mod_short''': the short name of the mod this plug-in was built for. For example, if the plug-in was meant for Counter-Strike: Source, ''mod_short'' will be "cstrike"
 +
*'''mod_full''': the full name of the mod. For example, if the plug-in was meant for Counter-Strike: Source, ''mod_full'' will be "Counter-Strike: Source"
 +
*'''approved''': whether the plug-in was approved. '1' if it was, '0' if it wasn't.
 +
*'''dependencies''': this is a list of plug-in IDs that the plug-in depends on. At the time of writing, extension dependencies have not been implemented, and plug-in dependencies are rare, so this list is not very useful.

Revision as of 18:55, 14 March 2009

WORK IN PROGRESS!

The plug-in search API exposes the plug-ins database through the JSON format.

How To Search

Criteria for searching is specified in GET variables in the URL. For example, http://users.alliedmods.net/~they4kman/plugin_search.php?approved=yes&author=theY4Kman will retrieve all the plug-ins by theY4Kman. Here's the rest of the search criteria available:

  • title: the title of the plug-in, e.g. "Triggers"
  • author: the username of the author, e.g. "theY4Kman"
  • description: the description provided by the author
  • category: the type of plug-in, e.g. "General Purpose", "All", "Administration", etc.
  • pluginid: the ID of a plug-in (note: this is NOT the thread ID)
  • postid: the ID of the plug-in's thread (note: this IS the thread ID)
  • authorid: the forum user ID of the author
  • mod: the short name of a mod. For example, "cstrike" to search for Counter-Strike: Source games.
  • approved: whether the plug-in has been approved or not. '1', 'yes', and 'true' will filter out all non-approved plug-ins, whereas '0', 'no', and 'false' will filter out all approved plug-ins. Don't use this variable at all to see both approved and unapproved plug-ins.

All of the criteria (save for approved) support MySQL wildcards. % (percent sign) will accept any range of text, and _ (underscore) will accept one character. For example:

http://users.alliedmods.net/~they4kman/plugin_search.php?approved=yes&title=sawce%rukia

Will accept plug-in titles with any of these values:

  • sawce loves rukia
  • sawce is rukia
  • sawce LOOOVES rukia
  • sawcerukia
  • sawce and rukia


http://users.alliedmods.net/~they4kman/plugin_search.php?approved=yes&title=sawce_

Will accept any of these:

  • sawces
  • sawce!
  • sawce.

Results

The query http://users.alliedmods.net/~they4kman/plugin_search.php?author=theY4Kman&title=Triggers will find theY4Kman's Triggers plug-in, which will result in the following output (whitespace added for human readability):

[
  {
    "pluginid":"285",
    "author":"theY4Kman",
    "postid":"585758",
    "title":"Triggers",
    "category":"General Purpose",
    "mod_url":"",
    "description":"Adds commandlist.txt functionality (From Mani) to SourceMod",
    "authorid":"28227",
    "mod_short":"any",
    "mod_full":"Any",
    "approved":"1",
    "dependencies":[]
  }
]
  • pluginid: the ID of the plug-in
  • author: the username of the author
  • postid: the thread ID of the plug-in. Use forums.alliedmods.net/showthread.php?t=postid to get the full URL to the thread.
  • title: the title of the plug-in
  • category: the type of plug-in
  • mod_url: a link to the webpage for the mod this plug-in was built for. For example, if the plug-in was meant for Counter-Strike: Source, the mod_url will be "http://www.steamgames.com/v/index.php?area=game&AppId=240"
  • description: self-explanitory
  • authorid: the forum user ID of the author. Use forums.alliedmods.net/member.php?u=authorid to get the full URL of the author.
  • mod_short: the short name of the mod this plug-in was built for. For example, if the plug-in was meant for Counter-Strike: Source, mod_short will be "cstrike"
  • mod_full: the full name of the mod. For example, if the plug-in was meant for Counter-Strike: Source, mod_full will be "Counter-Strike: Source"
  • approved: whether the plug-in was approved. '1' if it was, '0' if it wasn't.
  • dependencies: this is a list of plug-in IDs that the plug-in depends on. At the time of writing, extension dependencies have not been implemented, and plug-in dependencies are rare, so this list is not very useful.