Project

General

Profile

Xcapclient » History » Version 3

Adrian Georgescu, 10/26/2008 02:05 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 3 Adrian Georgescu
== Example for pres-rules ==
53 1 Adrian Georgescu
54 3 Adrian Georgescu
=== PUT ===
55
56 2 Adrian Georgescu
{{{
57
adigeo@ag-imac3:~$xcapclient -a alice PUT -i work/python-xcaplib/examples/pres-rules.xml 
58
put https://xcap.sipthor.net/xcap-root/pres-rules/users/sip:alice@example.com/index
59
201 Created
60
etag: "345ba7c1ce125b2ff2438c19b25b4077"
61
content-type: application/auth-policy+xml
62
}}}
63 1 Adrian Georgescu
64 2 Adrian Georgescu
65 3 Adrian Georgescu
=== GET ===
66 2 Adrian Georgescu
67
{{{
68
adigeo@ag-imac3:~$xcapclient -a alice --app pres-rules get 
69
get https://xcap.sipthor.net/xcap-root/pres-rules/users/sip:alice@example.com/index
70
etag: "345ba7c1ce125b2ff2438c19b25b4077"
71
content-type: application/auth-policy+xml
72
content-length: 939
73
<?xml version="1.0" encoding="UTF-8"?>
74
<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">
75
<rule id="pres_whitelist">
76
<conditions>
77
<identity>
78
<one id="sip:bob@example.com"/>
79
<one id="sip:alice@example.com"/>
80
<many domain="ag-projects.com">
81
</many>
82
</identity>
83
</conditions>
84
<actions>
85
<pr:sub-handling>allow</pr:sub-handling>
86
</actions>
87
<transformations>
88
<pr:provide-services>
89
<pr:all-services/>
90
</pr:provide-services>
91
<pr:provide-persons>
92
<pr:all-persons/>
93
</pr:provide-persons>
94
<pr:provide-devices>
95
<pr:all-devices/>
96
</pr:provide-devices>
97
<pr:provide-all-attributes/>
98
</transformations>
99
</rule>
100
<rule id="pres_blacklist">
101
<conditions>
102
<identity>
103
<one id="sip:40316600024@abc.com"/>
104
</identity>
105
</conditions>
106
<actions>
107
<pr:sub-handling>block</pr:sub-handling>
108
</actions>
109
<transformations/>
110
</rule>
111 1 Adrian Georgescu
</ruleset>
112 2 Adrian Georgescu
}}}
113
114 3 Adrian Georgescu
=== DELETE ===
115 2 Adrian Georgescu
116
{{{
117
adigeo@ag-imac3:~$xcapclient -a alice --app pres-rules DELETE
118 1 Adrian Georgescu
delete https://xcap.sipthor.net/xcap-root/pres-rules/users/sip:alice@example.com/index
119
200 OK
120
content-type: application/auth-policy+xml
121 3 Adrian Georgescu
}}}
122
123
124
== Resource-lists ==
125
126
=== PUT ===
127
128
{{{
129
adigeo@ag-imac3:~$xcapclient -a alice PUT -i work/python-xcaplib/examples/resource-lists.xml 
130
put https://xcap.sipthor.net/xcap-root/resource-lists/users/sip:alice@example.com/index
131
201 Created
132
etag: "f8c47352d61b5b256ee80d964e03efd6"
133
content-type: application/resource-lists+xml
134
}}}
135
136
=== GET ===
137
138
{{{
139
adigeo@ag-imac3:~$xcapclient -a alice --app resource-lists GET
140
get https://xcap.sipthor.net/xcap-root/resource-lists/users/sip:alice@example.com/index
141
etag: "f8c47352d61b5b256ee80d964e03efd6"
142
content-type: application/resource-lists+xml
143
content-length: 991
144
<?xml version="1.0" encoding="UTF-8"?>
145
   <resource-lists xmlns="urn:ietf:params:xml:ns:resource-lists"
146
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
147
    <list name="friends">
148
     <entry uri="sip:bill@example.com">
149
      <display-name>Bill Doe</display-name>
150
     </entry>
151
     <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"/>
152
     <list name="close-friends">
153
      <display-name>Close Friends</display-name>
154
      <entry uri="sip:joe@example.com">
155
       <display-name>Joe Smith</display-name>
156
      </entry>
157
      <entry uri="sip:nancy@example.com">
158
       <display-name>Nancy Gross</display-name>
159
      </entry>
160
      <external anchor="http://xcap.example.org/resource-lists/users/sip:a@example.org/index/~~/resource-lists/list%5b@name=%22mkting%22%5d">
161
        <display-name>Marketing</display-name>
162
       </external>
163
     </list>
164
    </list>
165
   </resource-lists>
166
}}}
167
168
=== DELETE ===
169
170
{{{
171
adigeo@ag-imac3:~$xcapclient -a alice --app resource-lists DELETE
172
delete https://xcap.sipthor.net/xcap-root/resource-lists/users/sip:alice@example.com/index
173
200 OK
174
content-type: application/resource-lists+xml
175
adigeo@ag-imac3:~$
176 1 Adrian Georgescu
}}}