As the site administrator, you create an iTunes U Web Services document and then upload the document to the iTunes U servers. iTunes U Web Services executes all operations in the ITunesUDocument file in order and adds, deletes, updates, or merges the data contained in your site. If your document request contains a ShowTree operation before other operations, the iTunes U response first executes all operations in the document and then generates and returns the results of the commands and the ShowTree response.
To use the web service and upload your document to iTunes U, you must update your existing transfer script to generate and return just the authorization token instead of redirecting to a URL. To do this, you can either create a new script or pass an argument to your existing script.
Because signatures expire and message strings used to create signatures in one request might not be appropriate in another request, you should generate a new authorization token (user's credentials, identity information, time stamp, digital signature) for each request in a Web Services document upload.
To upload your document to an iTunes U server:
Generate an authorization token from your new or updated transfer script. For details, see “Generating the Token Data.”
Request an upload URL from iTunes U, using the authorization token from step 1. For example, type:
/usr/bin/curl https://deimos.apple.com/WebObjects/Core.woa/API/GetUploadURL/example.edu.1.2.3?credentials=foo&identity=user&time=123456&signature=abc123abc123&type=XMLControlFile |
The text example.edu.1.2.3 is the iTunes U value for the folder destination on the iTunes U site where you want to upload the document. It is recommended that you use the root folder of your site as the destination. An HTTP POST or GET performed on the finished URL returns another URL.
Upload your document to iTunes U as an HTTP file-upload POST to the final URL created in step 2.
Make sure your HTTP request contains a multipart/form-data content type and that the name of the MIME part representing the XML is “file.” For more information, see RFC 1867 - Form-based File Upload in HTML at http://www.faqs.org/rfcs/rfc1867.html.
For example, type:
/usr/bin/curl -F file=@/path_to_file.xml -s <url_from_step_2> |
iTunes U parses and executes the operations in your ITunesUDocument file.
Be sure step 3 follows immediately after step 2. For security reasons, the URL returned in step 2 is only valid for 90 seconds. After 90 seconds, step 3 fails.
Note: The credentials you send along with your iTunes U Web Services document officially identify the user and confirm the user’s specific access permissions to the iTunes U site, along with the actions the user can perform within any specific section in the site. To use iTunes U Web Services, you must have Shared or Edit access to your iTunes U site. For more information on credentials and access, see “Controlling User Access to iTunes U Pages Using Advanced Access.” For information on authorization tokens and credentials, see “Transferring Authorization Data to iTunes U.”
iTunes U also provides a one-step process for uploading your document, using the authorization token generated from your new or updated transfer script, the raw XML data, and the ProcessWebServicesDocument operation.
To upload your document to an iTunes U server:
Construct a POST request, including the authorization token generated from your transfer script and the contents of your XML file, and using the ProcessWebServicesDocument operation send the request to the iTunes U servers.
iTunes U validates your authorization token and, if valid, parses and executes the operations in your ITunesUDocument file.
The following is an example POST request (note that there is no Content-Type header):
POST /WebObjects/Core.woa/API/ProcessWebServicesDocument/example.edu?credentials=Administrator@urn:mace:itunesu.com:sites:example.edu&identity=%22Jane%20Doe%22%20%3Cjdoe@example.edu%3E%20(jdoe)%20[42]&time=1201286424&signature=4d500efbe36f5db8b9305cb60fdae28371be701101137ff2ff1aae9a7da8252c HTTP/1.1.4
Host: deimos.apple.com
Connection: Keep-Alive
Content-Length: 162
<?xml version="1.0" encoding="UTF-8"?>
<ITunesUDocument>
<Version>1.1.4</Version>
<ShowTree>
<KeyGroup>maximal</KeyGroup>
</ShowTree>
</ITunesUDocument> |
© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-11-04)