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