2014-05-22 8 views
7

के माध्यम से साकाई में एक असाइनमेंट की सामग्री कैसे प्राप्त करें साकाई में, मुझे यूआरएल के माध्यम से सफलतापूर्वक एक Assignemnt मिलता है: http://xxx/direct/assignment/ASSIGNMENTID.xml। हालांकि, इस इकाई में, कोई विस्तृत संदर्भ नहीं है (मेरा मतलब है, शिक्षक के असाइनमेंट के निर्देश)। XML में केवल contentReference तत्व सामग्री है।आरईएसटी

<contentReference>/assignment/c/mercury/b0de53c7-09b6-4ba0-964b-cb0a9e5a028d</contentReference> 

जब मैं इस लिंक का पालन किया है, मैं 404 त्रुटि मिल गया:

एक इकाई के लिए एक इकाई URL पथ (/ काम/सी/पारा/b0de53c7-09b6-4ba0-964b-cb0a9e5a028d) तक पहुंचने का प्रयास (/ असाइनमेंट/सी) जो मौजूद नहीं है

मैंने साकाई इकाई पर एपीआई दस्तावेज़ के लिए Google की कोशिश की, लेकिन यह दिनांकित हो गया है (कुछ यूआरएल साकाई 2.9.3 के मेरे डेमो संस्करण पर गलत हैं)। तब मैंने साकाई के स्रोत कोड में खुदाई करने की कोशिश की।

इसमें मैंने पाया:

 throw new IllegalArgumentException(
       "Must include context and assignmentId in the path (" 
         + view 
         + "): e.g. /assignment/a/{context}/{assignmentId}"); 

मैंने कोशिश की लेकिन, क्या मैंने पाया केवल rsmart सर्वर पर किसी फ़ाइल है विस्तृत सामग्री (विशेष रूप से शिक्षक के निर्देश) प्राप्त करने के लिए मेरे सर्वर पर इस यूआरएल का उपयोग करना। ऊपर की तरह एक ही सामग्री के साथ अभी भी एक और 404 त्रुटि।

आखिर में, मैंने पाया कि /assignment/a//assignment/annc/{context}/{assignmentId} की गलत वर्तनी हो सकती है। तो अब मैं भेजा:

http://localhost:8080/direct/assignment/annc/mercury/403d28b4-e152-463d-a615-972db97d34d3.xml 

एक और त्रुटि पॉप:

HTTP स्थिति 500 ​​- EntityEncodingException: इस पथ के लिए प्रारूप एक्सएमएल के लिए उत्पादन अनुरोध को पूरा करने में असमर्थ (/ काम/annc/पारा/403d28b4-e152- 463d-a615-972db97d34d3.xml) इकाई (/ असाइनमेंट/एनएनसी) के लिए उपसर्ग (असाइनमेंट) के लिए, url (/assignment/annc/mercury/403d28b4-e152-463d-a615-972db97d34d3.xml) का अनुरोध करें: आंतरिक आउटपुट एन्कोडिंग के दौरान विफलता इकाई का:/असाइनमेंट/एनएनसी

रीस्टफुल के माध्यम से शिक्षक के निर्देश डेटा प्राप्त करने के लिए यूआरएल के बारे में कोई विचार? धन्यवाद।


असाइनमेंट का एक्सएमएल डेटा।

