[Building Sakai] Membership RESTful web service

Schauer, Christopher R cschauer at txstate.edu
Tue Aug 19 15:25:15 PDT 2014


Is there a reason you're sending the request from the server instead of sending it from the browser using javascript? The service uses the same session cookie that the rest of sakai uses to tell if a user is logged in or not and that cookie is only visible to the browser or the server that created it. It won't be available to your server which I'm assuming is another java application completely separate from sakai?

-Chris

On Aug 19, 2014, at 4:53 PM, Sergio Muriel <sergioame at hotmail.com<mailto:sergioame at hotmail.com>> wrote:

Update:
When the user (userId, or userEid) exists it gives me:

  *   JSP page: Exception: 403 Forbidden
  *   Browser with user logged in: {"entityPrefix": "membership", "membership_collection": ......etc, means actual information.
  *   Browser with user not logged in: HTTP Status 403 - Security exception handling request for view (/membership.json), this is typically caused by the current user not having access to the data requested or the user not being logged in at all :: message=Only admin can access other user memberships, current user (null) cannot access ref: admin

When the user (userId, or userEid) does not exist it gives me:

  *   JSP page: Exception: 400 Bad Request
  *   Browser with user logged in: HTTP Status 400 - IllegalArgumentException: Unable to handle output request for format json for this path (/membership.json) for prefix (membership) for entity (/membership), request url (/membership.json): unable to find user.
  *   Browser with user not logged in: Same as above.

Is there any way to make it work like the  /direct/membership service itself, which detects somehow if a user is logged in or not? I don't want the user to log in to the system again.



Best Regards,
Sergio Muriel

________________________________
From: sergioame at hotmail.com<mailto:sergioame at hotmail.com>
To: steve.swinsburg at gmail.com<mailto:steve.swinsburg at gmail.com>
Date: Tue, 19 Aug 2014 10:59:49 -0500
CC: sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>
Subject: Re: [Building Sakai] Membership RESTful web service

This is how I'm making the request:

<%@ page import="org.springframework.web.client.RestTemplate" %>
<%  RestTemplate restTemplate = new RestTemplate();
        SakaiUserMemberships userMemberships = restTemplate.getForObject("http://my_server/direct/membership.json?includeSites=false&includeGroups=true&userEid=sergio@hotmail.com", SakaiUserMemberships.class);
%>

SakaiUserMemberships is a bean that represents what /direct/membership gives, but I get a HTTP 400 Bad Request.


Best Regards,
Sergio Muriel

________________________________
Date: Tue, 19 Aug 2014 21:26:55 +1000
Subject: Re: [Building Sakai] Membership RESTful web service
From: steve.swinsburg at gmail.com<mailto:steve.swinsburg at gmail.com>
To: sergioame at hotmail.com<mailto:sergioame at hotmail.com>
CC: ottenhoff at longsight.com<mailto:ottenhoff at longsight.com>; sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>

The /direct/membership/describe tells you how to use it. What request are you trying to make and how are you making it?


On Tue, Aug 19, 2014 at 3:14 AM, Sergio Muriel <sergioame at hotmail.com<mailto:sergioame at hotmail.com>> wrote:
Great! Any examples of using this service?
http://qa5-us.sakaiproject.org/direct/membership

Best Regards,
Sergio Muriel

________________________________
From: ottenhoff at longsight.com<mailto:ottenhoff at longsight.com>
Date: Mon, 18 Aug 2014 11:40:23 -0400

Subject: Re: [Building Sakai] Membership RESTful web service
To: bkirschn at umich.edu<mailto:bkirschn at umich.edu>
CC: sergioame at hotmail.com<mailto:sergioame at hotmail.com>; sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>


grep tells me core-providers/src/java/org/sakaiproject/entitybroker/providers/MembershipEntityProvider.java


On Mon, Aug 18, 2014 at 11:26 AM, Kirschner, Beth <bkirschn at umich.edu<mailto:bkirschn at umich.edu>> wrote:
Try this:
        http://qa5-us.sakaiproject.org/direct/membership/describe

- Beth

On Aug 18, 2014, at 10:00 AM, Sergio Muriel <sergioame at hotmail.com<mailto:sergioame at hotmail.com>> wrote:

> Dear All,
>
> Does anybody know where I can find the code of:
> SAKAI_SERVER/direct/membership ?? (ex: http://qa5-us.sakaiproject.org/direct/membership)
>
> Also, does anybody have an example of using that service?
> I'm getting a HTTP 400 Bad Request when I try to use it.
>
> Thank you in advance.
>
>
>
> Best Regards,
> Sergio Muriel
>
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org<mailto:sakai-dev-unsubscribe at collab.sakaiproject.org> with a subject of "unsubscribe"

_______________________________________________
sakai-dev mailing list
sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>
http://collab.sakaiproject.org/mailman/listinfo/sakai-dev

TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org<mailto:sakai-dev-unsubscribe at collab.sakaiproject.org> with a subject of "unsubscribe"


_______________________________________________
sakai-dev mailing list
sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>
http://collab.sakaiproject.org/mailman/listinfo/sakai-dev

TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org<mailto:sakai-dev-unsubscribe at collab.sakaiproject.org> with a subject of "unsubscribe"


_______________________________________________ sakai-dev mailing list sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org<mailto:sakai-dev-unsubscribe at collab.sakaiproject.org> with a subject of "unsubscribe"
_______________________________________________
sakai-dev mailing list
sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>
http://collab.sakaiproject.org/mailman/listinfo/sakai-dev

TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org<mailto:sakai-dev-unsubscribe at collab.sakaiproject.org> with a subject of "unsubscribe"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20140819/ea28b41a/attachment.html 


More information about the sakai-dev mailing list