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