<assignment type='bean' size='29'> 
    <access type='bean' size='0'> 
    </access> 
    <attachments type='collection' size='1'> 
    <decoratedattachment type='bean' size='2'> 
     <name>LC Circuit (show name).png</name> 
     <url>http://localhost:8080/access/content/attachment/mercury/%E4%BD%9C%E4%B8%9A/a11ef34a-0578-433a-ba7e-9c3bad948bf5/1111.png</url> 
    </decoratedattachment> 
    </attachments> 
    <authorLastModified>admin</authorLastModified> 
    <authors type='collection' size='0'> 
    </authors> 
    <closeTime type='bean' size='2'> 
    <display>2014-9-12 下午5:00</display> 
    <time type='number'>1410512400000</time> 
    </closeTime> 
    <closeTimeString>2014-9-12 下午5:00</closeTimeString> 
    <content/> 
    <contentReference>/assignment/c/mercury/b0de53c7-09b6-4ba0-964b-cb0a9e5a028d</contentReference> 
    <context>mercury</context> 
    <creator>admin</creator> 
    <dropDeadTime type='bean' size='2'> 
    <display>2014-8-12 下午5:00</display> 
    <time type='number'>1407834000000</time> 
    </dropDeadTime> 
    <dropDeadTimeString>2014-8-12 下午5:00</dropDeadTimeString> 
    <dueTime type='bean' size='2'> 
    <display>2014-8-12 下午5:00</display> 
    <time type='number'>1407834000000</time> 
    </dueTime> 
    <dueTimeString>2014-8-12 下午5:00</dueTimeString> 
    <groups type='collection' size='0'> 
    </groups> 
    <id>403d28b4-e152-463d-a615-972db97d34d3</id> 
    <openTime type='bean' size='2'> 
    <display>2014-5-5 下午12:00</display> 
    <time type='number'>1399262400000</time> 
    </openTime> 
    <openTimeString>2014-5-5 下午12:00</openTimeString> 
    <position_order type='number'>0</position_order> 
    <section></section> 
    <status>开始</status> 
    <timeCreated type='bean' size='2'> 
    <display>2014-5-5 上午11:33</display> 
    <time type='number'>1399260782158</time> 
    </timeCreated> 
    <timeLastModified type='bean' size='2'> 
    <display>2014-5-6 上午8:46</display> 
    <time type='number'>1399337194163</time> 
    </timeLastModified> 
    <title>A test assign</title> 
    <draft type='boolean'>false</draft> 
    <entityReference>/assignment/403d28b4-e152-463d-a615-972db97d34d3</entityReference> 
    <entityURL>http://localhost:8080/direct/assignment/403d28b4-e152-463d-a615-972db97d34d3</entityURL> 
    <entityId>403d28b4-e152-463d-a615-972db97d34d3</entityId> 
    <entityTitle>A test assign</entityTitle> 
</assignment> 
+0

क्षमा करें, आखिर में मैंने पाया कि यह मेरे असाइनमेंट की सामग्री के खराब प्रारूप के कारण होता है। – taper

उत्तर

7

