Xcapclient

Version 2 (Adrian Georgescu, 10/26/2008 02:02 pm)

1 1 Adrian Georgescu
== xcapclient ==
2 1 Adrian Georgescu
3 1 Adrian Georgescu
To use this script you must to have a valid [wiki:configuration_file configuration file].
4 1 Adrian Georgescu
5 1 Adrian Georgescu
6 1 Adrian Georgescu
=== Description ===
7 1 Adrian Georgescu
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 1 Adrian Georgescu
{{{
11 1 Adrian Georgescu
adigeo@ag-imac3:~$xcapclient -h
12 1 Adrian Georgescu
13 1 Adrian Georgescu
  xcapclient: Client for managing full or partial XML documents on XCAP servers (RFC 4825)
14 1 Adrian Georgescu
  xcapclient [OPTIONS] --app AUID ACTION [NODE-SELECTOR]
15 1 Adrian Georgescu
16 1 Adrian Georgescu
  ACTION is an operation to perform: get, replace, insert, put or delete.
17 1 Adrian Georgescu
  Presence of NODE-SELECTOR indicates that action is to be performed on an
18 1 Adrian Georgescu
  element or an attribute.
19 1 Adrian Georgescu
20 1 Adrian Georgescu
Options:
21 1 Adrian Georgescu
  -h, --help             show this help message and exit
22 1 Adrian Georgescu
  -a NAME, --account-name=NAME
23 1 Adrian Georgescu
                         the account name from which to read account settings.
24 1 Adrian Georgescu
                         Corresponds to section Account_NAME in the
25 1 Adrian Georgescu
                         configuration file. If not supplied, the section
26 1 Adrian Georgescu
                         [Account] will be read.
27 1 Adrian Georgescu
  --show-config          show options from the configuration file; use
28 1 Adrian Georgescu
                         together with --account-name
29 1 Adrian Georgescu
  --xcap-root=XCAP_ROOT  XCAP root, e.g. https://xcap.example.com/xcap-root
30 1 Adrian Georgescu
  --sip-address=SIP_ADDRESS
31 1 Adrian Georgescu
                         SIP address of the user in the form username@domain
32 1 Adrian Georgescu
  -p PASSWORD, --password=PASSWORD
33 1 Adrian Georgescu
                         password to use if authentication is required. If not
34 1 Adrian Georgescu
                         supplied will be asked interactively
35 1 Adrian Georgescu
  --app=AUID             Application Unique ID. There's no default value;
36 1 Adrian Georgescu
                         however, it may be guessed from NODE-SELECTOR or from
37 1 Adrian Georgescu
                         the input file. Known apps: watchers, pidf-
38 1 Adrian Georgescu
                         manipulation, rls-services, resource-lists, xcap-
39 1 Adrian Georgescu
                         caps, pres-rules, test-app
40 1 Adrian Georgescu
  --filename=FILENAME    
41 1 Adrian Georgescu
  -c CONTEXT, --context=CONTEXT
42 1 Adrian Georgescu
                         document context, users or global; default is users
43 1 Adrian Georgescu
                         for everything except xcap-caps
44 1 Adrian Georgescu
  --etag=ETAG            perform a conditional operation
45 1 Adrian Georgescu
  -i INPUT_FILENAME      source file for the PUT request; default is <stdin>
46 1 Adrian Georgescu
  -o OUTPUT_FILENAME     output file for the body of the server response
47 1 Adrian Georgescu
                         (successful or not); default is <stdout>
48 1 Adrian Georgescu
  -d, --dump             print HTTP traffic to stderr
49 2 Adrian Georgescu
}}}
50 2 Adrian Georgescu
51 2 Adrian Georgescu
52 2 Adrian Georgescu
== Example for PUT pres-rules ==
53 2 Adrian Georgescu
54 2 Adrian Georgescu
{{{
55 2 Adrian Georgescu
adigeo@ag-imac3:~$xcapclient -a alice PUT -i work/python-xcaplib/examples/pres-rules.xml 
56 2 Adrian Georgescu
put https://xcap.sipthor.net/xcap-root/pres-rules/users/sip:alice@example.com/index
57 2 Adrian Georgescu
201 Created
58 2 Adrian Georgescu
etag: "345ba7c1ce125b2ff2438c19b25b4077"
59 2 Adrian Georgescu
content-type: application/auth-policy+xml
60 2 Adrian Georgescu
}}}
61 2 Adrian Georgescu
62 2 Adrian Georgescu
63 2 Adrian Georgescu
== Example for GET pres-rules ==
64 2 Adrian Georgescu
65 2 Adrian Georgescu
{{{
66 2 Adrian Georgescu
adigeo@ag-imac3:~$xcapclient -a alice --app pres-rules get 
67 2 Adrian Georgescu
get https://xcap.sipthor.net/xcap-root/pres-rules/users/sip:alice@example.com/index
68 2 Adrian Georgescu
etag: "345ba7c1ce125b2ff2438c19b25b4077"
69 2 Adrian Georgescu
content-type: application/auth-policy+xml
70 2 Adrian Georgescu
content-length: 939
71 2 Adrian Georgescu
<?xml version="1.0" encoding="UTF-8"?>
72 2 Adrian Georgescu
<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 2 Adrian Georgescu
<rule id="pres_whitelist">
74 2 Adrian Georgescu
<conditions>
75 2 Adrian Georgescu
<identity>
76 2 Adrian Georgescu
<one id="sip:bob@example.com"/>
77 2 Adrian Georgescu
<one id="sip:alice@example.com"/>
78 2 Adrian Georgescu
<many domain="ag-projects.com">
79 2 Adrian Georgescu
</many>
80 2 Adrian Georgescu
</identity>
81 2 Adrian Georgescu
</conditions>
82 2 Adrian Georgescu
<actions>
83 2 Adrian Georgescu
<pr:sub-handling>allow</pr:sub-handling>
84 2 Adrian Georgescu
</actions>
85 2 Adrian Georgescu
<transformations>
86 2 Adrian Georgescu
<pr:provide-services>
87 2 Adrian Georgescu
<pr:all-services/>
88 2 Adrian Georgescu
</pr:provide-services>
89 2 Adrian Georgescu
<pr:provide-persons>
90 2 Adrian Georgescu
<pr:all-persons/>
91 2 Adrian Georgescu
</pr:provide-persons>
92 2 Adrian Georgescu
<pr:provide-devices>
93 2 Adrian Georgescu
<pr:all-devices/>
94 2 Adrian Georgescu
</pr:provide-devices>
95 2 Adrian Georgescu
<pr:provide-all-attributes/>
96 2 Adrian Georgescu
</transformations>
97 2 Adrian Georgescu
</rule>
98 2 Adrian Georgescu
<rule id="pres_blacklist">
99 2 Adrian Georgescu
<conditions>
100 2 Adrian Georgescu
<identity>
101 2 Adrian Georgescu
<one id="sip:40316600024@abc.com"/>
102 2 Adrian Georgescu
</identity>
103 2 Adrian Georgescu
</conditions>
104 2 Adrian Georgescu
<actions>
105 2 Adrian Georgescu
<pr:sub-handling>block</pr:sub-handling>
106 2 Adrian Georgescu
</actions>
107 2 Adrian Georgescu
<transformations/>
108 2 Adrian Georgescu
</rule>
109 2 Adrian Georgescu
</ruleset>
110 2 Adrian Georgescu
}}}
111 2 Adrian Georgescu
112 2 Adrian Georgescu
== Example for DELETE pres-rules ==
113 2 Adrian Georgescu
114 2 Adrian Georgescu
{{{
115 2 Adrian Georgescu
adigeo@ag-imac3:~$xcapclient -a alice --app pres-rules DELETE
116 2 Adrian Georgescu
delete https://xcap.sipthor.net/xcap-root/pres-rules/users/sip:alice@example.com/index
117 2 Adrian Georgescu
200 OK
118 2 Adrian Georgescu
content-type: application/auth-policy+xml
119 1 Adrian Georgescu
}}}