google-appsgoogle-admin-sdkgoogle-email-settings-api

Batch requests for Google Apps Email Settings


I'm trying to send batch requests[1] with Email Settings operations, specifically with Vacation-Responder and Forwarding Settings but I only get "404 not found". I've worked with other Admin SDK APIs' operations inside batch requests with no problems at all, but I cannot achieve it with Email Settings. May be it is not supported? I know for sure that the problem is in the batch request, I can successfully accomplish it with individual operations (no batch).

Here is the request being sent (only one operation inside the batch request):

POST /batch HTTP/1.1
Host: www.googleapis.com
Content-length: 798
Content-type: multipart/mixed; boundary=batch_foobar
Authorization: hidden

--batch_foobar
Content-ID: 0
Content-Type: application/http
Content-Transfer-Encoding: binary

PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/hiddendomain/hiddenusername/vacation
Content-type: application/atom+xml
Content-Length: 679

<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
    <apps:property name="enable" value="true" />
    <apps:property name="subject" value="Test" />
    <apps:property name="message" value="Test message" />
    <apps:property name="contactsOnly" value="true" />
    <apps:property name="domainOnly" value="false" />
    <apps:property name="startDate" value="2014-07-08" />
    <apps:property name="endDate" value="2014-07-09" />
</atom:entry>

--batch_foobar--

And here is the response:

HTTP/1.1 200 OK
Content-length: 338
X-xss-protection: 1; mode=block
X-content-type-options: nosniff
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Server: GSE
Pragma: no-cache
Cache-control: no-cache, no-store, max-age=0, must-revalidate
Date: Tue, 08 Jul 2014 09:20:45 GMT
X-frame-options: SAMEORIGIN
Content-type: multipart/mixed; boundary=batch_8eGfZ3iWYsE=_AAOswOMwE9Y=

--batch_Dg4qG3f3pPg=_AAm-NVSCF2o=
Content-Type: application/http
Content-ID: response-0

HTTP/1.1 404 Not Found
Content-Type: text/html; charset=UTF-8
Date: Tue, 08 Jul 2014 08:59:17 GMT
Expires: Tue, 08 Jul 2014 08:59:17 GMT
Cache-Control: private, max-age=0
Content-Length: 9

Not Found
--batch_Dg4qG3f3pPg=_AAm-NVSCF2o=--

And yes, the domain and username that I am actually using are OK.

Any help, comment, suggestion will be appreciated. Thank you.

PS: I've also tried with OAuth Playground[2] and it resulted the same.

[1] https://developers.google.com/admin-sdk/directory/v1/guides/batch

[2] https://developers.google.com/oauthplayground


Solution

  • The email settings api is an old GData based API and does not support batch. Your best option for improving performance is to send parallel api requests.