A successful integration with iTunes U requires that you send the authorization token over SSL to iTunes U. To do this, send an https request with corresponding parameters, along with the authorization token, to an iTunes U URL. For example:
https://deimos.apple.com/WebObjects/Core.woa/Browsev2/Example.edu.42?credentials=Administrator%40urn%3Amace%3Aitunesu.com%3Asites%3Aexample.edu&identity=%22Jane+Doe%22+%3Cjanedoe%40example.edu%3E+%28jdoe%29+%5B42%5D&time=1147136717&signature=597c304e90fb62067c7e3fa57fe824e77997dd8aa96649366c5fc59104074744 |
Notes:
Due to URL length limitations, it is recommended that you never pass more than 100 credentials per session.
You can use one of the following iTunes U URLs:
https://deimos.apple.com/WebObjects/Core.woa/Browse/<site_name_string>
https://deimos.apple.com/WebObjects/Core.woa/Browsev2/<site_name_string>
Where <site_name_string> is your iTunes U site domain name. The difference between the two URLs is what happens in the browser after a user clicks on the link. Use the ‘Browse’ URL if you want to launch iTunes and leave the browser window displaying the iTunes U launch page. User the ‘Browsev2’ URL if you want to launch iTunes, temporarily display the iTunes U launch page, and return the browser window to the page where the link was clicked.
Review the following code example written in Java for an iTunes U transfer scheme implementation:
/**
* Send a request for an action to iTunes U with an authorization token.
*
* @param url URL defining how to communicate with iTunes U and
* identifying which iTunes U action to invoke and which
* iTunes U page or item to apply the action to. Such URLs have
* a format like <CODE>[PREFIX]/[ACTION]/[DESTINATION]</CODE>,
* where <CODE>[PREFIX]</CODE> is a value like
* "https://deimos.apple.com/WebObjects/Core.woa" which defines
* how to communicate with iTunes U, <CODE>[ACTION]</CODE> is
* a value like "Browse" which identifies which iTunes U action
* to invoke, and <CODE>[DESTINATION]</CODE> is a value like
* "example.edu" which identifies which iTunes U page or item to
* apply the action to. The destination string "example.edu"
* refers to the root page of the iTunes U site identified by
* the domain "example.edu". Destination strings for other items
* within that site contain the site domain followed by
* numbers separated by periods. For example:
* "example.edu.123.456.0789". You can find these strings in the
* items' URLs, which you can obtain from iTunes. See the
* iTunes U documentation for details.
* @param token Authorization token generated by getAuthorizationToken().
*
* @return The iTunes U response, which may be HTML or
* text depending on the type of action invoked.
*/
public String invokeAction(String url, String token) {
// Send a request to iTunes U and record the response.
StringBuffer response = null;
try {
// Verify that the communication will be over SSL.
if (!url.startsWith("https")) {
throw new MalformedURLException(
"ITunesU.invokeAction(): URL \""
+ url + "\" does not use HTTPS.");
}
// Create a connection to the requested iTunes U URL.
HttpURLConnection connection =
(HttpURLConnection)new URL(url).openConnection();
connection.setUseCaches(false);
connection.setDoOutput(true);
connection.setRequestMethod("POST");
connection.setRequestProperty(
"Content-Type",
"application/x-www-form-urlencoded; charset=UTF-8");
// Send the authorization token to iTunes U.
connection.connect();
OutputStream output = connection.getOutputStream();
output.write(token.getBytes("UTF-8"));
output.flush();
output.close();
// Read iTunes U's response.
response = new StringBuffer();
InputStream input = connection.getInputStream();
Reader reader = new InputStreamReader(input, "UTF-8");
reader = new BufferedReader(reader);
char[] buffer = new char[16 * 1024];
for (int n = 0; n >= 0;) {
n = reader.read(buffer, 0, buffer.length);
if (n > 0) response.append(buffer, 0, n);
}
// Clean up.
input.close();
connection.disconnect();
} catch (UnsupportedEncodingException e) {
// ITunes U requires UTF-8 and ASCII encoding support.
throw new java.lang.AssertionError(
"ITunesU.invokeAction(): UTF-8 encoding not supported!");
} catch (IOException e) {
// Report communication problems.
throw new java.lang.AssertionError(
"ITunesU.invokeAction(): I/O Exception " + e);
}
// Return the response received from iTunes U.
return response.toString();
} |
When iTunes U receives the https request, it validates the authorization token using the shared secret and the HMAC-SHA256 algorithm. If the authorization token is valid, iTunes U returns a response to your server. Your institution’s server then forwards the response to the user’s web browser, which in turn opens iTunes to the page specified, Example.edu.42, in the https request.
Note: For help debugging any problems you encounter, iTunes U provides an Access Debugging page containing information that may be helpful in solving many of your site and access problems, including information about the transfer identity and credentials received, the validity of the signature received, and the access provided to the specified URL destination. To access the page, append the Debug Suffix displayed in the Edit Site Settings page (available only to the primary administrator) to the end of your site URL. For example, if your site URL is http://deimos.apple.com/WebObjects/Core.woa/Browse/cupertinouniversity.com and the Debug Suffix in the Edit Site Settings page is “qkz566”, your debug URL would be http://deimos.apple.com/WebObjects/Core.woa/Browse/cupertinouniversity.com/qkz566. For more information, see “Debugging Site Access and Integration.”
© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-11-04)