Re: Update rate plan charge via REST API without creating an amendment

Reply
Vojtek New Student

New Student

New Student
Posts: 2
Registered: a week ago
Accepted Solution

Update rate plan charge via REST API without creating an amendment

In our implementation we are using Zuora REST API in an application which runs periodically. We are trying to:

1. Get subscriptions containing rate plan charges with certain product rate plan charges included in three steps:

    a) first get the rate plan identifiers of the rate plan charges that contain certain product rate plan charges (ZOQL)

    b) then get the subscription identifiers of this rate plans (still ZOQL)

    c) finally, get the subscriptions VIA subscriptions API.

2. Enter them to ERP and write ERP identifiers back to rate plan charges.

 

The update call to a subscription API succeeds but, to my surprize, creates an amendment, which in fact means another subscription with the same name (number) in Zuora database. As a result when my application runs the second time trying to fetch rate plan charges with certain products not processed by my application, it gets the identifiers of the previous versions of subscription rate plan charges that were already processed. I know there is a variable on a subscription entity indicating whether or not it is active but I wouldn't like to fetch all the active subscriptions because not all of them contain the rate plan charges I would like to process. 

 

The biggest issue for me is a fact that the new subscription entity is created when updating the rate plan charge, and the old one is being kept in the database. That's why I would like to find a way to perform an update without creating an amendment. Is there any way to do that?

yamasaki1ma Master

Master

Master
Posts: 58
Registered: ‎02-22-2017

Re: Update rate plan charge via REST API without creating an amendment

Hi @Vojtek

 

Yes, there is a way to do what you want.

 

In conclusion, you should use the following Endpoint and request:
(I assume that the "ERP identifiers" of RatePlanCharge is the Custom field of RatePlanCharge that you created)

 

[POST] https://rest.apisandbox.zuora.com/v1/action/update
Request body:
{ "objects": [ { "Id": "2c92c0f96103b59801610d563e84296a", "your_customfield__c": "abcdefg" } ], "type": "RatePlanCharge" } Note: - For "Id", set the ID of RatePlanCharge (not Subscription). - Replace "your_customfield__c" with the API name of the Custom Field of your Sandbox.

 

Please tell me whether the results you performed match the results you want.

Highlighted
Vojtek New Student

New Student

New Student
Posts: 2
Registered: a week ago

Re: Update rate plan charge via REST API without creating an amendment

Hi @yamasaki1ma,

 

Thank you very, very much for your response. 

It worked perfectly! Smiley Happy