Creating an Export
From API Documentation
Use the Zuora Export object to conveniently query and access data that is joined with other objects.
Create()an Export object, specifying which fields are to be in the Export.- Specify the fields to be included with Export ZOQL (which differs slightly from the Z-Commerce API ZOQL):
<ns1:create xmlns:ns1="http://api.zuora.com/"> <ns1:zObjects xmlns:ns2="http://object.api.zuora.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:Export"> <ns2:format>csv</ns2:format> <ns2:name>My Export</ns2:name> <ns2:query>SELECT Account.Name, BillToContact.WorkEmail FROM Account</ns2:query> <ns2:Zip>True</ns2:Zip> </ns1:zObjects> </ns1:create>
- This will return the
Export.Id. Using this, Query for the status of the of the created Export:SELECT status, fileId FROM Export WHERE Id=Export.Id - Once
Status=Completed, using the REST API to retrieve the file based onExport.fileId. - Use HTTP GET to the URL
https://www.zuora.com/apps/file.do?id=FILE_ID(Zuora REST API) where FILE_ID is set to theExport.filedId. Use one of the following methods to gain access to this URL:- Using Basic Authentication and pass your Zuora username and password
- Set a cookie in the request with a valid Zuora Session Id that you can get via login(). The cookie should be of the format:
Cookie: ZSession=SESSION
