Newbie here, so thanks for your patience.  My company has Google Apps
Premier, and I'm just starting out with trying to retrieve a user list
from our domain.  When I run this code, I get an Error 403 "You are
not authorized to access this API."  I'm reasonable sure I need to get
an authorization token, but I didn't understand how to do it in this
case, or which URL I should submit the request to.  Following is my
code.  The exception is thrown on the service.getFeed() call.  Any
help is greatly appreciated.

                try {
                        UserService service = new UserService("myapp");
                        service.setUserCredentials("adminaccount", "password");

                        URL feedUrl = new 
URL("https://www.google.com/a/feeds/mydomain.com/
user/2.0");

                        UserFeed feed = service.getFeed(feedUrl, 
UserFeed.class);

                        for (UserEntry entry : feed.getEntries())
                        {
                                
System.out.println(entry.getName().getFamilyName());
                        }
                } catch (AuthenticationException e) {
                        e.printStackTrace();
                } catch (MalformedURLException e) {
                        e.printStackTrace();
                } catch (IOException e) {
                        e.printStackTrace();
                } catch (ServiceException e) {
                        e.printStackTrace();
                }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Data Protocol" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to