incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Sling > Using Curl with Sling
Date Fri, 22 Jan 2010 14:35:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=SLING&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><a href="http://cwiki.apache.org/confluence/display/SLING/Using+Curl+with+Sling">Using
Curl with Sling</a></h2>
     <h4>Page <b>edited</b> by             <a href="http://cwiki.apache.org/confluence/display/~ieb">Ian
Boston</a>
    </h4>
     
          <br/>
     <div class="notificationGreySide">
         <p>This is all about hacking around with a running Sling and just a curl on
the command line. It concentrates on the default servlets in Sling that provide json representations
of JCR nodes and properties and allow for POSTing with normal forms to update properties.</p>

<h5><a name="UsingCurlwithSling-GETtingajsonrepresentation%3A"></a>GETting
a json representation:</h5>

<ul>
	<li><tt>curl -s -u admin:admin <a href="http://localhost:8080/content/path/to/node.infinity.json"
rel="nofollow">http://localhost:8080/content/path/to/node.infinity.json</a></tt></li>
</ul>


<p>The "-s" means silent, ie. no download progress indicator displayed.</p>

<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/warning.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td><p>The Sling default servlet
may respond with a 300 and a json array containing the deepest level of recursion that is
possible, as infinity can return a lot of data on a large repository.</p></td></tr></table></div>

<h5><a name="UsingCurlwithSling-POSTing%3A"></a>POSTing:</h5>

<ul>
	<li>single value property:<br clear="all" />
<tt>curl -F "property=value" -u user:password <a href="http://localhost:8080/content/path/to/node"
rel="nofollow">http://localhost:8080/content/path/to/node</a></tt></li>
</ul>



<ul>
	<li>multi value propery:<br clear="all" />
<tt>curl -F "property=value1" -F "property=value2" -u user:password <a href="http://localhost:8080/content/path/to/node"
rel="nofollow">http://localhost:8080/content/path/to/node</a></tt></li>
</ul>


<p>Add parameter "-v" to see the HTTP headers in the console.</p>
     </div>
     <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>

       <a href="http://cwiki.apache.org/confluence/display/SLING/Using+Curl+with+Sling">View
Online</a>
       |
       <a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=89884&revisedVersion=4&originalVersion=3">View
Change</a>
              |
       <a href="http://cwiki.apache.org/confluence/display/SLING/Using+Curl+with+Sling?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message