On 2/11/14, 7:21 AM, James Mullaney wrote:
> This is all really helpful, thanks Andrew. I think you've just confirmed
> the decisions we had come to.
>
> Another quick one that has reared its head - if we are to suppose that a
> Document can be any form of content (binary file or JSON) then where is
> that content held in the request? I presumed that the parameters being sent
> (activityId, stateId, actor) were in the form of POST variables, but in
> that case does the document content need to have its own POST variable as
> the POST variables would make up the body?
>
> However, if the document content is to be the body of the HTTP request
> (which is what I believe the spec alludes to), then would the required
> parameters need to be passed as GET variables instead? That doesn't seem
> right given the fact that 'actor' is going to be JSON, and while we could
> send this in using query parameters, it is surely better served using the
> POST variables.
>
> For the moment we are under the assumption that it would be included in
> another POST variable called "content", but this isn't specified in the
> spec so this now becomes Learning Locker specific (which defeats the
> purpose of the specification of course!).
>
> J
I think this is sufficiently unclear in the spec at this point because
of the liberal use of POST throughout.
But, it is my understanding that generally these requests are all PUTs
not POSTs and as they are document storage APIs the parameters you list
are query parameters for the query string and the document goes in the
body of the request. The primary libraries in use today do it this way
at least. (They can also often be looked at for answering these types of
questions, since they work AFAIK against all commonly available LRSs.)
Having said that, POST is a special case particularly for providing
support for IE CORS requests which do not support the other methods. See:
https://github.com/adlnet/xAPI-Spec/blob/master/xAPI.md#78-cross-origin-requests
In that case the parameters normally on the query string are replaced by
a single query parameter of "method" and the additional form parameter
of "content" is specified and must be provided. Note that binary data
can't be supported in this case.
POST also has the special meaning for document merging for
"application/json" documents, but in that case the parameters would
still go on the query string since they don't have to be otherwise
replaced with the "method" parameter.
It may be worth opening an issue against the spec to improve the
handling of "POST" in the description and to make it appear exceptional
rather than the norm.
Brian
--
Brian J. Miller
Rustici Software
brian....@scorm.com