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:
Format | Notes |
---|---|
csv | Field names included as first row |
xls | Excel 2007 format |
xlsx | Modern Excel format |
xml | XML document with as top-level node |
json | JSON 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.
Updated over 4 years ago