This guide represents a geographic region that you can use as a target a
service related to the accounts.products.regionalInventories
resource. You can define regions as collections of either postal codes or, in
some countries, using predefined geotargets. For more information, see
Set up regions.
To create and update regions, you can use the following methods:
Retrieve a region
To retrieve a region defined in your Merchant Center account, use the
accounts.regions.get
method.
Here's a sample request:
GET https://merchantapi.googleapis.com/accounts/v1beta/accounts/125222396/regions/234567?key=[YOUR_API_KEY]
Here's a sample response from a successful call:
HTTP/1.1 200
{
"name": "accounts/125222396/regions/234567",
"displayName": "Canada",
"postalCodeArea": {
"regionCode": "CA",
"postalCodes": [
{
"begin": "L6A"
}
]
}
List all regions
To list the regions in your Merchant Center account, use the
accounts.regions.list
method.
Here's a sample request:
GET https://merchantapi.googleapis.com/accounts/v1beta/accounts/125222396/regions?pageSize=100&key=[YOUR_API_KEY]
Here's a sample response from a successful call:
HTTP/1.1 200
{
"regions": [
{
"name": "accounts/125222396/regions/234567",
"displayName": "Canada",
"postalCodeArea": {
"regionCode": "CA",
"postalCodes": [
{
"begin": "L6A"
}
]
},
"regionalInventoryEligible": true,
"shippingEligible": true
},
{
"name": "accounts/125222396/regions/Inline region",
"displayName": "Inline region",
"postalCodeArea": {
"regionCode": "CA",
"postalCodes": [
{
"begin": "M7B"
}
]
},
"regionalInventoryEligible": false,
"shippingEligible": true
},
]
}
Insert a region
To insert a region definition in your Merchant Center account, use the
accounts.regions.create
method. Executing this method requires administrator access.
Here's a sample request:
POST https://merchantapi.googleapis.com/accounts/v1beta/accounts/102959835/regions?regionId=987654&key=[YOUR_API_KEY]
{
"displayName": "TestRegion",
"name": "987654",
"postalCodeArea": {
"postalCodes": [
{
"begin": "98109"
}
],
"regionCode": "US"
}
}
Here's a sample response from a successful call:
{
"name": "accounts/102959835/regions/987654",
"displayName": "TestRegion",
"postalCodeArea": {
"regionCode": "US",
"postalCodes": [
{
"begin": "98109"
}
]
},
"regionalInventoryEligible": true,
"shippingEligible": true
}
To create a new region with AreaCode
:
Here's a sample request:
POST https://merchantapi.googleapis.com/accounts/v1beta/accounts/102959835/regions?regionId=168888&key=[YOUR_API_KEY] HTTP/1.1
{
"displayName": "WA_test",
"name": "168888",
"geotargetArea": {
"geotargetCriteriaIds": [
20101
]
}
}
Here's a sample response from a successful call:
{
"name": "accounts/102959835/regions/168888",
"displayName": "WA_test",
"geotargetArea": {
"geotargetCriteriaIds": [
"20101"
]
},
"regionalInventoryEligible": true,
"shippingEligible": false
}
To update the displayName
and GeoTargetCriteriaIds
for the region created:
Here's a sample request:
PATCH https://merchantapi.googleapis.com/accounts/v1beta/accounts/102959835/regions/168888?updateMask=displayName%2CgeotargetArea&key=[YOUR_API_KEY] HTTP/1.1
{
"displayName": "BR_test",
"geotargetArea": {
"geotargetCriteriaIds": [
20100
]
}
}
Here's a sample response from a successful call:
HTTP/1.1 200
{
"name": "accounts/102959835/regions/168888",
"displayName": "BR_test",
"geotargetArea": {
"geotargetCriteriaIds": [
"20100"
]
},
"regionalInventoryEligible": true,
"shippingEligible": false
}
Update a region
To update a region definition in your Merchant Center account, use the
accounts.regions.patch
method. Executing this method requires administrator access.
Here's a sample request:
PATCH https://merchantapi.googleapis.com/accounts/v1beta/accounts/102959835/regions/987654?updateMask=displayName%2CpostalCodeArea&key=[YOUR_API_KEY] HTTP/1.1
Authorization: Bearer [YOUR_ACCESS_TOKEN]
Accept: application/json
Content-Type: application/json
{
"displayName": "Test",
"postalCodeArea": {
"postalCodes": [
{
"begin": "98108"
}
],
"regionCode": "US"
}
}
Here's a sample response from a successful call:
{
"name": "accounts/102959835/regions/987654",
"displayName": "Test",
"postalCodeArea": {
"regionCode": "US",
"postalCodes": [
{
"begin": "98108"
}
]
},
"regionalInventoryEligible": true,
"shippingEligible": true
}
Delete a region
To delete a region definition from your Merchant Center account, use the
accounts.regions.delete
method. Executing this method requires administrator access.
Here's a sample request:
DELETE https://merchantapi.googleapis.com/accounts/v1beta/accounts/102959835/regions/987654?key=[YOUR_API_KEY] HTTP/1.1
Here's a sample response from a successful call:
HTTP/1.1 200
{}