[gradebook2-dev] gb2 rest services

John Bush john.bush at rsmart.com
Tue Feb 7 07:59:09 PST 2012


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


More information about the gradebook2-dev mailing list