Project

General

Profile

Xcapclient » History » Version 8

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