-
Notifications
You must be signed in to change notification settings - Fork 1
API Documentation
The goal is to provide a RESTful API utilizing HTTP methods as much as possible for basic operations. This page will be updated as the API becomes further defined.
Creates a learning content object and stores it in the LCR. NOTE: multi and inline are not yet supported.
Request Body: (content-type: application/json)
{
"title": "<string>", // required
"description" : "<string>", //optional,
"tags" : ["<string1>", "<string2>", ...] // optional
}Returns on success: (content-type: application/json)
HTTP Status Code 200 OK
{
"id" : "<string>", // the unique identifier for the new object
}Returns on failure: (content-type: application/json)
HTTP Status Code 400
{
"error" : "<string>", // the error message
}Fetches the metadata associated with a learning content object.
Parameters:
- id - the unique identifier for the learning content object the file is to be associated with.
Returns on success: (content-type: application/json)
HTTP Status Code 200 OK
{
"title": "<string>", // the title of the learning object
"description" : "<string>", // a short description (140 chars max) of the learning content,
"tags" : ["<string1>", "<string2>", ...], // tags describing the object
"resources" : [
{
"name" : "<string>",
"type" : "<string>",
"<url | file_id>" : "<string>"
},
... ]
}Returns on failure: (content-type: application/json)
HTTP Status Code 400 or 404 depending on failure
{
"error" : "<string>", // the error message
}Updates an existing learning content object.
Request Body: refer to /api/create/package for specification.
Returns on success:
HTTP Status Code 200 OK
Returns on failure: (content-type: application/json)
HTTP Status Code 400 or 404 depending on failure
{
"error" : "<string>", // the error message
}Deletes a learning package and all associated resources.
Parameters:
- id (required) - The id of the content object that is to be deleted
Returns on success:
HTTP Status Code 200 OK
Returns on failure: (content-type: application/json)
HTTP Status Code 400 or 404 depending on failure
{
"error" : "<string>", // the error message
}Adds a new file and associates it to an existing Learning Package.
Parameters:
- id (required) - the unique identifier for the learning package the file is to be associated with.
-
type (
file | locator, defaultfile) - the type of resource you are trying to create. - name - the desired name for the resource. Defaults to attached filename if type is file and the full URL if the type is url
-
multi (
true | false, defaultfalse) - whether the body contains more than one piece of content. Currently, batch resource creation will only support all files or all urls; in other words, you cannot use multi with a mix of urls and files.
Request Body:
For type file: the raw file data.
For type locator :
{
"url" : "<string>" // a valid URL
}Returns on success: (content-type: application/json)
HTTP Status Code 200 OK
{
"id" : "<string>", // the local identifier for the new resource
}Returns on failure: (content-type: application/json)
HTTP Status Code 400
{
"error" : "<string>", // the error message
}Additional Notes:
Though the design of this interface may seem odd at first, it actually provides a couple of advantages. First, by providing the metadata as part of the query string, we are able to both create the resource and provide basic metadata in a single request without requiring bodies containing multiple MIME types. Second, since we are wrapping the body of non-file requests (urls only for now) in json, it leaves us the ability to add additional metadata fields for new or existing types in the future.
Fetches a resource or its associated metadata.
Parameters:
- id - The learning package unique identifier.
- resourceNumber - the local resource identifier. Note that this is unique only to the package; it is not a globally unique identifier.
Returns:
The resource, according to the following rules:
- If the resource is a url, then a redirect will be performed to fetch the content of the requested resource (similar to how Google handles a clickthrough on a search results page). It is yet to be determined if the server will act as a proxy to the resource or whether it will issue some 300-variant status code to redirect the request, depending on the compatibility of expected consumer technologies.
- If the resource is a file, then return the file raw file data as stored in the repository.
Updates an existing resource or its associated metadata.
Parameters:
- id (required) - the unique identifier for the package whose resource is being updated.
- resourceNumber (required) - the local identifier for the resource you would like to update.
- name - the new desired name for the resource. Defaults to attached filename if type is file and the full URL if the type is url
Request Body:
For type file: the raw file data.
For type locator :
{
"url" : "<string>" // a valid URL
}Returns on success:
HTTP Status Code 200 OK
Returns on failure: (content-type: application/json)
HTTP Status Code 400 or 404 depending on failure
{
"error" : "<string>", // the error message
}Deletes a resource and disassociates it with its parent learning content object.
Parameters:
- id (required) - The id of the package whose resource is to be deleted
- resourceNumber (required) - the local identifier for the resource you want to delete Returns on success:
HTTP Status Code 200 OK
Returns on failure: (content-type: application/json)
HTTP Status Code 400 or 404 depending on failure
{
"error" : "<string>", // the error message
}