Naar inhoud springen

CampusSearch XML interface

Uit CampusWiki

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>1</rank> 
		<netbios_name>stud186091.mobiel.utwente.nl</netbios_name> 
		<ip>130.89.186.91</ip> 
		<type>directory</type> 
		<full_path>smb://130.89.186.91/Films2/Avi/Matrix Extra's - Roots of the Matrix</full_path> 
		<dir>Films2/Avi</dir> 
		<name>Matrix Extra's - Roots of the Matrix</name> 
		<online>yes</online> 
		<size>1757528038</size> 
	</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 .