Xcapclient
Version 7 (Adrian Georgescu, 10/26/2008 02:09 pm)
1 | 1 | Adrian Georgescu | == xcapclient == |
---|---|---|---|
2 | 1 | Adrian Georgescu | |
3 | 1 | Adrian Georgescu | To use this script you must to have a valid [wiki:configuration_file configuration file]. |
4 | 1 | Adrian Georgescu | |
5 | 1 | Adrian Georgescu | |
6 | 1 | Adrian Georgescu | === Description === |
7 | 1 | Adrian Georgescu | |
8 | 2 | Adrian Georgescu | This client is part of python-xcaplib package provided by [http://openxcap.org OpenXCAP] server. If you have installed bash_completion.d/xcapclient you can use TAB completion to browse through the content of the XCAP server documents/nodes/atributes. For more information read the documentation that comes with the package. |
9 | 1 | Adrian Georgescu | |
10 | 1 | Adrian Georgescu | {{{ |
11 | 1 | Adrian Georgescu | adigeo@ag-imac3:~$xcapclient -h |
12 | 1 | Adrian Georgescu | |
13 | 1 | Adrian Georgescu | xcapclient: Client for managing full or partial XML documents on XCAP servers (RFC 4825) |
14 | 1 | Adrian Georgescu | xcapclient [OPTIONS] --app AUID ACTION [NODE-SELECTOR] |
15 | 1 | Adrian Georgescu | |
16 | 1 | Adrian Georgescu | ACTION is an operation to perform: get, replace, insert, put or delete. |
17 | 1 | Adrian Georgescu | Presence of NODE-SELECTOR indicates that action is to be performed on an |
18 | 1 | Adrian Georgescu | element or an attribute. |
19 | 1 | Adrian Georgescu | |
20 | 1 | Adrian Georgescu | Options: |
21 | 1 | Adrian Georgescu | -h, --help show this help message and exit |
22 | 1 | Adrian Georgescu | -a NAME, --account-name=NAME |
23 | 1 | Adrian Georgescu | the account name from which to read account settings. |
24 | 1 | Adrian Georgescu | Corresponds to section Account_NAME in the |
25 | 1 | Adrian Georgescu | configuration file. If not supplied, the section |
26 | 1 | Adrian Georgescu | [Account] will be read. |
27 | 1 | Adrian Georgescu | --show-config show options from the configuration file; use |
28 | 1 | Adrian Georgescu | together with --account-name |
29 | 1 | Adrian Georgescu | --xcap-root=XCAP_ROOT XCAP root, e.g. https://xcap.example.com/xcap-root |
30 | 1 | Adrian Georgescu | --sip-address=SIP_ADDRESS |
31 | 1 | Adrian Georgescu | SIP address of the user in the form username@domain |
32 | 1 | Adrian Georgescu | -p PASSWORD, --password=PASSWORD |
33 | 1 | Adrian Georgescu | password to use if authentication is required. If not |
34 | 1 | Adrian Georgescu | supplied will be asked interactively |
35 | 1 | Adrian Georgescu | --app=AUID Application Unique ID. There's no default value; |
36 | 1 | Adrian Georgescu | however, it may be guessed from NODE-SELECTOR or from |
37 | 1 | Adrian Georgescu | the input file. Known apps: watchers, pidf- |
38 | 1 | Adrian Georgescu | manipulation, rls-services, resource-lists, xcap- |
39 | 1 | Adrian Georgescu | caps, pres-rules, test-app |
40 | 1 | Adrian Georgescu | --filename=FILENAME |
41 | 1 | Adrian Georgescu | -c CONTEXT, --context=CONTEXT |
42 | 1 | Adrian Georgescu | document context, users or global; default is users |
43 | 1 | Adrian Georgescu | for everything except xcap-caps |
44 | 1 | Adrian Georgescu | --etag=ETAG perform a conditional operation |
45 | 1 | Adrian Georgescu | -i INPUT_FILENAME source file for the PUT request; default is <stdin> |
46 | 1 | Adrian Georgescu | -o OUTPUT_FILENAME output file for the body of the server response |
47 | 1 | Adrian Georgescu | (successful or not); default is <stdout> |
48 | 1 | Adrian Georgescu | -d, --dump print HTTP traffic to stderr |
49 | 2 | Adrian Georgescu | }}} |
50 | 2 | Adrian Georgescu | |
51 | 2 | Adrian Georgescu | |
52 | 6 | Adrian Georgescu | == Example for XCAP server capabilities (xcap-caps) == |
53 | 6 | Adrian Georgescu | {{{ |
54 | 6 | Adrian Georgescu | adigeo@ag-imac3:~$xcapclient -a alice --app xcap-caps GET |
55 | 6 | Adrian Georgescu | get https://xcap.sipthor.net/xcap-root/xcap-caps/global/index |
56 | 6 | Adrian Georgescu | etag: "ab12efdd1aff88296deee1aa195b823e" |
57 | 6 | Adrian Georgescu | content-type: application/xcap-caps+xml |
58 | 6 | Adrian Georgescu | content-length: 826 |
59 | 6 | Adrian Georgescu | <?xml version='1.0' encoding='UTF-8'?> |
60 | 6 | Adrian Georgescu | <xcap-caps xmlns='urn:ietf:params:xml:ns:xcap-caps'> |
61 | 6 | Adrian Georgescu | <auids> |
62 | 6 | Adrian Georgescu | <auid>watchers</auid> |
63 | 6 | Adrian Georgescu | <auid>org.openmobilealliance.pres-rules</auid> |
64 | 6 | Adrian Georgescu | <auid>rls-services</auid> |
65 | 6 | Adrian Georgescu | <auid>pidf-manipulation</auid> |
66 | 6 | Adrian Georgescu | <auid>xcap-caps</auid> |
67 | 6 | Adrian Georgescu | <auid>test-app</auid> |
68 | 6 | Adrian Georgescu | <auid>resource-lists</auid> |
69 | 6 | Adrian Georgescu | <auid>pres-rules</auid> |
70 | 6 | Adrian Georgescu | </auids> |
71 | 6 | Adrian Georgescu | <extensions> |
72 | 6 | Adrian Georgescu | </extensions> |
73 | 6 | Adrian Georgescu | <namespaces> |
74 | 6 | Adrian Georgescu | <namespace>http://openxcap.org/ns/watchers</namespace> |
75 | 6 | Adrian Georgescu | <namespace>urn:ietf:params:xml:ns:pres-rules</namespace> |
76 | 6 | Adrian Georgescu | <namespace>urn:ietf:params:xml:ns:rls-services</namespace> |
77 | 6 | Adrian Georgescu | <namespace>urn:ietf:params:xml:ns:pidf</namespace> |
78 | 6 | Adrian Georgescu | <namespace>urn:ietf:params:xml:ns:xcap-caps</namespace> |
79 | 6 | Adrian Georgescu | <namespace>test-app</namespace> |
80 | 6 | Adrian Georgescu | <namespace>urn:ietf:params:xml:ns:resource-lists</namespace> |
81 | 6 | Adrian Georgescu | <namespace>urn:ietf:params:xml:ns:pres-rules</namespace> |
82 | 6 | Adrian Georgescu | </namespaces> |
83 | 6 | Adrian Georgescu | </xcap-caps> |
84 | 6 | Adrian Georgescu | }}} |
85 | 6 | Adrian Georgescu | |
86 | 5 | Adrian Georgescu | == Example for pres-rules XCAP document == |
87 | 1 | Adrian Georgescu | |
88 | 3 | Adrian Georgescu | === PUT === |
89 | 3 | Adrian Georgescu | |
90 | 2 | Adrian Georgescu | {{{ |
91 | 2 | Adrian Georgescu | adigeo@ag-imac3:~$xcapclient -a alice PUT -i work/python-xcaplib/examples/pres-rules.xml |
92 | 2 | Adrian Georgescu | put https://xcap.sipthor.net/xcap-root/pres-rules/users/sip:alice@example.com/index |
93 | 2 | Adrian Georgescu | 201 Created |
94 | 2 | Adrian Georgescu | etag: "345ba7c1ce125b2ff2438c19b25b4077" |
95 | 2 | Adrian Georgescu | content-type: application/auth-policy+xml |
96 | 2 | Adrian Georgescu | }}} |
97 | 1 | Adrian Georgescu | |
98 | 2 | Adrian Georgescu | |
99 | 3 | Adrian Georgescu | === GET === |
100 | 2 | Adrian Georgescu | |
101 | 2 | Adrian Georgescu | {{{ |
102 | 2 | Adrian Georgescu | adigeo@ag-imac3:~$xcapclient -a alice --app pres-rules get |
103 | 2 | Adrian Georgescu | get https://xcap.sipthor.net/xcap-root/pres-rules/users/sip:alice@example.com/index |
104 | 2 | Adrian Georgescu | etag: "345ba7c1ce125b2ff2438c19b25b4077" |
105 | 2 | Adrian Georgescu | content-type: application/auth-policy+xml |
106 | 2 | Adrian Georgescu | content-length: 939 |
107 | 2 | Adrian Georgescu | <?xml version="1.0" encoding="UTF-8"?> |
108 | 2 | Adrian Georgescu | <ruleset xmlns="urn:ietf:params:xml:ns:common-policy" xmlns:pr="urn:ietf:params:xml:ns:pres-rules" xmlns:cp="www.counterpath.com/privacy-lists"> |
109 | 2 | Adrian Georgescu | <rule id="pres_whitelist"> |
110 | 2 | Adrian Georgescu | <conditions> |
111 | 2 | Adrian Georgescu | <identity> |
112 | 2 | Adrian Georgescu | <one id="sip:bob@example.com"/> |
113 | 2 | Adrian Georgescu | <one id="sip:alice@example.com"/> |
114 | 2 | Adrian Georgescu | <many domain="ag-projects.com"> |
115 | 2 | Adrian Georgescu | </many> |
116 | 2 | Adrian Georgescu | </identity> |
117 | 2 | Adrian Georgescu | </conditions> |
118 | 2 | Adrian Georgescu | <actions> |
119 | 2 | Adrian Georgescu | <pr:sub-handling>allow</pr:sub-handling> |
120 | 2 | Adrian Georgescu | </actions> |
121 | 2 | Adrian Georgescu | <transformations> |
122 | 2 | Adrian Georgescu | <pr:provide-services> |
123 | 2 | Adrian Georgescu | <pr:all-services/> |
124 | 2 | Adrian Georgescu | </pr:provide-services> |
125 | 2 | Adrian Georgescu | <pr:provide-persons> |
126 | 2 | Adrian Georgescu | <pr:all-persons/> |
127 | 2 | Adrian Georgescu | </pr:provide-persons> |
128 | 2 | Adrian Georgescu | <pr:provide-devices> |
129 | 2 | Adrian Georgescu | <pr:all-devices/> |
130 | 2 | Adrian Georgescu | </pr:provide-devices> |
131 | 2 | Adrian Georgescu | <pr:provide-all-attributes/> |
132 | 2 | Adrian Georgescu | </transformations> |
133 | 2 | Adrian Georgescu | </rule> |
134 | 2 | Adrian Georgescu | <rule id="pres_blacklist"> |
135 | 2 | Adrian Georgescu | <conditions> |
136 | 2 | Adrian Georgescu | <identity> |
137 | 2 | Adrian Georgescu | <one id="sip:40316600024@abc.com"/> |
138 | 2 | Adrian Georgescu | </identity> |
139 | 2 | Adrian Georgescu | </conditions> |
140 | 2 | Adrian Georgescu | <actions> |
141 | 2 | Adrian Georgescu | <pr:sub-handling>block</pr:sub-handling> |
142 | 2 | Adrian Georgescu | </actions> |
143 | 2 | Adrian Georgescu | <transformations/> |
144 | 2 | Adrian Georgescu | </rule> |
145 | 1 | Adrian Georgescu | </ruleset> |
146 | 2 | Adrian Georgescu | }}} |
147 | 2 | Adrian Georgescu | |
148 | 3 | Adrian Georgescu | === DELETE === |
149 | 2 | Adrian Georgescu | |
150 | 2 | Adrian Georgescu | {{{ |
151 | 2 | Adrian Georgescu | adigeo@ag-imac3:~$xcapclient -a alice --app pres-rules DELETE |
152 | 1 | Adrian Georgescu | delete https://xcap.sipthor.net/xcap-root/pres-rules/users/sip:alice@example.com/index |
153 | 1 | Adrian Georgescu | 200 OK |
154 | 1 | Adrian Georgescu | content-type: application/auth-policy+xml |
155 | 3 | Adrian Georgescu | }}} |
156 | 3 | Adrian Georgescu | |
157 | 3 | Adrian Georgescu | |
158 | 5 | Adrian Georgescu | == Example for resource-lists XCAP document == |
159 | 3 | Adrian Georgescu | |
160 | 3 | Adrian Georgescu | === PUT === |
161 | 3 | Adrian Georgescu | |
162 | 3 | Adrian Georgescu | {{{ |
163 | 3 | Adrian Georgescu | adigeo@ag-imac3:~$xcapclient -a alice PUT -i work/python-xcaplib/examples/resource-lists.xml |
164 | 3 | Adrian Georgescu | put https://xcap.sipthor.net/xcap-root/resource-lists/users/sip:alice@example.com/index |
165 | 3 | Adrian Georgescu | 201 Created |
166 | 3 | Adrian Georgescu | etag: "f8c47352d61b5b256ee80d964e03efd6" |
167 | 3 | Adrian Georgescu | content-type: application/resource-lists+xml |
168 | 3 | Adrian Georgescu | }}} |
169 | 3 | Adrian Georgescu | |
170 | 3 | Adrian Georgescu | === GET === |
171 | 3 | Adrian Georgescu | |
172 | 3 | Adrian Georgescu | {{{ |
173 | 3 | Adrian Georgescu | adigeo@ag-imac3:~$xcapclient -a alice --app resource-lists GET |
174 | 3 | Adrian Georgescu | get https://xcap.sipthor.net/xcap-root/resource-lists/users/sip:alice@example.com/index |
175 | 3 | Adrian Georgescu | etag: "f8c47352d61b5b256ee80d964e03efd6" |
176 | 3 | Adrian Georgescu | content-type: application/resource-lists+xml |
177 | 3 | Adrian Georgescu | content-length: 991 |
178 | 3 | Adrian Georgescu | <?xml version="1.0" encoding="UTF-8"?> |
179 | 3 | Adrian Georgescu | <resource-lists xmlns="urn:ietf:params:xml:ns:resource-lists" |
180 | 3 | Adrian Georgescu | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
181 | 3 | Adrian Georgescu | <list name="friends"> |
182 | 3 | Adrian Georgescu | <entry uri="sip:bill@example.com"> |
183 | 3 | Adrian Georgescu | <display-name>Bill Doe</display-name> |
184 | 3 | Adrian Georgescu | </entry> |
185 | 3 | Adrian Georgescu | <entry-ref ref="resource-lists/users/sip:bill@example.com/index/~~/resource-lists/list%5b@name=%22list1%22%5d/entry%5b@uri=%22sip:petri@example.com%22%5d"/> |
186 | 3 | Adrian Georgescu | <list name="close-friends"> |
187 | 3 | Adrian Georgescu | <display-name>Close Friends</display-name> |
188 | 3 | Adrian Georgescu | <entry uri="sip:joe@example.com"> |
189 | 3 | Adrian Georgescu | <display-name>Joe Smith</display-name> |
190 | 3 | Adrian Georgescu | </entry> |
191 | 3 | Adrian Georgescu | <entry uri="sip:nancy@example.com"> |
192 | 3 | Adrian Georgescu | <display-name>Nancy Gross</display-name> |
193 | 3 | Adrian Georgescu | </entry> |
194 | 3 | Adrian Georgescu | <external anchor="http://xcap.example.org/resource-lists/users/sip:a@example.org/index/~~/resource-lists/list%5b@name=%22mkting%22%5d"> |
195 | 3 | Adrian Georgescu | <display-name>Marketing</display-name> |
196 | 3 | Adrian Georgescu | </external> |
197 | 3 | Adrian Georgescu | </list> |
198 | 3 | Adrian Georgescu | </list> |
199 | 3 | Adrian Georgescu | </resource-lists> |
200 | 3 | Adrian Georgescu | }}} |
201 | 3 | Adrian Georgescu | |
202 | 3 | Adrian Georgescu | === DELETE === |
203 | 3 | Adrian Georgescu | |
204 | 3 | Adrian Georgescu | {{{ |
205 | 3 | Adrian Georgescu | adigeo@ag-imac3:~$xcapclient -a alice --app resource-lists DELETE |
206 | 3 | Adrian Georgescu | delete https://xcap.sipthor.net/xcap-root/resource-lists/users/sip:alice@example.com/index |
207 | 3 | Adrian Georgescu | 200 OK |
208 | 3 | Adrian Georgescu | content-type: application/resource-lists+xml |
209 | 3 | Adrian Georgescu | adigeo@ag-imac3:~$ |
210 | 1 | Adrian Georgescu | }}} |
211 | 4 | Adrian Georgescu | |
212 | 5 | Adrian Georgescu | == Example for rls-services XCAP document == |
213 | 4 | Adrian Georgescu | |
214 | 4 | Adrian Georgescu | === PUT === |
215 | 4 | Adrian Georgescu | |
216 | 4 | Adrian Georgescu | {{{ |
217 | 4 | Adrian Georgescu | adigeo@ag-imac3:~$xcapclient -a alice PUT -i work/python-xcaplib/examples/rls-services.xml |
218 | 4 | Adrian Georgescu | put https://xcap.sipthor.net/xcap-root/rls-services/users/sip:alice@example.com/index |
219 | 4 | Adrian Georgescu | 201 Created |
220 | 4 | Adrian Georgescu | etag: "44f5fca1b08352815ee12f1a0c32d812" |
221 | 4 | Adrian Georgescu | content-type: application/rls-services+xml |
222 | 4 | Adrian Georgescu | }}} |
223 | 4 | Adrian Georgescu | |
224 | 4 | Adrian Georgescu | === GET === |
225 | 4 | Adrian Georgescu | |
226 | 4 | Adrian Georgescu | {{{ |
227 | 4 | Adrian Georgescu | adigeo@ag-imac3:~$xcapclient -a alice --app rls-services GET |
228 | 4 | Adrian Georgescu | get https://xcap.sipthor.net/xcap-root/rls-services/users/sip:alice@example.com/index |
229 | 4 | Adrian Georgescu | etag: "44f5fca1b08352815ee12f1a0c32d812" |
230 | 4 | Adrian Georgescu | content-type: application/rls-services+xml |
231 | 4 | Adrian Georgescu | content-length: 797 |
232 | 4 | Adrian Georgescu | <?xml version="1.0" encoding="UTF-8"?> |
233 | 4 | Adrian Georgescu | <rls-services xmlns="urn:ietf:params:xml:ns:rls-services" |
234 | 4 | Adrian Georgescu | xmlns:rl="urn:ietf:params:xml:ns:resource-lists" |
235 | 4 | Adrian Georgescu | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
236 | 4 | Adrian Georgescu | <service uri="sip:mybuddies@example.com"> |
237 | 4 | Adrian Georgescu | <resource-list>https://xcap.example.com/xcap-root/resource-lists/users/sip:alice@example.com/index/~~/resource-lists/list%5b@name=%22l1%22%5d</resource-list> |
238 | 4 | Adrian Georgescu | <packages> |
239 | 4 | Adrian Georgescu | <package>presence</package> |
240 | 4 | Adrian Georgescu | </packages> |
241 | 4 | Adrian Georgescu | </service> |
242 | 4 | Adrian Georgescu | <service uri="sip:marketing@example.com"> |
243 | 4 | Adrian Georgescu | <list name="marketing"> |
244 | 4 | Adrian Georgescu | <rl:entry uri="sip:joe@example.com"/> |
245 | 4 | Adrian Georgescu | <rl:entry uri="sip:sudhir@example.com"/> |
246 | 4 | Adrian Georgescu | </list> |
247 | 4 | Adrian Georgescu | <packages> |
248 | 4 | Adrian Georgescu | <package>presence</package> |
249 | 4 | Adrian Georgescu | </packages> |
250 | 4 | Adrian Georgescu | </service> |
251 | 4 | Adrian Georgescu | </rls-services> |
252 | 4 | Adrian Georgescu | }}} |
253 | 4 | Adrian Georgescu | |
254 | 4 | Adrian Georgescu | === DELETE === |
255 | 4 | Adrian Georgescu | |
256 | 4 | Adrian Georgescu | {{{ |
257 | 4 | Adrian Georgescu | adigeo@ag-imac3:~$xcapclient -a alice --app rls-services DELETE |
258 | 4 | Adrian Georgescu | delete https://xcap.sipthor.net/xcap-root/rls-services/users/sip:alice@example.com/index |
259 | 4 | Adrian Georgescu | 200 OK |
260 | 4 | Adrian Georgescu | content-type: application/rls-services+xml |
261 | 4 | Adrian Georgescu | }}} |