Content-Type: application/http Content-Transfer-Encoding: binary Content-ID: POST /v3/urlNotifications:publish [3] Content-Type: application/json accept: application/json content-length: 58 { "url": "http://example.com/jobs/43", "type": "URL_DELETED" } #### POST /v3/urlNotifications:publish [3] Content-Type: application/json accept: application/json content-length: 58 { "url": "http://example.com/jobs/43", "type": "URL_DELETED" } #### Content-Type: application/http Content-Transfer-Encoding: binary Content-ID: #### #!/usr/bin/env perl use strictures; use HTTP::Request::Common; use JSON; use URI; my $request1 = POST "/v3/urlNotifications:publish", Content_Type => 'application/json', Accept => 'application/json', Content_ID => "1", Content => encode_json({ url => 'http://example.com/1', type => "URL_UPDATED" } ); my $request2 = POST "/v3/urlNotifications:publish", Content_Type => 'application/json', Accept => 'application/json', Content_ID => "2", Content => encode_json({ url => "http://example.com/2", type => "URL_UPDATED" } ); my $endpoint = URI->new("https://indexing.googleapis.com/batch"); my $base_request = POST $endpoint, Authorization => "Bearer TOKEN", Content_Type => 'multipart/mixed; boundary=xYzZY123'; $base_request->add_part( $request1, $request2 ); print $base_request->as_string; #### Authorization: Bearer TOKEN Content-Length: 0 Content-Type: multipart/mixed; boundary=xYzZY123 --xYzZY123 POST /v3/urlNotifications:publish Accept: application/json Content-Length: 51 Content-Type: application/json Content-ID: 1 {"url":"http://example.com/1","type":"URL_UPDATED"} --xYzZY123 POST /v3/urlNotifications:publish Accept: application/json Content-Length: 51 Content-Type: application/json Content-ID: 2 {"url":"http://example.com/2","type":"URL_UPDATED"} --xYzZY123- #### Content-Type: application/http Content-Transfer-Encoding: binary Content-ID: #### POST /batch HTTP/1.1 Host: indexing.googleapis.com Content-Length: content_length Content-Type: multipart/mixed; boundary="===============7330845974216740156==" Authorization: Bearer oauth2_token --===============7330845974216740156== Content-Type: application/http Content-Transfer-Encoding: binary Content-ID: POST /v3/urlNotifications:publish [1] Content-Type: application/json accept: application/json content-length: 58 { "url": "http://example.com/jobs/42", "type": "URL_UPDATED" } --===============7330845974216740156== Content-Type: application/http Content-Transfer-Encoding: binary Content-ID: POST /v3/urlNotifications:publish [2] Content-Type: application/json accept: application/json content-length: 75 { "url": "http://example.com/widgets/1", "type": "URL_UPDATED" } --===============7330845974216740156== Content-Type: application/http Content-Transfer-Encoding: binary Content-ID: POST /v3/urlNotifications:publish [3] Content-Type: application/json accept: application/json content-length: 58 { "url": "http://example.com/jobs/43", "type": "URL_DELETED" } --===============7330845974216740156==