Project

General

Profile

Xcapclient » History » Version 2

Adrian Georgescu, 10/26/2008 02:02 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
== Example for PUT pres-rules ==
53
54
{{{
55
adigeo@ag-imac3:~$xcapclient -a alice PUT -i work/python-xcaplib/examples/pres-rules.xml 
56
put https://xcap.sipthor.net/xcap-root/pres-rules/users/sip:alice@example.com/index
57
201 Created
58
etag: "345ba7c1ce125b2ff2438c19b25b4077"
59
content-type: application/auth-policy+xml
60
}}}
61
62
63
== Example for GET pres-rules ==
64
65
{{{
66
adigeo@ag-imac3:~$xcapclient -a alice --app pres-rules get 
67
get https://xcap.sipthor.net/xcap-root/pres-rules/users/sip:alice@example.com/index
68
etag: "345ba7c1ce125b2ff2438c19b25b4077"
69
content-type: application/auth-policy+xml
70
content-length: 939
71
<?xml version="1.0" encoding="UTF-8"?>
72
<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">
73
<rule id="pres_whitelist">
74
<conditions>
75
<identity>
76
<one id="sip:bob@example.com"/>
77
<one id="sip:alice@example.com"/>
78
<many domain="ag-projects.com">
79
</many>
80
</identity>
81
</conditions>
82
<actions>
83
<pr:sub-handling>allow</pr:sub-handling>
84
</actions>
85
<transformations>
86
<pr:provide-services>
87
<pr:all-services/>
88
</pr:provide-services>
89
<pr:provide-persons>
90
<pr:all-persons/>
91
</pr:provide-persons>
92
<pr:provide-devices>
93
<pr:all-devices/>
94
</pr:provide-devices>
95
<pr:provide-all-attributes/>
96
</transformations>
97
</rule>
98
<rule id="pres_blacklist">
99
<conditions>
100
<identity>
101
<one id="sip:40316600024@abc.com"/>
102
</identity>
103
</conditions>
104
<actions>
105
<pr:sub-handling>block</pr:sub-handling>
106
</actions>
107
<transformations/>
108
</rule>
109
</ruleset>
110
}}}
111
112
== Example for DELETE pres-rules ==
113
114
{{{
115
adigeo@ag-imac3:~$xcapclient -a alice --app pres-rules DELETE
116
delete https://xcap.sipthor.net/xcap-root/pres-rules/users/sip:alice@example.com/index
117
200 OK
118
content-type: application/auth-policy+xml
119 1 Adrian Georgescu
}}}