Joshua
Joshua

Reputation: 1270

What is the RegionsVersion property used with the Google Play Developer API?

I am trying to use the Google Play Developer API to patch a subscription using the REST endpoint.

https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.subscriptions/patch

The required query parameters are updatedMask and regionsVersion. When I click on the RegionsVersion for documentation it just says:

A string representing version of the available regions being used for the specified resource.

https://developers.google.com/android-publisher/api-ref/rest/v3/RegionsVersion

Based on that description I'm not sure what kind of value it's expecting other than an object with a version property that is a string. When I omit the regionsVersion parameter is returns the following error:

{
    "error": {
        "code": 400,
        "message": "Regions version should be set to the default value 2022/01.",
        "status": "INVALID_ARGUMENT"
    }
}

Does anyone have any idea or an example of how this required parameter is intended to be used?

Upvotes: 0

Views: 364

Answers (2)

Josh Butler
Josh Butler

Reputation: 776

Additional information for folks that might be using the Google API Python Client to perform "patch" operations on product data (i.e. https://googleapis.github.io/google-api-python-client/docs/dyn/androidpublisher_v3.monetization.subscriptions.html#patch)

The following arguments are required:

  • regionsVersion_version - value assigned to this argument is added as "regionsVersion.version" query parameter value. Possible values can be got from here (drop-down in top right of page): https://play.google.com/supported-locations/?hl=en&sjid=16122161036447138560-EU
  • updateMask - value assigned to this argument is added as "updateMask" query parameter value. Tells the API which elements of the wider JSON POST/PATCH body to consider as eligible for the patch operation - e.g. setting the value as "basePlans" means ONLY the basePlans element of the JSON body will be used for the update (updating countries / prices)

Example code:

   response = api_client.monetization().subscriptions().patch(
        packageName=bundle_id,
        productId=product_id,
        body=subscription_object,
        regionsVersion_version='2025/01',
        updateMask="basePlans"
    ).execute()

Upvotes: 0

I had the same issue and I found that since it's s JSON object you'll have to set its property like that with query params:

?updateMask=listings&regionsVersion.version=2022/01

This worked fine for me!

Upvotes: 3

Related Questions