syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Syncope > Calling RESTful services from CLI
Date Mon, 30 Apr 2012 14:21:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2042/9/3/_/styles/combined.css?spaceKey=SYNCOPE&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/SYNCOPE/Calling+RESTful+services+from+CLI">Calling
RESTful services from CLI</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~ilgrosso">Francesco
Chicchiricco</a>
    </h4>
        <br/>
                         <h4>Changes (1)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>{panel} <br></td></tr>
            <tr><td class="diff-changed-lines" >curl -u admin:password -o content.xml
<span class="diff-changed-words">http://localhost:9080/syncope/rest/configuration/dbexport<span
class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">.html</span></span>
<br></td></tr>
            <tr><td class="diff-unchanged" >{panel} <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="CallingRESTfulservicesfromCLI-Createauser"></a>Create
a user </h1>

<p>To create a user with the REST-interface using <a href="http://curl.haxx.se/"
class="external-link" rel="nofollow">curl</a> on the command line:</p>

<div class="panel" style="border-width: 1px;"><div class="panelContent">
<p> curl -u admin:password -H "Content-Type: application/json" --data @/tmp/newuser
<a href="http://localhost:9080/syncope/rest/user/create.json" class="external-link" rel="nofollow">http://localhost:9080/syncope/rest/user/create.json</a></p>
</div></div>

<p>Where:</p>
<ul>
	<li>/tmp/newuser is a file containing the definition of the user to create, see below</li>
	<li>admin:password is the username:password combination for accessing the core. (admin/password
is default)</li>
	<li>Syncope core runs on localhost:9080/syncope</li>
</ul>


<p>The file /tmp/newuser could look like this:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
 {
  <span class="code-quote">"id"</span>: <span class="code-quote">"0"</span>,
  <span class="code-quote">"username"</span>: <span class="code-quote">"myusername"</span>,
  <span class="code-quote">"password"</span>: <span class="code-quote">"test123"</span>,
  <span class="code-quote">"attributes"</span> : [
                { 
                        <span class="code-quote">"schema"</span>: <span class="code-quote">"userId"</span>,

                        <span class="code-quote">"values"</span>: [<span class="code-quote">"example1@example.com"</span>]
                },
                { 
                        <span class="code-quote">"schema"</span>: <span class="code-quote">"surname"</span>,

                        <span class="code-quote">"values"</span>: [<span class="code-quote">"My
Surname"</span>]
                }
        ]
 }
</pre>
</div></div>

<p>To link the user to an existing resource, include this in the root json hash:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
  <span class="code-quote">"resources"</span> : [
	<span class="code-quote">"ws-target-resource-1"</span>
	]
</pre>
</div></div>

<h1><a name="CallingRESTfulservicesfromCLI-Exportdatabasecontent"></a>Export
database content </h1>

<div class="panel" style="border-width: 1px;"><div class="panelContent">
<p>curl -u admin:password -o content.xml <a href="http://localhost:9080/syncope/rest/configuration/dbexport"
class="external-link" rel="nofollow">http://localhost:9080/syncope/rest/configuration/dbexport</a></p>
</div></div>

<h1><a name="CallingRESTfulservicesfromCLI-Changeconfigurationvalue"></a>Change
configuration value </h1>

<div class="panel" style="border-width: 1px;"><div class="panelContent">
<p> curl -u admin:password -H "Content-Type: application/json" \<br/>
 -d '{"key":"smtp.host","value":"smtp.ngi.it"}' <a href="http://localhost:9080/syncope/rest/configuration/update.json"
class="external-link" rel="nofollow">http://localhost:9080/syncope/rest/configuration/update.json</a></p>
</div></div>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/SYNCOPE/Calling+RESTful+services+from+CLI">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=27841551&revisedVersion=4&originalVersion=3">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/SYNCOPE/Calling+RESTful+services+from+CLI?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message