Listing the Latest Submissions for an Activity

via the activity API: http://thaioptometrists.com/?ver=api/activities/latestSubmissions/

This accepts the Activity Page Path. This is the URL of the activity page on OpenLearning after "http://thaioptometrists.com/?ver=". (e.g. courses/MyCourse/Activities/FirstActivity)

GET parameters:

  • cohort=PATH_TO_COHORT Also known as a "Class", the cohort is a group of students who are enrolled together in a course. Each cohort has a representative page on OpenLearning (e.g. courses/MyCourse/Cohorts/FirstCohort). This path can be passed to the cohort parameter to specify that only the submissions for this particular class/cohort should be listed.
  • format=text By default, the output format is JSON. With format=text specified, the data will be displayed in an abbreviated form in plain text (see output example below).

POST parameters:

Does not support POST

Example using curl

curl -f -u "${USERNAME}:${PASSWORD}" "http://thaioptometrists.com/?ver=api/activities/latestSubmissions/${ACTIVITYPATH}"

This request will return a JSON object with a "submissions" field which lists data about each latest submission for this activity.

e.g.

{
    "submissions": [
        {
            "cohort": "path/to/cohort,
            "contributors": [
                "profile.name"
            ],
            "latestSubmittedSnapshotID": "snapshotID",
            "submissionPath": "content/uniqueID",
            "submittedBy": "profile.name",
            "timestamp": "iso-format timestamp"
        }
    ],
    "success": true
}

If format=text is specified, the output will instead have one submission per line, in the following format:

content/submissionPath1 profile.name1,profile.name2 isoformatTimestamp
content/submissionPath2 profile.name3,profile.name4 isoformatTimestamp

The first field (delimited by space) is the path to the submission artefact on OpenLearning, the second is a comma-separated list of contributors' profile names and the third field is a timestamp of when the submission was made (in ISO 8601 format).


Displaying and Downloading Submission Content

via the submission page API: http://thaioptometrists.com/?ver=api/submissions/page/

This accepts the Submission Artefact's Page Path. (e.g. content/xxx1234uniqueID)

GET parameters:

  • action=download Don't display JSON, just download the current submission artefact. This may be a .html file of the path, and image or file (if the submission type is image/file/audio), or it might be a zip archive of attached files (if the submission type is a file bundle). Note: this is likely to be a redirect response, to a download url. Make sure you are following redirects (-f option in curl).

POST parameters:

  • user=profile.name Act on behalf of a specific user (defaults to the logged in user)
  • action=submit Submit the user's work on their behalf (this will create a gradable submission from whatever state the submission artefact is currently in)

GET Example using curl

curl -f -u "${USERNAME}:${PASSWORD}" "http://thaioptometrists.com/?ver=api/submissions/page/${PAGEPATH}"

Example output in JSON:

{
    "submission": {
        "activityPath": "courses/SomeCourse/Activities/SomeActivity",
        "cohortPath": "courses/SomeCourse/Cohorts/FirstCohort",
        "content": {
            "downloadURL": "http://thaioptometrists.com/?ver=api/page/download/content/somePageID?revision=17",
            "metadata": {
                "key": "This may contain metadata stored by an interactive activity app, e.g. quiz data"
            },
            "pageHTML": "The HTML content of the submission page",
            "pagePath": "content/somePageID",
            "pageType": "content",
            "title": "Page Title for the Submission Page",
            "url": "http://thaioptometrists.com/?ver=content/somePageID?revision=17"
        },
        "contributors": [
            {
                "fullName": "Some User",
                "profileName": "some.user",
                "standardAvatar": "https://openlearning-cdn.s3.amazonaws.com/some-avatar-48.jpg",
                "standardAvatarPath": "some-avatar-48.jpg",
                "userId": "xxx1234someUniqueID"
            }
        ],
        "group": null,
        "isLatest": true,
        "isMarked": true,
        "isPrivate": false,
        "snapshotID": "snapshotID",
        "subPages": [],
        "submissionPath": "/content/somePageID",
        "timestamp": "2013-11-12T02:15:26.369Z"
    },
    "success": true
}

POST Example using curl

