IMS Candidate Final Draft

A REST API for Score Resources
in the application/vnd.ims.lis.v1.score+json Format

Candidate Final Draft
Date Issued: 30 March 2017
Latest version: http://www.imsglobal.org/lti

Abstract

This specification defines a REST API for reading, creating, updating and deleting Score resources.

Table of Contents

1. Introduction

This specification defines a REST API for reading, creating, updating and deleting Score resources. Following common conventions, the API uses a different HTTP verb for each type of operation: GET for read, POST for create, PUT for update and DELETE for delete

Implementations of this REST API may be incomplete; a given server might support only a subset of the HTTP verbs. A server that supports the complete API will expose two different kinds of endpoints: a container endpoint for receiving POST requests and item endpoints for manipulating individual instances. This specification document does not prescribe a method for discovering the endpoint URLs.

2. Score Representations

Score resources manipulated via this REST API are represented as JSON documents in the application/vnd.ims.lis.v1.score+json format. For detailed information about this media type, see [Score-media-type].

It is also possible to obtain a paginated list of Score resources from a ScoreContainer in the application/vnd.ims.lis.v1.scorecontainer+json format. For detailed information about this media type, see [ScoreContainer-media-type].

3. URL Templates

Implementations of this REST API must offer an endpoint for managing the contents of the ScoreContainer associated with each LineItem. This specification does not mandate any particular URL template for such endpoints, but the following template is recommended:
{+context}/lineitems/{itemId}/scores

where itemId is an identifier for a LineItem and context is the URL for the learning context with which that LineItem is associated.

For example, the URL for a ScoreContainer might look something like this:

https://lms.example.com/course/289376/lineitems/721508/scores 

Technically, clients never GET the ScoreContainer itself. Instead, they GET a paginated list of Score resources available from the container, where each Page has its own URL. This specification does not mandate any particular URL template for Pages, but it is recommended that implementations follow the conventions suggested by the W3C Linked Data Platform specification. According to these conventions, the first page would have a URL of the form

{+context}/lineitems/{itemId}/scores?firstPage
and subsequent pages would have URLs of the form
{+context}/lineitems/{itemId}/scores?p={pageNumber}
where pageNumber is the sequential number of the page or some key that uniquely identifies the page. For instance, these templates might yield the following URL values:
https://lms.example.com/course/289376/lineitems/721508/scores?firstPage 
https://lms.example.com/course/289376/lineitems/721508/scores?p=2 
https://lms.example.com/course/289376/lineitems/721508/scores?p=3 
https://lms.example.com/course/289376/lineitems/721508/scores?p=4 

Each individual Score must have its own URL. This specification does not mandate any particular URL template for individual Score resources, but the following template is recommended:

{+context}/lineitems/{itemId}/scores/{userId}
where userId is an identifier for the LISPerson as provided by the Tool Consumer.

The server (either ToolConsumer or Tool) must declare in the service_offered section of its profile RestServices for Score and ScoreContainer resources. The server MUST NOT declare a RestService for the various Pages of the container.

4. Service Methods

4.1 POST

To create a new Score instance within the server, a client submits an HTTP POST request to the server's Score container endpoint in accordance with the following rules:

 

Request Header NameValue
Content-Typeapplication/vnd.ims.lis.v1.score+json
AuthorizationAuthorization parameters dictated by the LTI web service security profile
Table 1.  Required HTTP Headers for POST Request

 

Table 2 describes the possible responses from the POST method.

HTTP Status Description
201 Created The request has succeeded.

The response contains a small JSON document that provides the endpoint URI for the newly created Score resource. This JSON document must conform to the application/vnd.ims.lis.v1.score+json format. The Content-Type header of the response will be set to this media type.

400 Bad Request The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.
401 Unauthorized The client did not authenticate properly.
403 Forbidden The request was valid but the server is refusing to allow it at this time.
500 Internal Service Error The server encountered an unexpected condition which prevented it from fulfilling the request.
Table 2.  Possible responses from a POST method

4.2 GET

To get a representation of a particular Score instance, the client submits an HTTP GET request to the resource's REST endpoint, in accordance with the following rules:

 

Request Header NameValue
AuthorizationAuthorization parameters dictated by the LTI web service security profile
Acceptapplication/vnd.ims.lis.v1.score+json
Table 3.  Required HTTP Headers for GET Request

 

Table 4 describes the possible responses from the GET method.

HTTP Status Description
200 OK The request was successful.

The response contains a JSON document in the format defined by the application/vnd.ims.lis.v1.score+json media type.

301 Moved Permanently The URI for the requested resource has changed.

In this case, the response body is empty, and the new URI is provided in the Location header. The client should GET the resource from the new location, and furthermore, it should send all future requests to the new location as well.

307 Temporary Redirect The requested resource resides temporarily under a different URI.

In this case, the response body is empty, and the temporary URI is defined by the Location header field. The client should GET the resource at the temporary URI, but future requests should continue to be sent to the original URI.

