62bd8221f7d48bf7dae43c17ffadaf50f9b21773
[pazpar2-moved-to-github.git] / PROTOCOL
1
2 Webservice requests are any that refer to filename "search.pz2". Arguments
3 are GET-style parameters. Argument 'command' is required and specifies
4 command.
5
6 Commands:
7
8 init
9
10 Initializes a session. Returns session ID to be used in subsequent requests. Example:
11
12 search.pz2?command=init
13
14 Response example:
15
16 <init>
17   <status>OK</status>
18   <session>2044502273</session>
19 </init>
20
21 ping
22
23 Keeps a session alive. An idle session will time out after one minute. The
24 ping command can be used to keep the session alive absent other activity. It
25 is suggested that any browser client have a simple alarm handler which
26 sends a ping every 50 seconds or so once a session has been initialized.
27
28 Example:
29
30 search.pz?command=ping&session=2044502273
31
32 Response example:
33
34 <ping>
35   <status>OK</status>
36 </ping>
37
38 search
39
40 Launches a search, parameters:
41
42 session
43 query
44
45 Example:
46
47 search.pz2?session=2044502273&command=search&query=computer
48
49 Response example:
50
51 <search>
52   <status>OK</status>
53 </search>
54
55 stat
56
57 Provides status of ongoing search. Parameters:
58
59 session
60
61 Example:
62
63 search.pz2?session=2044502273&command=stat
64
65 Output:
66
67 <stat>
68   <hits>7</hits>                   -- Total hitcount
69   <records>7</records>             -- Total number of records fetched
70   <clients>1</clients>             -- Total number of associated clients
71   <unconnected>0</unconnected>     -- Number of disconnected clients
72   <connecting>0</connecting>       -- Number of clients in connecting state
73   <initializing>0</initializing>   -- Number of clients initializing
74   <searching>0</searching>         -- ... searching
75   <presenting>0</presenting>       -- ... presenting
76   <idle>1</idle>                   -- ... idle (not doing anything)
77   <failed>0</failed>               -- ... Connection failed
78   <error>0</error>                 -- ... Error was produced somewhere
79 </stat>
80
81 show
82
83 Shows records retrieved
84
85 parameters:
86
87 session
88 start      -- 0-indexed!!
89 num        -- default=20
90
91 Example:
92
93 search.pz2?session=2044502273&command=show&start=0&num=2
94
95 Output:
96
97 <show>
98   <status>OK</status>
99   <merged>6</merged>
100   <total>7</total>
101   <start>0</start>
102   <num>2</num>
103   <hit>
104     <title>How to program a computer, by Jack Collins</title>
105     <count>2</count> <!-- Number of merged records -->
106   </hit>
107   <hit>
108     <title>
109   Computer processing of dynamic images from an Anger scintillation camera :
110   the proceedings of a workshop /
111     </title>
112   </hit>
113 </show>