नोट: आप एक पुराने संस्करण आप नई सुविधाओं मैन्युअल कि इस परियोजना केटाई (https://jira.sakaiproject.org/browse/SAK-23358) में जोड़ा गया था के कुछ जोड़ने की आवश्यकता होगी है, तो इस उत्तर सकई से 10 के लिए है।

साकाई 10 का उपयोग करना।एक्स रात सर्वर:

http://nightly2.sakaiproject.org:8081/portal 

और निम्नलिखित आईडी के साथ एक साइट:

61a1ebbd-e507-4ca3-8f88-65abca0803d9 

यह URL किसी पाठ्यक्रम में कार्य की एक सूची मिलेगी:

http://nightly2.sakaiproject.org:8081/direct/assignment/site/61a1ebbd-e507-4ca3-8f88-65abca0803d9.json 

(जो JSON रिटर्न नीचे दिखाया गया है)

{"entityPrefix": "assignment", "assignment_collection": [ 
{ 
    "access": { 
    }, 
    "attachments": [], 
    "authorLastModified": "admin", 
    "authors": [], 
    "closeTime": { 
    "display": "Jun 11, 2014 5:00 pm", 
    "time": 1402520400000 
    }, 
    "closeTimeString": "Jun 11, 2014 5:00 pm", 
    "content": null, 
    "contentReference": "\/assignment\/c\/61a1ebbd-e507-4ca3-8f88-65abca0803d9\/1fd9f025-2974-48d1-bcb5-ef47c4e89a30", 
    "context": "61a1ebbd-e507-4ca3-8f88-65abca0803d9", 
    "creator": "admin", 
    "dropDeadTime": { 
    "display": "Jun 11, 2014 5:00 pm", 
    "time": 1402520400000 
    }, 
    "dropDeadTimeString": "Jun 11, 2014 5:00 pm", 
    "dueTime": { 
    "display": "Jun 11, 2014 5:00 pm", 
    "time": 1402520400000 
    }, 
    "dueTimeString": "Jun 11, 2014 5:00 pm", 
    "groups": [], 
    "id": "8d96871c-8dcb-4963-b74a-f478dee53142", 
    "instructions": "<p>This is an assignment<\/p>", 
    "openTime": { 
    "display": "Jun 4, 2014 12:00 pm", 
    "time": 1401897600000 
    }, 
    "openTimeString": "Jun 4, 2014 12:00 pm", 
    "position_order": 0, 
    "section": "", 
    "status": "Open", 
    "timeCreated": { 
    "display": "Jun 4, 2014 11:30 pm", 
    "time": 1401939011264 
    }, 
    "timeLastModified": { 
    "display": "Jun 4, 2014 11:30 pm", 
    "time": 1401939011286 
    }, 
    "title": "AZ assignment", 
    "draft": false, 
    "entityReference": "\/assignment\/8d96871c-8dcb-4963-b74a-f478dee53142", 
    "entityURL": "http:\/\/nightly2.sakaiproject.org:8081\/direct\/assignment\/8d96871c-8dcb-4963-b74a-f478dee53142", 
    "entityId": "8d96871c-8dcb-4963-b74a-f478dee53142", 
    "entityTitle": "AZ assignment" 
} 
]} 

आप सूची में एक काम की आईडी प्राप्त कर सकते हैं कि और फिर तो जैसे एक भी कार्य के डेटा वापस (जो भी संभव अन्य तरीकों से प्राप्त करने के लिए है) से: जैसा कि नीचे दिखाया

http://nightly2.sakaiproject.org:8081/direct/assignment/item/8d96871c-8dcb-4963-b74a-f478dee53142.json 

(जो JSON रिटर्न)

{ 
    "access": { 
    }, 
    "attachments": [], 
    "authorLastModified": "admin", 
    "authors": [], 
    "closeTime": { 
    "display": "Jun 11, 2014 5:00 pm", 
    "time": 1402520400000 
    }, 
    "closeTimeString": "Jun 11, 2014 5:00 pm", 
    "content": null, 
    "contentReference": "\/assignment\/c\/61a1ebbd-e507-4ca3-8f88-65abca0803d9\/1fd9f025-2974-48d1-bcb5-ef47c4e89a30", 
    "context": "61a1ebbd-e507-4ca3-8f88-65abca0803d9", 
    "creator": "admin", 
    "dropDeadTime": { 
    "display": "Jun 11, 2014 5:00 pm", 
    "time": 1402520400000 
    }, 
    "dropDeadTimeString": "Jun 11, 2014 5:00 pm", 
    "dueTime": { 
    "display": "Jun 11, 2014 5:00 pm", 
    "time": 1402520400000 
    }, 
    "dueTimeString": "Jun 11, 2014 5:00 pm", 
    "groups": [], 
    "id": "8d96871c-8dcb-4963-b74a-f478dee53142", 
    "instructions": "<p>This is an assignment<\/p>", 
    "openTime": { 
    "display": "Jun 4, 2014 12:00 pm", 
    "time": 1401897600000 
    }, 
    "openTimeString": "Jun 4, 2014 12:00 pm", 
    "position_order": 0, 
    "section": "", 
    "status": "Open", 
    "timeCreated": { 
    "display": "Jun 4, 2014 11:30 pm", 
    "time": 1401939011264 
    }, 
    "timeLastModified": { 
    "display": "Jun 4, 2014 11:30 pm", 
    "time": 1401939011286 
    }, 
    "title": "AZ assignment", 
    "draft": false, 
    "entityReference": "\/assignment\/8d96871c-8dcb-4963-b74a-f478dee53142", 
    "entityURL": "http:\/\/nightly2.sakaiproject.org:8081\/direct\/assignment\/8d96871c-8dcb-4963-b74a-f478dee53142", 
    "entityId": "8d96871c-8dcb-4963-b74a-f478dee53142", 
    "entityTitle": "AZ assignment" 
} 
+0

धन्यवाद। यह गाइड के माध्यम से काफी है। – taper