Dealing with multipart/mixed reply from Google Calendar API v3

Hi all,

I’m playing around with Google Calendar API v3. It supports batching, where I can send a multipart/mixed message up to Google. I’m doing that simply by making a string, which has the relevant headers etc. included just as text. There’s an example at https://developers.google.com/google-apps/calendar/batch .

I’m getting a string back, which is several requests, separated by a separator - in the below example, batch_UegByOtqawQ=_AAmkqGqizAY= is the separator.

I’m wondering how best to deal with it. Is there any magic way I can give it to a method which will split out headers, HTTP status, body, etc., or do I have to make that method myself? Doing so sounds a little hair-raising and I would prefer not to if I can help it.

Any help gratefully received.

H

[code]–batch_UegByOtqawQ=_AAmkqGqizAY=
Content-Type: application/http
Content-ID: response-item-A6C0CB7C-4469-455A-8B4C-B6F893DC5800-batchevent@lightbluesoftware.com

HTTP/1.1 200 OK
ETag: “2P51478ogOpU1KCwGtKZ5NrhIGI/Mjc5NjY5OTMxMjU2NjAwMA”
Content-Type: application/json; charset=UTF-8
Date: Thu, 24 Apr 2014 14:27:36 GMT
Expires: Thu, 24 Apr 2014 14:27:36 GMT
Cache-Control: private, max-age=0
Content-Length: 970

{
“kind”: “calendar#event”,
“etag”: ““2P51478ogOpU1KCwGtKZ5NrhIGI/Mjc5NjY5OTMxMjU2NjAwMA””,
“id”: “7ps94ecvr494ckt8tdckri3sgo”,
“status”: “confirmed”,
“htmlLink”: “https://www.google.com/calendar/event?eid=N3BzOTRlY3ZyNDk0Y2t0OHRkY2tyaTNzZ28gcWVncmxhM3BoYWFmY2hscmJsaWNzajNmMDhAZw”,
“created”: “2014-04-24T14:27:36.000Z”,
“updated”: “2014-04-24T14:27:36.283Z”,
“summary”: “Enq: Prof. Plum’s wedding323 (Weddings)”,
“description”: “Groom: Paul Plum”,
“creator”: {
“email”: “hamishsymington@googlemail.com”,
“displayName”: “Hamish Symington”
},
“organizer”: {
“email”: “qegrla3phaafchlrblicsj3f08@group.calendar.google.com”,
“displayName”: “Light Blue”,
“self”: true
},
“start”: {
“dateTime”: “2014-05-10T09:00:00Z”,
“timeZone”: “Europe/London”
},
“end”: {
“dateTime”: “2014-05-10T17:00:00Z”,
“timeZone”: “Europe/London”
},
“iCalUID”: “7ps94ecvr494ckt8tdckri3sgo@google.com”,
“sequence”: 0,
“reminders”: {
“useDefault”: true
}
}

–batch_UegByOtqawQ=_AAmkqGqizAY=
Content-Type: application/http
Content-ID: response-item-6A24389D-B9D7-4CA4-A059-0EDDE9A4A55C-batchevent@lightbluesoftware.com

HTTP/1.1 200 OK
ETag: “2P51478ogOpU1KCwGtKZ5NrhIGI/Mjc5NjY5OTMxMjU2NjAwMA”
Content-Type: application/json; charset=UTF-8
Date: Thu, 24 Apr 2014 14:27:36 GMT
Expires: Thu, 24 Apr 2014 14:27:36 GMT
Cache-Control: private, max-age=0
Content-Length: 830

{
“kind”: “calendar#event”,
“etag”: ““2P51478ogOpU1KCwGtKZ5NrhIGI/Mjc5NjY5OTMxMjU2NjAwMA””,
“id”: “p12ja3egn080b5dm3tj0bailok”,
“status”: “confirmed”,
“htmlLink”: “https://www.google.com/calendar/event?eid=cDEyamEzZWduMDgwYjVkbTN0ajBiYWlsb2sgcWVncmxhM3BoYWFmY2hscmJsaWNzajNmMDhAZw”,
“created”: “2014-04-24T14:27:36.000Z”,
“updated”: “2014-04-24T14:27:36.283Z”,
“summary”: “Enq: Foofle233 (Weddings)”,
“creator”: {
“email”: “hamishsymington@googlemail.com”,
“displayName”: “Hamish Symington”
},
“organizer”: {
“email”: “qegrla3phaafchlrblicsj3f08@group.calendar.google.com”,
“displayName”: “Light Blue”,
“self”: true
},
“start”: {
“date”: “2014-05-10”
},
“end”: {
“date”: “2014-05-10”
},
“iCalUID”: “p12ja3egn080b5dm3tj0bailok@google.com”,
“sequence”: 0,
“reminders”: {
“useDefault”: true
}
}

–batch_UegByOtqawQ=_AAmkqGqizAY=–
[/code]