Happy Business Starts Here

Highlighted
Zuora Alumni

How do I retrieve the value for "ResultFileUrl" from "BillingPreviewRun"?

Quesiton:
 
When using "BillingPreviewRun" and I want to download the preview file, how do I get the URL for the file?


If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √

1 REPLY 1
Zuora Alumni

Re: How do I retrieve the value for "ResultFileUrl" from "BillingPreviewRun"?

Solution:

 

1, create() call to create an 'BillingPreviewRun' object:

Request:

<ns1:create>
    <ns1:zObjects xsi:type="ns2:BillingPreviewRun">
        <ns2:TargetDate>2017-12-31</ns2:TargetDate>
    </ns1:zObjects>
</ns1:create>

Response:

            <ns1:createResponse xmlns:ns1="http://api.zuora.com/">
                  <ns1:result>
                        <ns1:Id>2c92c0f85a6b134e015a8062d10906bf</ns1:Id>
                        <ns1:Success>true</ns1:Success>
                  </ns1:result>
            </ns1:createResponse>

2, Then use the returned 'BillingPreviewRun' ID to query for the 'ResultFileUrl':

Request:

<ns1:query>
    <ns1:queryString>Select Id, CreatedDate, ResultFileUrl From BillingPreviewRun where Id='2c92c0f85a6b134e015a8062d10906bf' </ns1:queryString>
</ns1:query>

Response:

            <ns1:queryResponse xmlns:ns1="http://api.zuora.com/">
                  <ns1:result>
                        <ns1:done>true</ns1:done>
                        <ns1:queryLocator xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="1"></ns1:queryLocator>
                        <ns1:records xmlns:ns2="http://object.api.zuora.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:BillingPreviewRun">
                              <ns2:Id>2c92c0f85a6b134e015a8062d10906bf</ns2:Id>
                              <ns2:CreatedDate>2017-02-27T08:24:04.000-08:00</ns2:CreatedDate>
                              <ns2:ResultFileUrl>https://apisandbox.zuora.com/apps/api/file/2c92c0855a6b070f015a806481213625</ns2:ResultFileUrl>
                        </ns1:records>
                        <ns1:size>1</ns1:size>
                  </ns1:result>
            </ns1:queryResponse>

 

Supporting Documentation: https://knowledgecenter.zuora.com/DC_Developers/G_SOAP_API/E1_SOAP_API_Object_Reference/BillingPrevi...



If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √