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