Web Service API
AContent Web Service API
Access AContent from remote applications through its web service API. This is version 0.1, dated Jun 2010.
AContent provides a search API that allows users to send search requests to AContent. AContent returns results in REST format. AContent also has an OAuth web service API for viewing, downloading, importing and exporting content from remote applications.
Table of Contents
Search request format
Below is a table of the parameters you can use to send a request to AContent to search through the repository by keywords. AContent returns the matching results in REST format.
(replace with the address of your own server if you want to call a private instance of AContent)
|id||The "Web Service ID" generated once successfully registering into AContent. This ID is a 32 characters long string. It can always be found on your "Profile" page.||None, must be given.|
|keywords||The keywords to search for.||None, must be given.|
|start||Start receiving from this record number||0. Optional|
|maxResults||Number of results to return.||10. Optional|
Sample search request
Goal: Search for keywords "atutor all". Return search results from record #10 and maximum 25 results returned.
Search response format
Success REST Response
A REST success response for the validation of a document (invalid) will look like this:
<?xml version="1.0" encoding="ISO-8859-1"?> <resultset> <summary> <numOfTotalResults>11</numOfTotalResults> <numOfResults>3</numOfResults> <lastResultNumber>3</lastResultNumber> </summary> <results> <result> <courseID>3</courseID> <title>another import - welcome to atutor11sdf</title> <description></description> <creationDate>2010-01-13 13:51:53</creationDate> </result> <result> <courseID>4</courseID> <title>an introduction to data and information</title> <description>this work is licensed under a creative commons attribution-noncommercial-sharealike 2.0 http://creativecommons.org/licenses/by-nc-sa/2.0/uk/</description> <creationDate>2010-01-13 13:52:07</creationDate> </result> <result> <courseID>7</courseID> <title>atutor howto 1.4.3</title> <description>documentation for students, instructors, and administrators.</description> <creationDate>2010-02-02 12:07:43</creationDate> </result> </results> </resultset>
<?xml version="1.0" encoding="ISO-8859-1"?> <errors> <totalCount>1</totalCount> <error code="401"> <message>Empty keywords</message> </error> </errors>
View course URLhttp://atutor.ca/acontent/demo/home/course/index.php?_course_id=10
_course_id is the "courseID" element returned in the REST search result
This URL leads to the first content page of the lesson.
Download course URLhttp://atutor.ca/acontent/demo/home/imscc/ims_export.php?course_id=10
course_id is the "courseID" element returned in the REST search result
This URL returns a zipped common cartridge of the lesson.
Import common cartridge or content package into AContent
An AContent user ID with author privilege is required for this action. If you don't have an AContent ID yet, register.
After an AContent user ID has been created, the first step is to go through the OAuth authentication process to get an OAuth access token. The authentication process prompts users to login with an AContent user ID, after which an access token is returned. This access token must be sent along with the import request as a user privilege check. The access token can be used repeatedly until its expiration. After the user is confirmed as an valid author, the common cartridge or content package is retrieved from the request "url" parameter and imported as a new AContent lesson. The ID of the newly-imported lesson is returned at success.http://atutor.ca/acontent/demo/home/ims/ims_import.php?oauth_token=xxx&url=xxx
oauth_token is the valid access token returned by an AContent OAuth server.
url points to a zip file of a common cartridge or a content package.
Refer to Importing Common Cartridges or Content Packages into AContent via OAuth for detailed request parameters and success/fail responses.