.NET Google Provisioning API (v2.2.0.0) bad request error from RetrieveGroup() method

261 views Asked by At

I understand the Google Provisioning API will be deprecated as of tomorrow (iirc), but the news of this came to us a little late (not Google's fault btw) and we don't have time to overhaul our email account management software at the moment.

From a few weeks ago up until very recently (during today) Whenever I ran the following with valid parameters I received a .Net exception (text in angled brackets replaces actual values for privacy reasons):

googleService = new AppsService("<domain>", "<userName>", "<password>");
gRes = service.Groups.RetrieveGroup("<groupid>")

Where googleService and gRes are of type AppsService and GroupEntry respectively.

Outer exception message:

Execution of request failed: https://apps-apis.google.com/a/feeds/group/2.0/<domain>/<groupid>

Inner exception message:

The remote server returned an error: (400) Bad Request.

This is now partially working, in that if the group exists I no longer get the exception but instead get a GroupEntry object, as per the documentation, with what looks like valid property values. However, if the group does not exist I still get the above exceptions.

I don't want to rely on the exception meaning that the group doesn't exist, in case the exception occurs for existing groups again. Since that would result in our system thinking a Google email group has been created when it hasn't.

Is this something that is being worked on by Google and is that why I'm seeing changes in results? Or perhaps I'm doing something wrong?

Perhaps running RetrieveGroup on a non-existent group ID is supposed to return a .Net exception? But I would have thought that would result in a Google 'AppsException' with an ErrorCode of "EntityDoesNotExist(1301) - The request asks Google to retrieve an entity that does not exist." as per https://developers.google.com/google-apps/provisioning/reference#GDATA_error_codes

Although some other functions in this API have been known to throw a .Net generic exception rather than the more appropriate Google 'AppsException' exception in similar circumstances. For example deleting a user->group membership that didn't exist results in a .Net exception rather than the EntityDoesNotExist(1301) Google AppsException which I would expect.

Any info/confirmation on this would be gratefully received.

1

There are 1 answers

2
Emily On BEST ANSWER

I just ran 'retrieve a group' request via provisioning API in OAuth playground 2.0. It does returns the error code 1301 for Entity does not exist along with the 400 error code. Please check out Identify Errors in API Responses (https://developers.google.com/google-apps/provisioning/#identifying_errors_in_api_responses) for client library

GET /a/feeds/group/2.0/mydomain.com/[email protected] HTTP/1.1

Host: apps-apis.google.com

HTTP/1.1 400 Bad Request

xml version="1.0" encoding="UTF-8"

AppsForYourDomainErrors

error errorCode="1301" invalidInput="[email protected]" reason="EntityDoesNotExist"

/AppsForYourDomainErrors