Exporting GET Results

Whenever you're making a GET request in Buzz you can choose to have the response downloaded into a convenient format such as Excel or XML. All you have to do is add the format field with a supported format. For example:

curl -X GET "[host]/rest/advertiser" -b cookies.txt 
	-d '{"advertiser_id":1, "format":"xls"}'

The output will be sent directly to your client, without the typical json wrapping and without the success and payload fields (see: Getting Started with the Buzz API ). Using CURL, for example, you might want to send the output directly to a file:

curl -X GET "[host]/rest/advertiser" -b cookies.txt 
	-d '{"advertiser_id":1, "format":"xls"}' > advertisers.xls

Supported formats include:

FormatNotes
csvField names included as first row
xlsExcel 2007 format
xlsxModern Excel format
xmlXML document with as top-level node
jsonJSON format identical to normal GET response, but omitting success, errors, and payload fields

Notes:

  • The Report Queue object supports the same formats, but uses a different mechanism to enable downloadable reports. Using the format field will not work properly on this object.
  • The format field is only supported for GET requests, it will have no effect on POSTs, PUTs, or DELETEs.
  • A common usage for the format field is for downloading tags with the event_tag or segment_tag methods.