Happy Business Starts Here

REST API response bug: "Success" vs "success"

Some API calls return "Success" and some return "success". This is a bug.

 

Example of a response to REST create subscription:

 

{'reasons': [{'message': "Invalid parameter(s): 'SubscribeToRatePlans,InitialTerm,ContractEffectiveDate,OpportunityCloseDate_QT,Invoice,TermType,SubscriptionNumber,InvoiceSeparately,AccountKey,OpportunityName_QT'.", 'code': 53000021}], 'processId': 'F3738102E98FD4EC', 'success': False}

Example of a response to REST create account:

 

AssertionError: POST to /object/account/2c92a0ff5c5f948c015c616ec0655062 failed: b'{"Errors":[{"Code":"MISSING_REQUIRED_VALUE","Message":"Payment term and billing batch are required before account can be activated."}],"Success":false}\n'
4 Comments
Master

Another bug: create account reponse includes "id", but create subscription response includes "subscriptionId".

Master

Also, for some API calls field names seem to require upper case, and for some lower case.

 

Here are two examples of working code, which don't work if the capitalization is changed:

 

                        payment = {
                            'AccountId': zaccount['Id'],
                            'Amount': invoice['Balance'],
                            'EffectiveDate': opp['CloseDate'],
                            'PaymentMethodId': zuora.get_payment_method('Other'),
                            'Type': 'External',
                            'Status': 'Processed',
                            'InvoiceId': invoice['Id'],
                            'AppliedInvoiceAmount': invoice['Balance']
                        }

                        zuora.create_payment(payment)

 

        for oli in opp['OpportunityLineItems']['records']:
            rate_plan_data = RATEPLAN_MAP[oli['Product2']['ProductCode']]
            subscribeToRatePlans.append({
                'productRatePlanId': rate_plan_data['productRatePlanId'],
                'chargeOverrides': [{
                    'productRatePlanChargeId': rate_plan_data['productRatePlanChargeId'],
                    'price': oli['UnitPrice'],
                    'quantity': oli['Quantity'],
                    'billCycleType': 'ChargeTriggerDay'
                }]
            })
        sub = {
            'accountKey': zuora_account['AccountNumber'],
            'autoRenew': False,
            'contractEffectiveDate': opp['CloseDate'],
            'initialTerm': int(opp['Term__c']),
            'invoice': False,
            'invoiceSeparately': True,
            'Ledger_Code__c': LEDGERCODE_MAP[lob],
            'Line_of_Business_LOB__c': LOB_MAP[lob],
            'Migration_Notes__c': 'migrated by shop_provsion script',
            # 'opportunityCloseDate_QT': opp['CloseDate'],
            'OpportunityId__c': opp['Id'],
            # 'opportunityName_QT': opp['Name'],
            'renewalTerm': 12,
            'subscribeToRatePlans': subscribeToRatePlans,
            'subscriptionNumber': opp['Name'],
            'termType': 'TERMED'
        }
Scholar

Thanks for sharing bolaurent ... I hope the team can resolve soon. 

We've been stung a bit with the inconsistencies in the API. The disclaimer has been updated recently to advise that not only is the documentation potentially wrong but the data returned may also be wrong. 

Valued Scholar

the lowercased vs uppercased first letter seems at least consistent:

 

the business-apis seem to use lowercased first letters

whereas the crud/operations or /object/ endpoints use properties with first letter uppercased.