401 Unauthorized The client did not authenticate properly.
404 Not Found The server has not found anything matching the request URI.
500 Internal Service Error The server encountered an unexpected condition which prevented it from fulfilling the request.
Table 4.  Possible responses from a GET method

4.3 GET from a ScoreContainer

To get a paginated list of Score resources from a ScoreContainer, the client submits an HTTP GET request to the container endpoint in accordance with the following rules:

 

ParameterDescription
limitSpecifies the maximum number of items that should be delivered per page. This parameter is merely a hint. The server is not obligated to honor this limit and may at its own discretion choose a different value for the number of items per page. The value must be an integer greater than zero.
Table 5.  Query Parameters

 

Request Header NameValue
Content-Typeapplication/vnd.ims.lis.v1.scorecontainer+json
AuthorizationAuthorization parameters dictated by the LTI web service security profile
Table 6.  Required HTTP Headers for GET Request

 

Table 7 describes the possible responses from the GET method.

HTTP Status Description
200 OK

The request was successful.

The response body contains the first Page of Score resources in the format defined by the application/vnd.ims.lis.v1.scorecontainer+json media type. This Page has its own URL which is distinct from the URL of the ScoreContainer. The URL of the first Page is supplied in the Content-Location header.

Clients should be aware that a server may send a 303 redirect to the first Page (see below) instead of delivering this Page directly in the entity body. Likewise a server may send a 301 or 307 redirect.

301 Moved Permanently The URI for the requested resource has changed.

In this case, the response body is empty, and the new URI is provided in the Location header. The client should GET the resource from the new location, and furthermore, it should send all future requests to the new location as well.

303 See Other This status code signals that the ScoreContainer itself cannot be delivered in the response. Instead, the client may receive the first page from a paginated list of Score resources at the address specified by the Location header.
307 Temporary Redirect The requested resource resides temporarily under a different URI.

In this case, the response body is empty, and the temporary URI is defined by the Location header field. The client should GET the resource at the temporary URI, but future requests should continue to be sent to the original URI.

401 Unauthorized The client did not authenticate properly.
404 Not Found The server has not found anything matching the request URI.
500 Internal Service Error The server encountered an unexpected condition which prevented it from fulfilling the request.
Table 7.  Possible responses from a GET method

4.4 PUT

To update a particular Score instance, the client submits an HTTP PUT request to the resource's REST endpoint in accordance with the following rules:

The PUT request updates the entire Score instance.

Request Header NameValue
Content-Typeapplication/vnd.ims.lis.v1.score+json
AuthorizationAuthorization parameters dictated by the LTI web service security profile
Table 8.  Required HTTP Headers for PUT Request

 

Table 9 describes the possible responses from the PUT method.

HTTP Status Description
200 OK

The response has succeeded.

The entity body of the response contains a full description of the updated Score resource.

401 Unauthorized The client did not authenticate properly.
403 Forbidden The request was valid but the server is refusing to allow it at this time.
404 Not Found The server has not found anything matching the request URI.
500 Internal Service Error The server encountered an unexpected condition which prevented it from fulfilling the request.
Table 9.  Possible responses from a PUT method

4.5 DELETE

To delete a particular Score instance, the client submits an HTTP DELETE request to the resource's REST endpoint in accordance with the following rules:

 

Request Header NameValue
AuthorizationAuthorization parameters dictated by the LTI web service security profile
Table 10.  Required HTTP Headers for DELETE Request

 

Table 11 describes the possible responses from the DELETE method. In all cases, the response body is empty.

HTTP Status Description
200 OK The request was successful and the resource has been deleted.
401 Unauthorized The client did not authenticate properly.
403 Forbidden The request was valid but the server is refusing to allow it at this time.
404 Not Found The server has not found anything matching the request URI.
500 Internal Service Error The server encountered an unexpected condition which prevented it from fulfilling the request.
Table 11.  Possible responses from a DELETE method

5. References

[Score-media-type]
Stephen Vickers. Score JSON Binding in the application/vnd.ims.lis.v1.score+json format. IMS Candidate Final Draft. 30 March 2017.
[ScoreContainer-media-type]
Stephen Vickers. ScoreContainer JSON Binding in the application/vnd.ims.lis.v1.scorecontainer+json format. IMS Candidate Final Draft. 30 March 2017.

About this Document

Title: A REST API for Score Resources in the application/vnd.ims.lis.v1.score+json Format
Editor:Stephen Vickers (IMS Global)
Version: 2.0
Version Date: 30 March 2017
Release: Candidate Final Draft
Status: IMS Candidate Final Draft
Purpose: This document is made available for review and comment by the public community at large.

List of Contributors

The following list of individuals contributed to the authoring of this document:

Viktor HaagD2LCharles SeveranceUniversity of Michigan
Brad HumphreyInstructureJohn TibbettsVitalSource
Greg McFallPearsonClaude VervoortCengage
Bracken MosbackerInstructureStephen VickersIMS Global Learning Consortium
Padraig O'hiceadhaHoughton Mifflin HarcourtJim WalkoskiD2L