curl -f -u "${USERNAME}:${PASSWORD}" "http://thaioptometrists.com/?ver=api/submissions/page/${PAGEPATH}" -d "action=submit"

Example output in JSON:

{
    "snapshotID": "snapshotID",
    "submissionPath": "content/somePage",
    "success": true
}

Grading a Submission (and marking it as completed)

via the submission grade API: http://thaioptometrists.com/?ver=api/submissions/grade/

This accepts the path to a submission artefact (e.g. content/xxx1234uniqueID)

GET parameters:

None

POST parameters:

  • grade=42 Specify a numerical grade for this submission
  • isCompleted=true or isCompleted=false Specify whether or not this activity has been completed (will be checked off in the progress bar)
  • comments=urlencodedHTML Specify any assessor's comments that will be displayed as private feedback
  • assessor=profile.name Specify who is shown as the assessor (defaults to the logged in user)

POST Example using curl

curl -f -u "${USERNAME}:${PASSWORD}" "http://thaioptometrists.com/?ver=api/submissions/grade/${PAGEPATH}" -d "grade=100" -d "isCompleted=true" --data-urlencode "comments=Well Done"

If completed successfully, this will only output:

{ 'success': true }

Supplying an Exhibit for a Submission

via the submission exhibit API: http://thaioptometrists.com/?ver=api/submissions/exhibit/

This accepts the path to a submission artefact (e.g. content/xxx1234uniqueID) and allows the retrieval or creation of an exhibit (shown in the course gallery for this submission).

GET parameters:

None

POST parameters:

  • pageName=Exhibit Specify the name of the page (sub-page) which is used as an exhibit
  • pageHTML=content Specify the page HTML for the exhibit (urlencoded)
  • overwrite=true Overwrite an existing exhibit page

GET Example using curl

curl -f -u "${USERNAME}:${PASSWORD}" "http://thaioptometrists.com/?ver=api/submissions/exhibit/${PAGEPATH}"

POST Example using curl

(uses exhibit.html as the content)

curl -f -u "${USERNAME}:${PASSWORD}" "http://thaioptometrists.com/?ver=api/submissions/exhibit/${PAGEPATH}" --data-urlencode "pageName=Exhibit Page" --data-urlencode "pageHTML@exhibit.html"

Output format

{
    "exhibit": {
        "downloadURL": "http://thaioptometrists.com/?ver=api/page/download/content/xxx1234/Exhibit",
        "metadata": {},
        "pageHTML": "<pre>\nHello World!\n</pre>\n",
        "pagePath": "content/xxx1234/Exhibit",
        "pageType": "html",
        "title": "Exhibit Page",
        "url": "http://localhost:8000/content/xxx1234/Exhibit"
    },
    "exhibitPath": "content/xxx1234/Exhibit",
    "success": true
}

 

Uploading an Image as an Exhibit

An image can be uploaded using the Content-Type multipart/form-data. Using curl, this is the -F or --form argument:

curl -f -u "${USERNAME}:${PASSWORD}" "http://thaioptometrists.com/?ver=api/submissions/exhibit/${PAGEPATH}" -F "pageName=Exhibit Page" -F "image=@myImage.jpg"

The above POST arguments are supported,(e.g. -F "overwrite=true" can also be specified to update an existing exhibit)


Submission History (snapshots of previous submissions)

via the submission history API: http://thaioptometrists.com/?ver=api/submissions/history/

This accepts the path of a submission artefact page.

GET Example using curl

curl -f -u "${USERNAME}:${PASSWORD}" "http://thaioptometrists.com/?ver=api/submissions/history/${PAGEPATH}"

Output:

{
    "history": [
        {
            "activityName": "Submit To This Activity",
            "activityPath": "/courses/SomeCourse/Activities/SomeActivity",
            "snapshotID": "someSnapshotID",
            "timestamp": "2014-02-05T03:50:24.668Z"
        },

        ...

    ]
}

Snapshot data can then be retrieved via:

http://thaioptometrists.com/?ver=api/submissions/snapshot/${SNAPSHOTID}

This has the same output as api/submissions/page/ but it instead takes a snapshot ID.

Comments