Naar inhoud springen

CampusSearch XML interface: verschil tussen versies

Uit CampusWiki
Verwijderde inhoud Toegevoegde inhoud
Geen bewerkingssamenvatting
Regel 20: Regel 20:
<campus_search>
<campus_search>
<result>
<result>
<rank>1</rank>
<rank>9</rank>
<netbios_name>stud186091.mobiel.utwente.nl</netbios_name>
<netbios_name>NZSERVER</netbios_name>
<ip>130.89.186.91</ip>
<ip>130.89.162.28</ip>
<type>directory</type>
<type>file</type>
<full_path>smb://130.89.186.91/Films2/Avi/Matrix Extra's - Roots of the Matrix</full_path>
<full_path>smb://130.89.162.28/Movies/IMDB top 30/30 - The Matrix/The Matrix [1].avi</full_path>
<dir>Films2/Avi</dir>
<dir>Movies/IMDB top 30/30 - The Matrix</dir>
<name>Matrix Extra's - Roots of the Matrix</name>
<name>The Matrix [1].avi</name>
<online>yes</online>
<online>no</online>
<size>1757528038</size>
<size>735412224</size>
<meta>
<imdb_url>http://imdb.com/title/tt0133093</imdb_url>
<imdb_rating>8.7</imdb_rating>
<imdb_year>1999</imdb_year>
</meta>
</result>
</result>
</campus_search>
</campus_search>

Versie van 13 sep 2009 12:07

Doe een GET request naar http://search.student.utwente.nl/api/search.

GET parameters

Deze parameters worden ondersteund (de waarden van de GET-parameters moeten URL-encoded zijn):

  • q: de zoek string, bijv. "The+Matrix" (verplicht).
  • page: paginanummer, elke 'pagina' heeft 30 resultaten, beginnend bij 0 (0-29), dan 1 (30-59), etc.
  • minsize: minimale grootte van de file/dir, bijv. 0.5M of 1G.
  • maxsize: maximale grootte van de file/dir, bijv. 0.5M of 1G.
  • dirsonly waarde 'yes' als je alleen op directories wilt zoeken.

Voorbeeld van XML uitvoer

Voorbeeld, zoeken naar directories genaamd "The Matrix", met minimale grootte 0.5G en maximale grootte 2G:

http://search.student.utwente.nl/api/search?q=the+matrix&page=0&minsize=0.5G&maxsize=2G&dirsonly=yes

Een deel van de XML die uit komt is als volgt:

<campus_search> 
	<result> 
		<rank>9</rank> 
		<netbios_name>NZSERVER</netbios_name> 
		<ip>130.89.162.28</ip> 
		<type>file</type> 
		<full_path>smb://130.89.162.28/Movies/IMDB top 30/30 - The Matrix/The Matrix [1].avi</full_path> 
		<dir>Movies/IMDB top 30/30 - The Matrix</dir> 
		<name>The Matrix [1].avi</name> 
		<online>no</online> 
		<size>735412224</size> 
		<meta> 
			<imdb_url>http://imdb.com/title/tt0133093</imdb_url> 
			<imdb_rating>8.7</imdb_rating> 
			<imdb_year>1999</imdb_year> 
		</meta> 
	</result> 
</campus_search> 

Foutmeldingen

Een foutmelding ziet er al volgt uit:

<campus_search> 
	<result> 
		<status>error</status> 
		<error_code>ERROR_SEARCH_NO_RESULTS</error_code> 
	</result> 
</campus_search> 

Element error_code kan een volgende waarden hebben: ERROR_SEARCH_NO_RESULTSof ERROR_SEARCH_INCORRECT_QUERY .