Happy Business Starts Here

Valued Scholar

Zuora rest api /v1/object/bil-run json format of the request

Zuora rest api version: '2018-01-17'

What is the correct request json format for the api call
POST /v1/object/bil-run?
whenever I call this api the answer is:
{"message":"Error - invalid object type: BilRun"}
Examples:
 curl -X POST -H "Authorization: Bearer xxxxx" -H "Content-Type: application/json" -d '{
    "AutoEmail": "false",
    "AutoPost": "false",
    "AutoRenewal": "false",
    "Batch": "Batch1",
    "ChargeTypeToExclued": "OneTime",
    "InvoiceDate": "2017-02-28",
    "NoEmailForZeroAmountInvoice": "false",
    "TargetDate": "2017-02-04"
}' "https://rest.sandbox.eu.zuora.com/v1/object/bil-run"
{"message":"Error - invalid object type: BilRun"}

Note:
On the swagger open api file available on the site there are the follwing mistake:
in line: 66307 the correct type is integer instead of Integer
Missing fields ChargeNumber and SubscriptionNumber in the propery ProxyCreateUsage

7 REPLIES 7
Valued Scholar

Re: Zuora rest api /v1/object/bil-run json format of the request

Highlighted
Valued Scholar

Re: Zuora rest api /v1/object/bil-run json format of the request

I'm using rest api by program (with the correct url), the curl examples is a my mistake.
Also using bill-run I get the same error:
Also using bill-run as the last string I get the same error.
curl -X POST -H "Authorization: Bearer xxxxxxxxxx" -H "Content-Type: application/json" -d '{
    "AutoEmail": "false",
    "AutoPost": "false",
    "AutoRenewal": "false",
    "Batch": "Batch1",
    "ChargeTypeToExclued": "OneTime, Usage",
    "InvoiceDate": "2017-02-28",
    "NoEmailForZeroAmountInvoice": "false",
    "TargetDate": "2017-02-04"
}' "https://rest.sandbox.eu.zuora.com/v1/object/bill-run"

{"message":"Error - invalid object type: BillRun"}

Master

Re: Zuora rest api /v1/object/bil-run json format of the request

Is your url correct? For my sandbox, the url is https://rest.apisandbox.zuora.com/v1/object/bill-run/

 

Also, there's a typo in your payload: /ChargeTypeToExclued/ChargeTypeToExclude/.

 

Finally, there's a working code sample (in python) at https://github.com/bolaurent/zuora_restful_python/blob/master/zuora_restful_python/zuora.py. Here's the relevant snippet:

 

    def create_bill_run(self, invoice_date, target_date,
                        account_id=None,
                        auto_email=False,
                        auto_post=False,
                        auto_renewal=False,
                        batch='AllBatches',
                        bill_cycle_day='AllBillCycleDays',
                        charge_type_to_exclude='',
                        no_email_for_zero_amount_invoice=False):
        # pylint: disable=line-too-long
        payload = {
            'InvoiceDate': invoice_date if isinstance(invoice_date, str) else invoice_date.strftime('%Y-%m-%d'),
            'TargetDate': target_date if isinstance(target_date, str) else target_date.strftime('%Y-%m-%d'),
            'AutoEmail': auto_email,
            'AutoPost': auto_post,
            'AutoRenewal': auto_renewal,
            'NoEmailForZeroAmountInvoice': no_email_for_zero_amount_invoice
        }
        # pylint: enable=line-too-long

        if account_id:
            payload['AccountId'] = account_id
        else:
            payload['batch'] = batch
            payload['BillCycleDay'] = bill_cycle_day

        if charge_type_to_exclude:
            payload['ChargeTypeToExclude'] = charge_type_to_exclude

        response = self._post('/object/bill-run/', payload)
        assert response['Success'], response
        return response

 

Valued Scholar

Re: Zuora rest api /v1/object/bil-run json format of the request

The url is correct. The enpoints are defined here: https://www.zuora.com/developer/api-reference/#section/Introduction/Endpoints and for EU is: https://rest.sandbox.eu.zuora.com

Other request working well like:

 

curl -X GET -H "Authorization: Bearer xxxxxxxxxxxxxxxxxxx" -H "Content-Type: application/json" "https://rest.sandbox.eu.zuora.com/v1/accounts/1000"

and also for examples: v1/operations/invoice-collect, /v1/accounts create customers, posting usage data and so on.

At the moment only the start of billing run call goes in error.

 

I try to execute the call with only the parameters present in our Python code:

 

curl -X POST 
  -H "Authorization: Bearer xxxxxxxxx" 
  -H "Content-Type: application/json" -d '{
    "AccountId":"8adc8f99610dbdc301611efc773a6597",
    "AutoEmail": false, 
    "AutoPost": false, 
    "AutoRenewal": false, 
    "InvoiceDate": "2018-02-28", 
    "NoEmailForZeroAmountInvoice": true, 
    "TargetDate": "2018-02-04"
}' "https://rest.sandbox.eu.zuora.com/v1/object/bill-run/"

but the result is the same:

 

{"message":"Error - invalid object type: BillRun"}

 

Master

Re: Zuora rest api /v1/object/bil-run json format of the request

Hi @bozzetti

 

The URL is correct and other requests are successful, ok, from another point of view I ask you:

 

Running Bill-Run via API is one of the functions called "Limited Availability".
In order to use the function of Limited Availability, it is necessary to ask Global Support.

 

https://www.zuora.com/developer/api-reference/#operation/Object_POSTBillRun
> Note: This feature is in Limited Availability. If you wish to have access to the feature, submit a request at Zuora Global Support.

 

Have you asked Global Support?

Valued Scholar

Re: Zuora rest api /v1/object/bil-run json format of the request

No, I will ask as soon as possible.

Is there in the UI a page show me what are the features I have?

In my Zuora installaztion by the UI it is possible to create bill run.

I've the button "create bill run" an it is working.

 

Master

Re: Zuora rest api /v1/object/bil-run json format of the request

I suspect that availability of the button is independent of the availability of the REST support.

 

I don't recall having to ask for this to be turned on in our instance. But perhaps I've just forgotten, or perhaps Zuora engagement team understood this as a requirement and turned it on without my having to ask.