Project

General

Profile

Xcapclient » History » Version 7

Adrian Georgescu, 10/26/2008 02:09 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 xcap-caps GET
55
get https://xcap.sipthor.net/xcap-root/xcap-caps/global/index
56
etag: "ab12efdd1aff88296deee1aa195b823e"
57
content-type: application/xcap-caps+xml
58
content-length: 826
59
<?xml version='1.0' encoding='UTF-8'?>
60
<xcap-caps xmlns='urn:ietf:params:xml:ns:xcap-caps'>
61
<auids>
62
<auid>watchers</auid>
63
<auid>org.openmobilealliance.pres-rules</auid>
64
<auid>rls-services</auid>
65
<auid>pidf-manipulation</auid>
66
<auid>xcap-caps</auid>
67
<auid>test-app</auid>
68
<auid>resource-lists</auid>
69
<auid>pres-rules</auid>
70
</auids>
71
<extensions>
72
</extensions>
73
<namespaces>
74
<namespace>http://openxcap.org/ns/watchers</namespace>
75
<namespace>urn:ietf:params:xml:ns:pres-rules</namespace>
76
<namespace>urn:ietf:params:xml:ns:rls-services</namespace>
77
<namespace>urn:ietf:params:xml:ns:pidf</namespace>
78
<namespace>urn:ietf:params:xml:ns:xcap-caps</namespace>
79
<namespace>test-app</namespace>
80
<namespace>urn:ietf:params:xml:ns:resource-lists</namespace>
81
<namespace>urn:ietf:params:xml:ns:pres-rules</namespace>
82
</namespaces>
83
</xcap-caps>
84
}}}
85
86 5 Adrian Georgescu
== Example for pres-rules XCAP document ==
87 1 Adrian Georgescu
88 3 Adrian Georgescu
=== PUT ===
89
90 2 Adrian Georgescu
{{{
91
adigeo@ag-imac3:~$xcapclient -a alice PUT -i work/python-xcaplib/examples/pres-rules.xml 
92
put https://xcap.sipthor.net/xcap-root/pres-rules/users/sip:alice@example.com/index
93
201 Created
94
etag: "345ba7c1ce125b2ff2438c19b25b4077"
95
content-type: application/auth-policy+xml
96
}}}
97 1 Adrian Georgescu
98 2 Adrian Georgescu
99 3 Adrian Georgescu
=== GET ===
100 2 Adrian Georgescu
101
{{{
102
adigeo@ag-imac3:~$xcapclient -a alice --app pres-rules get 
103
get https://xcap.sipthor.net/xcap-root/pres-rules/users/sip:alice@example.com/index
104
etag: "345ba7c1ce125b2ff2438c19b25b4077"
105
content-type: application/auth-policy+xml
106
content-length: 939
107
<?xml version="1.0" encoding="UTF-8"?>
108
<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
<rule id="pres_whitelist">
110
<conditions>
111
<identity>
112
<one id="sip:bob@example.com"/>
113
<one id="sip:alice@example.com"/>
114
<many domain="ag-projects.com">
115
</many>
116
</identity>
117
</conditions>
118
<actions>
119
<pr:sub-handling>allow</pr:sub-handling>
120
</actions>
121
<transformations>
122
<pr:provide-services>
123
<pr:all-services/>
124
</pr:provide-services>
125
<pr:provide-persons>
126
<pr:all-persons/>
127
</pr:provide-persons>
128
<pr:provide-devices>
129
<pr:all-devices/>
130
</pr:provide-devices>
131
<pr:provide-all-attributes/>
132
</transformations>
133
</rule>
134
<rule id="pres_blacklist">
135
<conditions>
136
<identity>
137
<one id="sip:40316600024@abc.com"/>
138
</identity>
139
</conditions>
140
<actions>
141
<pr:sub-handling>block</pr:sub-handling>
142
</actions>
143
<transformations/>
144
</rule>
145 1 Adrian Georgescu
</ruleset>
146 2 Adrian Georgescu
}}}
147
148 3 Adrian Georgescu
=== DELETE ===
149 2 Adrian Georgescu
150
{{{
151
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
200 OK
154
content-type: application/auth-policy+xml
155 3 Adrian Georgescu
}}}
156
157
158 5 Adrian Georgescu
== Example for resource-lists XCAP document ==
159 3 Adrian Georgescu
160
=== PUT ===
161
162
{{{
163
adigeo@ag-imac3:~$xcapclient -a alice PUT -i work/python-xcaplib/examples/resource-lists.xml 
164
put https://xcap.sipthor.net/xcap-root/resource-lists/users/sip:alice@example.com/index
165
201 Created
166
etag: "f8c47352d61b5b256ee80d964e03efd6"
167
content-type: application/resource-lists+xml
168
}}}
169
170
=== GET ===
171
172
{{{
173
adigeo@ag-imac3:~$xcapclient -a alice --app resource-lists GET
174
get https://xcap.sipthor.net/xcap-root/resource-lists/users/sip:alice@example.com/index
175
etag: "f8c47352d61b5b256ee80d964e03efd6"
176
content-type: application/resource-lists+xml
177
content-length: 991
178
<?xml version="1.0" encoding="UTF-8"?>
179
   <resource-lists xmlns="urn:ietf:params:xml:ns:resource-lists"
180
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
181
    <list name="friends">
182
     <entry uri="sip:bill@example.com">
183
      <display-name>Bill Doe</display-name>
184
     </entry>
185
     <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
     <list name="close-friends">
187
      <display-name>Close Friends</display-name>
188
      <entry uri="sip:joe@example.com">
189
       <display-name>Joe Smith</display-name>
190
      </entry>
191
      <entry uri="sip:nancy@example.com">
192
       <display-name>Nancy Gross</display-name>
193
      </entry>
194
      <external anchor="http://xcap.example.org/resource-lists/users/sip:a@example.org/index/~~/resource-lists/list%5b@name=%22mkting%22%5d">
195
        <display-name>Marketing</display-name>
196
       </external>
197
     </list>
198
    </list>
199
   </resource-lists>
200
}}}
201
202
=== DELETE ===
203
204
{{{
205
adigeo@ag-imac3:~$xcapclient -a alice --app resource-lists DELETE
206
delete https://xcap.sipthor.net/xcap-root/resource-lists/users/sip:alice@example.com/index
207
200 OK
208
content-type: application/resource-lists+xml
209
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
=== PUT ===
215
216
{{{
217
adigeo@ag-imac3:~$xcapclient -a alice PUT -i work/python-xcaplib/examples/rls-services.xml 
218
put https://xcap.sipthor.net/xcap-root/rls-services/users/sip:alice@example.com/index
219
201 Created
220
etag: "44f5fca1b08352815ee12f1a0c32d812"
221
content-type: application/rls-services+xml
222
}}}
223
224
=== GET ===
225
226
{{{
227
adigeo@ag-imac3:~$xcapclient -a alice --app rls-services GET
228
get https://xcap.sipthor.net/xcap-root/rls-services/users/sip:alice@example.com/index
229
etag: "44f5fca1b08352815ee12f1a0c32d812"
230
content-type: application/rls-services+xml
231
content-length: 797
232
<?xml version="1.0" encoding="UTF-8"?>
233
   <rls-services xmlns="urn:ietf:params:xml:ns:rls-services"
234
      xmlns:rl="urn:ietf:params:xml:ns:resource-lists"
235
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
236
    <service uri="sip:mybuddies@example.com">
237
     <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
     <packages>
239
      <package>presence</package>
240
     </packages>
241
    </service>
242
    <service uri="sip:marketing@example.com">
243
      <list name="marketing">
244
        <rl:entry uri="sip:joe@example.com"/>
245
        <rl:entry uri="sip:sudhir@example.com"/>
246
      </list>
247
      <packages>
248
        <package>presence</package>
249
      </packages>
250
    </service>
251
   </rls-services>
252
}}}
253
254
=== DELETE ===
255
256
{{{
257
adigeo@ag-imac3:~$xcapclient -a alice --app rls-services DELETE
258
delete https://xcap.sipthor.net/xcap-root/rls-services/users/sip:alice@example.com/index
259
200 OK
260
content-type: application/rls-services+xml
261
}}}