[gradebook2-dev] gb2 rest services

Jon Gorrono jpgorrono at ucdavis.edu
Tue Feb 7 18:55:44 PST 2012


See, I knew if we stayed quiet long enuf, John would work out all our
troubles for us ;)

Truth is, John, we've been trying to get the REST access as
independent as possible, but we overlooked the login via curl, and
focused blindly on the direct to webapp approach... running face-on
into the security we put in place to try to prevent it ..... oh, we
talked about it plenty... but since we had something that worked....
<ehem> for us...  anyway, thanks for doing this trail blazing ....it
indeed greatly simplifies things

On Tue, Feb 7, 2012 at 7:59 AM, John Bush <john.bush at rsmart.com> wrote:
> Just to continue this thread of me talking to myself, and in the off
> chance this is useful to anyone else.  Here's how you export with curl
> alone.
>
> Logon to CLE, store session in cookies.txt file:
>
> curl -b cookies.txt -c cookies.txt -L -X POST -d "eid=admin&pw=admin"
> http://localhost:8888/xsl-portal/xlogin
>
> Download csv grade export file for tool id of
> “4f9ab817-4856-4ca8-8874-e01a81fda120” and gradebook_uid or site id of
> “87654321-abcd-1234-wxyz-12ab34cd56ef”.  The gradebook_uid and site id
> have the same value.
>
> curl -b cookies.txt -c cookies.txt -L -X POST
> http://localhost:8888/xsl-portal/tool/4f9ab817-4856-4ca8-8874-e01a81fda120/gradebook/rest/export/87654321-abcd-1234-wxyz-12ab34cd56ef/filetype/csv
>
> Then you could manipulate the csv file, zip them up, or whatever the
> clients requirements dictate.  Finally, there is a way to get at
> course grade calculations programmatically that isn't a big heavy
> weight ordeal.  I don't know if consuming these services outside the
> gwt client was intended or not, but I'm pretty you guys did it that
> way, I just wished I realized I could do this a long time ago.
>
> On Mon, Feb 6, 2012 at 4:58 PM, John Bush <john.bush at rsmart.com> wrote:
>> so in fact this works, wahoo, this has been a long standing problem for us.
>>
>> As a proof I created an html page in sakai. The url looks direct that
>> I originally thought, b/c you have to tie into the portal/request
>> filter stuff.
>>
>> <form method="post"
>> action="http://localhost:8888/xsl-portal/tool/4f9ab817-4856-4ca8-8874-e01a81fda120/gradebook/rest/export/87654321-abcd-1234-wxyz-12ab34cd56ef/filetype/csv">
>>    <input type="submit" value="submit" />
>> </form>
>>
>> This indeed forces a csv to be created.
>>
>> Now I just need to figure out how to make curl do a sakai logon, or
>> maybe handle that another way.  Sweet.
>>
>> On Mon, Feb 6, 2012 at 2:53 PM, John Bush <john.bush at rsmart.com> wrote:
>>> I need to programmatically export data from a bunch of sakai sites.
>>> I've narrowed in on gb2's Export rest service.  I think if I could
>>> just hit that a bunch of times and get json out, the rest would be
>>> easy.  I'm just looking for some help understanding what the url would
>>> look like for downloading a csv version.  Are there examples of
>>> hitting gb2 services from outside the gwt client, any none gotchas,
>>> etc.
>>>
>>> I thought it would be something like this, but I'm getting 405 errors,
>>> maybe because I have it wrong, maybe because some security stuff I'm
>>> not considering ?
>>>
>>> http://localhost:8888/sakai-gradebook2/gradebook/rest/export/gradebook_uid/filetype/csv
>>>
>>>
>>> --
>>> John Bush
>>> 602-490-0470
>>
>>
>>
>> --
>> John Bush
>> 602-490-0470
>
>
>
> --
> John Bush
> 602-490-0470
> _______________________________________________
> gradebook2-dev mailing list
> gradebook2-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/gradebook2-dev



-- 
Jon Gorrono
PGP Key: 0x5434509D -
http{pgp.mit.edu:11371/pks/lookup?search=0x5434509D&op=index}
GSWoT Introducer - {GSWoT:US75 5434509D Jon P. Gorrono <jpgorrono -
www.gswot.org>}
http{middleware.ucdavis.edu}


More information about the gradebook2-dev mailing list