[gradebook2-dev] Gradebook2 webservices

Thomas Amsler tpamsler at ucdavis.edu
Fri Feb 11 23:22:29 PST 2011


One thing I would add is to look at industry leaders that provide REST
APIs and how they handle it.

e.g.
Google: They use the url versioning on almost all of their REST APIs
https://www.googleapis.com/latitude/v1/currentLocation?key=INSERT-YOUR-KEY

ForeSquare:
https://api.foursquare.com/v2/venues/5104/tips?oauth_token=XXX.

Groupon:
http://sites.google.com/site/grouponapiv2/api-usage

etc.

-- Thomas

2011/2/11 Curtis Bray <clbray at ucdavis.edu>:
> An intriguing post and looks like it's continuing to get comment traffic since 2008. The comments propose a number of options and I'm wondering if anyone else has tried these approaches before?
>
>
> I like the slight tweak on the bloggers idea that is expressed in comment #7: "I like the approach, but wouldn’t it be cleaner to add a ‘version’ (or something similar) parameter to the Content-Type, so you don’t end up with an effectively unique Content-Type for each new version? ‘Accept: application/vnd.mycompany.app+xml; version=1.0′ would be just as expressive, but cleaner."
>
>
> - Curtis
>
>
> From: Jon Gorrono [jpgorrono at ucdavis.edu]
>
> Sent: Friday, February 11, 2011 9:03 PM
>
> To: Thomas Amsler
>
> Cc: Geng, Kelly; Sakai Programming Team; nicolamj at gmail.com; gradebook2-dev at collab.sakaiproject.org; Jayanna, Sid
>
> Subject: Re: [gradebook2-dev] Gradebook2 webservices
>
>
>
>
>
>
>
> good point...
>
> ... here's an alternate view on url versions and an alternative
>
> approach that deserves some scrutiny, IMO
>
>
>
> http://barelyenough.org/blog/2008/05/versioning-rest-web-services/
>
>
>
>
> On Fri, Feb 11, 2011 at 8:28 PM, Thomas Amsler <tpamsler at ucdavis.edu> wrote:
>
>> One issue I could see with this approach is that we currently don't
>
>> version the REST url space. This means that if we make changes to path
>
>> or query parameters, external dependent services could break. If we
>
>> really advocate this as a "real" REST service for other tools to use,
>
>> then we need to start to version it.
>
>>
>
>> e.g.
>
>>
>
>> from:
>
>> .../gradebook/rest/learner/numeric/<id>/<id>/
>
>>
>
>> to:
>
>> .../gradebook/rest/v1/learner/numeric/<id>/<id>/
>
>>
>
>> -- Thomas
>
>>
>
>> On Thu, Feb 10, 2011 at 11:06 AM, Geng, Kelly <gengx at muohio.edu> wrote:
>
>>> Hi Jon,
>
>>>
>
>>> This is Kelly, working on the same project(grade submission from Sakai to Banner) with Sid. Following your discussion, I did some test on calling the Gradebook REST service from outside of Sakai to prove whether our idea will work. What I did was:
>
>
>>> -Using Curl to send the https request using the REST URL copied from the Sakai instance,
>
>
>>> -copy the cookie value of a valid Sakai session from the web browser, and send it along,
>
>
>>> -forged a HTTP header of X-XSRF-Cookie(with the session id as the value) and sent it along
>
>
>>>
>
>>> I did the test for the "roster" service and I did get valid JSON data as the response. I am planning to do more test on some other services which we will potentially be using. At the same time, we would like to know whether you see any potential issues with
>  this approach. Are there any better ways to authenticate the service calls? Will it cause problems in future releases of Gradebook2? Any input will be appreciated.
>
>
>>>
>
>>> Thanks,
>
>>> Kelly
>
>>>
>
>>>
>
>>>
>
>>> -----Original Message-----
>
>>> From: gradebook2-dev-bounces at collab.sakaiproject.org [mailto:gradebook2-dev-bounces at collab.sakaiproject.org] On Behalf
>  Of Jon Gorrono
>
>>> Sent: Monday, January 31, 2011 8:41 PM
>
>>> To: Jayanna, Sid
>
>>> Cc: Sakai Programming Team; gradebook2-dev at collab.sakaiproject.org
>
>>> Subject: Re: [gradebook2-dev] Gradebook2 webservices
>
>>>
>
>>> Sid,
>
>>>
>
>>> We found a few places where the service calls make the assumption that
>
>>> there is a current site... if you are establishing a session in sakai
>
>>> through some alternative method, that may not be the case.... If you
>
>>> run run into this case (usually a NullPointerException) in the logs,
>
>>> please post a note about it.... we should probably be finding
>
>>> solutions for all the cases.
>
>>>
>
>>> jP
>
>>>
>
>>> On Mon, Jan 31, 2011 at 1:56 PM, Thomas Amsler <tpamsler at ucdavis.edu> wrote:
>
>>>> Sid,
>
>>>>
>
>>>> Assuming you are doing this from a browser with some sort of REST
>
>>>> plugin (e.g.Chrome and cREST client), you can make the (GET, POST,
>
>>>> DELETE, PUT) REST calls as long as:
>
>>>>
>
>>>> - You have established a valid Sakai session
>
>>>> - You provide the valid path parameters
>
>>>>
>
>>>> All the gradebook2 REST resources are located here:
>
>>>>
>
>>>>
> https://source.sakaiproject.org/contrib/gradebook2/trunk/server/src/java/org/sakaiproject/gradebook/gwt/sakai/rest/resource/
>
>
>>>>
>
>>>> So you should be able to look at those classes and determine what the
>
>>>> path parameters are. Also, if you develop gradebook2 in GWT DEV mode,
>
>>>> you can use the following url:
>
>>>>
>
>>>>
> http://127.0.0.1:8888/gradebook/rest/application.wadl
>
>>>>
>
>>>> ... to get the Jersey generated WADL. I have attached the generated
>
>>>> sample output.
>
>>>>
>
>>>> I hope this helps.
>
>>>>
>
>>>> Best,
>
>>>> -- Thomas
>
>>>>
>
>>>>
>
>>>> On Mon, Jan 31, 2011 at 12:32 PM, Jayanna, Sid <jayannsd at muohio.edu> wrote:
>
>>>>> Hi Thomas,
>
>>>>> Thanks for taking the time to reply to my emails.
>
>>>>> If I understand the REST implementation correctly, don't gradebook2
>
>>>>> provide
>
>>>>> some kind of URI to manipulate (get/post/put/delete) resources?
>
>>>>> please bear with me here, I noticed on our log while working with
>
>>>>> gradebook2
>
>>>>> these messages (ipaddress have been masked to protect the guilty) -
>
>>>>> ------
>
>>>>> [31/Jan/2011:14:41:46 -0500] x.x.x.x TLSv1 AES256-SHA "GET
>
>>>>>
>
>>>>> /portal/tool/d10a1c9e-66af-4084-ac1c-c5a07d059e8a/gradebook/rest/roster/87450467-8cab-4fc3-be7c-00a3e6245965/1/?sortField=S_LST_NM_FRST&sortDir=ASC&offset=0&limit=19
>
>
>>>>> HTTP/1.1"
>
>>>>> [31/Jan/2011:14:15:16 -0500] x.x.x.x TLSv1 DHE-RSA-AES256-SHA "POST
>
>>>>>
>
>>>>> /portal/tool/d10a1c9e-66af-4084-ac1c-c5a07d059e8a/gradebook/rest/item/87450467-8cab-4fc3-be7c-00a3e6245965/1/
>
>
>>>>> HTTP/1.1"
>
>>>>> -----------------
>
>>>>> So it appears like the GWT client is making GET/POST REST calls to work
>
>>>>> with
>
>>>>> the resources on the server? but when I copy the above url and try to run
>
>>>>> it
>
>>>>> from the address bar I get "ERROR: SESSIONID is null".
>
>>>>> So, theoretically I should be able to call the same URI from my broker
>
>>>>> application to get a roster with grades, is my understanding correct?
>
>>>>> Also, if you can point me to some documentation of the REST implementation
>
>>>>> will be very helpful.
>
>>>>> Please let me know if you have any questions.
>
>>>>> Thanks,
>
>>>>> Sid
>
>>>>>
>
>>>>>
>
>>>>>
>
>>>>> On Jan 28, 2011, at 4:27 PM, Thomas Amsler wrote:
>
>>>>>
>
>>>>> That would be one way to extend the existing Sakai (Axis) SOAP service
>
>>>>> endpoints. Gradebook2 uses REST (JAX-RS) to communicate between client
>
>>>>> and the server. So you could potentially expand on that by providing a
>
>>>>> new REST resource that returns the required data. Both approaches are
>
>>>>> valid.
>
>>>>> -- Thomas
>
>>>>>
>
>>>>> On Fri, Jan 28, 2011 at 1:21 PM, Jayanna, Sid <jayannsd at muohio.edu> wrote:
>
>>>>>
>
>>>>> Thanks Thomas, that helps.
>
>>>>>
>
>>>>> So, there are no webservices listening by default which can provide me the
>
>>>>> roster with grades (like a REST Get call) from the broker application.
>
>>>>>
>
>>>>> That webservice needs to be designed on the sakai end similar to the
>
>>>>> SakaiLogin.jws. Is my understanding correct?
>
>>>>>
>
>>>>> Thanks,
>
>>>>>
>
>>>>> Sid
>
>>>>>
>
>>>>> On Jan 28, 2011, at 4:14 PM, Thomas Amsler wrote:
>
>>>>>
>
>>>>> Sid,
>
>>>>>
>
>>>>> The details of the final grade submission handling  is implemented by
>
>>>>>
>
>>>>> and implementation of the InstitutionalAdvisor.java interface. When
>
>>>>>
>
>>>>> the user clicks on the submit final grade menu item, it makes a REST
>
>>>>>
>
>>>>> call to SubmitFinalGrades.java
>
>>>>>
>
>>>>> That class calls the Gradebook2ComponentService.submitFinalGrade(...)
>
>>>>>
>
>>>>> method, which in turn calls the
>
>>>>>
>
>>>>> InstitutionalAdvisor.submitFinalGrade(...) method. So you should
>
>>>>>
>
>>>>> implement your version of the InstitutionalAdvisor interface and use
>
>>>>>
>
>>>>> it via Spring injection. There is a default implementation of the
>
>>>>>
>
>>>>> InstitutionalAdvisor interface in SampleInstitutionalAdvisor.java
>
>>>>>
>
>>>>> I hope this helps.
>
>>>>>
>
>>>>> Best,
>
>>>>>
>
>>>>> -- Thomas
>
>>>>>
>
>>>>> On Fri, Jan 28, 2011 at 11:55 AM, Jayanna, Sid <jayannsd at muohio.edu>
>
>>>>> wrote:
>
>>>>>
>
>>>>> Hi Thomas,
>
>>>>>
>
>>>>> I was wondering if gradebook2 exposes any REST webservices for me to
>
>>>>> consume
>
>>>>> to submit the final grades to another broker application which will send
>
>>>>> it
>
>>>>> to our SIS.
>
>>>>>
>
>>>>> If you could point me to some resources will be very helpful.
>
>>>>>
>
>>>>> Thanks,
>
>>>>>
>
>>>>> Sid
>
>>>>>
>
>>>>> On Oct 6, 2010, at 2:26 PM, Thomas Amsler wrote:
>
>>>>>
>
>>>>> Yes
>
>>>>>
>
>>>>> On Wednesday, October 6, 2010, Jayanna, Sid <jayannsd at muohio.edu> wrote:
>
>>>>>
>
>>>>> Sure, I will create my first jira.
>
>>>>>
>
>>>>> That will be a feature request right?
>
>>>>>
>
>>>>> Thanks,
>
>>>>>
>
>>>>> Sid
>
>>>>>
>
>>>>> On Oct 6, 2010, at 2:11 PM, Thomas Amsler wrote:
>
>>>>>
>
>>>>> As far as I know, we haven't added a tool icon for gradebook2 yet. Would
>
>>>>> you
>
>>>>> mind creating a GRBK jira for this:
>
>>>>>
>
>>>>>
> http://jira.sakaiproject.org/browse/GRBK
>
>>>>>
>
>>>>> Best,
>
>>>>>
>
>>>>> -- Thomas
>
>>>>>
>
>>>>> On Wed, Oct 6, 2010 at 10:53 AM, Jayanna, Sid <jayannsd at muohio.edu> wrote:
>
>>>>>
>
>>>>> The reason I wanted to test gradebook2 on a nightly server is due to a
>
>>>>> missing icon on my Sakai build. I am using Sakai src tag 2.7.1 and
>
>>>>> gradebook2 1.3.0
>
>>>>>
>
>>>>> I have attached a screen shot. As you can see from the screen shot, the
>
>>>>> icon
>
>>>>> for gradebook2 is missing.
>
>>>>>
>
>>>>> I would appreciate if you can shed some light on why the icon is missing.
>
>>>>>
>
>>>>> Thanks,
>
>>>>>
>
>>>>> Sid
>
>>>>>
>
>>>>>
>
>>>>>
>
>>>>>
>
>>>>>
>
>>>>>
>
>>>>>
>
>>>>>
>
>>>>>
>
>>>> [see attachment: "application.wadl", size: 20903 bytes]
>
>>>>
>
>>>>
>
>>>> Attachments:
>
>>>>
>
>>>> application.wadl
>
>>>>
>
>>>> ________________________________
>
>>>> This automatic notification message was sent by SmartSite at UCDavis
>
>>>> (https://smartsite.ucdavis.edu/xsl-portal) from the UCD Sakai Dev site.
>
>
>>>> You can modify how you receive notifications at My Workspace > Preferences.
>
>>>>
>
>>>
>
>>>
>
>>>
>
>>> --
>
>>> 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 - gswot.org>}
>
>
>>> http{sysdev.ucdavis.edu}
>
>>> _______________________________________________
>
>>> gradebook2-dev mailing list
>
>>> gradebook2-dev at collab.sakaiproject.org
>
>>>
> http://collab.sakaiproject.org/mailman/listinfo/gradebook2-dev
>
>>> _______________________________________________
>
>>> 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 - gswot.org>}
>
> http{sysdev.ucdavis.edu}
>
>
>
>
> This automatic notification message was sent by SmartSite at UCDavis (https://smartsite.ucdavis.edu/xsl-portal) from the UCD Sakai
>  Dev site.
>
> You can modify how you receive notifications at My Workspace > Preferences.
>
>
>
>
>


More information about the gradebook2-dev mailing list