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