Dev:APIquery
Inhaltsverzeichnis
The Query Servlet
The servlet at /yacy/query.html performs mainly the purpose as a back-ping access point. When a peer-ping is done, the ping'ed peer tries to call this query servlet to explore if the pinging peer has an open server port.
Operations performed when the servlet is called
The server retries the requested information from the database. There is also a client network verification which is done by checking if the client has the necessary knowledge about the network position of the called peer. To prove this, the caller must know the called peers hash. This value must be passed in the 'youare' field.
Properties in the http header
The caller must obey the http header rules.
Properties in the http post-arguments
Calls to the servlet is made using a POST operation. The properties are:
-
youare=<the peer-hash of the called peer>
-
object=<name of the object that is queried>
, the possible values are:-
rwiurlcount
, the optional parameter 'env' must contain the rwi term hash -
rwicount
-
-
env=<optional parameter>
Result
The returned document contains a list of property lines. These properties are:
-
version=<YaCy version number of responding peer>
-
uptime=
- <code>mytime=<the local time of the responding peer in format yyyyMMddHHmmss></code>
- <code>response=<the response to the request></code>
Example Usage
When testing this feature against the own peer, the peer hash of the own peer must be known. This is easily retrieved by calling the /Network.xml servlet which provides the own peer hash in the 'hash' property. Consider your own peer hash is '2k7n3rHbdDTf', then an example url would be
http://localhost:8090/yacy/query.html?object=rwicount&youare=2k7n3rHbdDTf
which may return something like this:
version=0.1 uptime=1 response=29663 mytime=20131129004804