Batch HTTP requests
robhammond opened this issue · comments
Rob Hammond commented
I had trouble getting the multipart/mixed batch requests working with Google's APIs (a bunch of 400 bad request errors).
Figured out that the $r->add_part() function needs to add the following headers after the --batch_number block:
Content-Type: application/http
Content-Transfer-Encoding:binary
ie:
--batch_YUS7l5AzBL0sRpe
Content-Type: application/http
Content-Transfer-Encoding:binary
POST /analytics/v3/management/accounts/XXXXX/webproperties/UA-XXXXXX-X/profiles/XXXXXXXX/entityUserLinks
Content-Type: application/json
{"permissions":{"local":["READ_AND_ANALYZE"]},"userRef":{"email":"abc@example.com"}}
As per the spec here:
http://www.odata.org/documentation/odata-version-3-0/batch-processing/