Tuesday, August 29, 2017

Changes to sub-account deletion in the Content API for Shopping


What's changing?

Currently, the Accounts.delete method deletes sub-accounts whether or not they contain products. On Sep 28, 2017, we will change the default behavior of Accounts.delete to only delete empty sub-accounts. We are introducing this change to help avoid accidental deletion of sub-accounts that are still serving products.

To override this behavior, we have introduced a force parameter, which currently defaults to true. On Sep 28, 2017, the default value will change to false. After this change, you must set this parameter to true to delete non-empty sub-accounts. Attempts to delete non-empty sub-accounts with force = false will result in a 403 Forbidden error. The error will also explain how to delete the non-empty account.

What do I need to do?

Right now, we suggest you familiarize yourself with the new force parameter. If you regularly delete non-empty accounts, you should adjust your code to set force to true to avoid errors when the default behavior changes. If you want to inspect the error that you will receive after the default behavior changes, you can manually set the force parameter to false and attempt to delete a non-empty account. (Of course, we suggest you create a new sub-account and add some products to it to try out this new behavior, instead of calling it on an existing live account.)

Once this change is live on Sep 28, 2017:
  • To delete an empty sub-account, you do not need to make any changes.
  • To delete a sub-account that contains products, you must set the new force flag to true when calling Accounts.delete.

Note: If you are using one of the Content API client libraries, you will need to update to a version published after Aug 28, 2017 to take advantage of this new parameter.

If you have any questions or feedback about the changes to account deletion or other questions about the Content API for Shopping, please let us know on the forum.