title: How to get the content of an Assignment in Sakai via REST
body: <p>In Sakai, I successfully get a Assignemnt via url: <code>http://xxx/direct/assignment/ASSIGNMENTID.xml</code>. However, in this entity, there is no detailed context (I mean, the teacher's instruction of assignment). There's only a content <code>contentReference</code> element in XML. </p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;contentReference&gt;/assignment/c/mercury/b0de53c7-09b6-4ba0-964b-cb0a9e5a028d&lt;/contentReference&gt;
  </code></pre>
  
  <p>When I followed this link, I got 404 Error:</p>
  
  <p>Attempted to access an entity URL path (/assignment/c/mercury/b0de53c7-09b6-4ba0-964b-cb0a9e5a028d) for an entity (/assignment/c) that does not exist</p>
  
  <p>I tried Google for API document on Sakai entity, but it turns out to be out dated (some url are wrong on my demo version of Sakai 2.9.3). Then I tried digging into the source code of Sakai. However, what I found is only a file on rsmart server:</p>
  
  <ul>
  <li><p>AssignmentEntityProvider.java :</p>
  
  <p><a href="https://source.sakaiproject.org/websvn/filedetails.php?repname=sakai-svn&amp;path=%2Fmsub%2Frsmart.com%2Fassignment%2Ftrunk%2Fassignment-tool%2Ftool%2Fsrc%2Fjava%2Forg%2Fsakaiproject%2Fassignment%2Fentityproviders%2FAssignmentEntityProvider.java&amp;peg=131026">https://source.sakaiproject.org/websvn/filedetails.php?repname=sakai-svn&amp;path=%2Fmsub%2Frsmart.com%2Fassignment%2Ftrunk%2Fassignment-tool%2Ftool%2Fsrc%2Fjava%2Forg%2Fsakaiproject%2Fassignment%2Fentityproviders%2FAssignmentEntityProvider.java&amp;peg=131026</a></p></li>
  </ul>
  
  <p>In it I found:</p>
  
  <pre class="lang-java prettyprint-override"><code>        throw new IllegalArgumentException(
                  "Must include context and assignmentId in the path ("
                          + view
                          + "): e.g. /assignment/a/{context}/{assignmentId}");
  </code></pre>
  
  <p>I tried using this URL on my server to get the detailed content(especially the teacher's instruction). Still another 404 Error with the same content as above.</p>
  
  <p>At last, I found that the <code>/assignment/a/</code> might be a mis-spelling of <code>/assignment/annc/{context}/{assignmentId}</code>. So now I sent:</p>
  
  <pre><code>http://localhost:8080/direct/assignment/annc/mercury/403d28b4-e152-463d-a615-972db97d34d3.xml
  </code></pre>
  
  <p>Another error pop out:</p>
  
  <p>HTTP Status 500 - EntityEncodingException: Unable to handle output request for format xml for this path (/assignment/annc/mercury/403d28b4-e152-463d-a615-972db97d34d3.xml) for prefix (assignment) for entity (/assignment/annc), request url (/assignment/annc/mercury/403d28b4-e152-463d-a615-972db97d34d3.xml): Failure during internal output encoding of entity: /assignment/annc</p>
  
  <p>Any idea about the url to get the teacher's instruction data via RESTful? Thx.</p>
  
  <hr>
  
  <p>The XML data of an assignment.
  </p>
  
  <pre><code>&lt;assignment type='bean' size='29'&gt;
    &lt;access type='bean' size='0'&gt;
    &lt;/access&gt;
    &lt;attachments type='collection' size='1'&gt;
      &lt;decoratedattachment type='bean' size='2'&gt;
        &lt;name&gt;LC Circuit (show name).png&lt;/name&gt;
        &lt;url&gt;http://localhost:8080/access/content/attachment/mercury/%E4%BD%9C%E4%B8%9A/a11ef34a-0578-433a-ba7e-9c3bad948bf5/1111.png&lt;/url&gt;
      &lt;/decoratedattachment&gt;
    &lt;/attachments&gt;
    &lt;authorLastModified&gt;admin&lt;/authorLastModified&gt;
    &lt;authors type='collection' size='0'&gt;
    &lt;/authors&gt;
    &lt;closeTime type='bean' size='2'&gt;
      &lt;display&gt;2014-9-12 下午5:00&lt;/display&gt;
      &lt;time type='number'&gt;1410512400000&lt;/time&gt;
    &lt;/closeTime&gt;
    &lt;closeTimeString&gt;2014-9-12 下午5:00&lt;/closeTimeString&gt;
    &lt;content/&gt;
    &lt;contentReference&gt;/assignment/c/mercury/b0de53c7-09b6-4ba0-964b-cb0a9e5a028d&lt;/contentReference&gt;
    &lt;context&gt;mercury&lt;/context&gt;
    &lt;creator&gt;admin&lt;/creator&gt;
    &lt;dropDeadTime type='bean' size='2'&gt;
      &lt;display&gt;2014-8-12 下午5:00&lt;/display&gt;
      &lt;time type='number'&gt;1407834000000&lt;/time&gt;
    &lt;/dropDeadTime&gt;
    &lt;dropDeadTimeString&gt;2014-8-12 下午5:00&lt;/dropDeadTimeString&gt;
    &lt;dueTime type='bean' size='2'&gt;
      &lt;display&gt;2014-8-12 下午5:00&lt;/display&gt;
      &lt;time type='number'&gt;1407834000000&lt;/time&gt;
    &lt;/dueTime&gt;
    &lt;dueTimeString&gt;2014-8-12 下午5:00&lt;/dueTimeString&gt;
    &lt;groups type='collection' size='0'&gt;
    &lt;/groups&gt;
    &lt;id&gt;403d28b4-e152-463d-a615-972db97d34d3&lt;/id&gt;
    &lt;openTime type='bean' size='2'&gt;
      &lt;display&gt;2014-5-5 下午12:00&lt;/display&gt;
      &lt;time type='number'&gt;1399262400000&lt;/time&gt;
    &lt;/openTime&gt;
    &lt;openTimeString&gt;2014-5-5 下午12:00&lt;/openTimeString&gt;
    &lt;position_order type='number'&gt;0&lt;/position_order&gt;
    &lt;section&gt;&lt;/section&gt;
    &lt;status&gt;开始&lt;/status&gt;
    &lt;timeCreated type='bean' size='2'&gt;
      &lt;display&gt;2014-5-5 上午11:33&lt;/display&gt;
      &lt;time type='number'&gt;1399260782158&lt;/time&gt;
    &lt;/timeCreated&gt;
    &lt;timeLastModified type='bean' size='2'&gt;
      &lt;display&gt;2014-5-6 上午8:46&lt;/display&gt;
      &lt;time type='number'&gt;1399337194163&lt;/time&gt;
    &lt;/timeLastModified&gt;
    &lt;title&gt;A test assign&lt;/title&gt;
    &lt;draft type='boolean'&gt;false&lt;/draft&gt;
    &lt;entityReference&gt;/assignment/403d28b4-e152-463d-a615-972db97d34d3&lt;/entityReference&gt;
    &lt;entityURL&gt;http://localhost:8080/direct/assignment/403d28b4-e152-463d-a615-972db97d34d3&lt;/entityURL&gt;
    &lt;entityId&gt;403d28b4-e152-463d-a615-972db97d34d3&lt;/entityId&gt;
    &lt;entityTitle&gt;A test assign&lt;/entityTitle&gt;
  &lt;/assignment&gt;
  </code></pre>